This commit is contained in:
Nurlygayanova Ekaterina
2026-11-05 17:56:30 +03:00
parent 0ab3a341aa
commit 1c95e2e68e
178 changed files with 21135 additions and 17 deletions
+34
View File
@@ -0,0 +1,34 @@
package store
import (
"context"
"gitflic.ru/project/relationskatie/mtusi2026lab1-ashchkl/internal/domain"
)
type UserStore interface {
CreateUser(ctx context.Context, username, displayName, passwordHash string) (domain.User, error)
UserByID(ctx context.Context, id string) (domain.User, error)
CredentialsByUsername(ctx context.Context, username string) (domain.User, string, error)
UsernameExists(ctx context.Context, username string) bool
}
type ChatStore interface {
CreateChat(ctx context.Context, callerID, title string, memberIDs []string) (domain.Chat, error)
ChatByID(ctx context.Context, callerID, chatID string) (domain.Chat, error)
ListChats(ctx context.Context, callerID, cursor string, limit int) (domain.Page[domain.Chat], error)
}
type MessageStore interface {
// AddMessage идемпотентен по (callerID, chatID, idempotencyKey): повтор с тем же
// text возвращает исходное сообщение, с другим — domain.ErrIdempotencyConflict.
AddMessage(ctx context.Context, callerID, chatID, idempotencyKey, text string) (domain.Message, error)
ListMessages(ctx context.Context, callerID, chatID, cursor string, limit int) (domain.Page[domain.Message], error)
}
type Store interface {
UserStore
ChatStore
MessageStore
}