feat(domain,service):lab4 accept attachment_ids in idempotent request hash

This commit is contained in:
Голиков Maximillian Антон
2026-10-22 14:35:04 +03:00
parent 0834ac822a
commit 297a1858a3
2 changed files with 44 additions and 12 deletions
+13 -3
View File
@@ -17,7 +17,17 @@ type CreateIdempotentResult struct {
Replayed bool
}
func RequestHash(text string) []byte {
sum := sha256.Sum256([]byte(text))
return sum[:]
func RequestHash(text string, attachmentIDs []string) []byte {
if len(attachmentIDs) == 0 {
sum := sha256.Sum256([]byte(text))
return sum[:]
}
h := sha256.New()
h.Write([]byte(text))
h.Write([]byte{0})
for _, id := range attachmentIDs {
h.Write([]byte(id))
h.Write([]byte{0})
}
return h.Sum(nil)
}