forked from mtusi2026/mtusi2026lab2
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
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(ctx context.Context, callerID, chatID, 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
|
|
}
|