перенос лабы 2

This commit is contained in:
2026-10-18 15:05:51 +03:00
parent 0ab3a341aa
commit 13ee5a0e56
44 changed files with 6402 additions and 8 deletions
+80
View File
@@ -0,0 +1,80 @@
package store
import (
"context"
"time"
"mtusi2026lab3/internal/domain"
)
type Repository interface {
CreateUser(
ctx context.Context,
username string,
displayName string,
passwordHash string,
) (domain.User, error)
GetUserByID(
ctx context.Context,
userID string,
) (domain.User, error)
GetUserByUsername(
ctx context.Context,
username string,
) (domain.User, string, error)
CreateChat(
ctx context.Context,
title string,
memberIDs []string,
) (domain.Chat, error)
GetChatByID(
ctx context.Context,
chatID string,
callerID string,
) (domain.Chat, error)
GetChatsForUser(
ctx context.Context,
userID string,
limit int,
cursor string,
) (domain.ChatPage, error)
CreateMessage(
ctx context.Context,
chatID string,
senderID string,
text string,
) (domain.Message, error)
GetMessages(
ctx context.Context,
chatID string,
callerID string,
limit int,
cursor string,
) (domain.MessagePage, error)
CreateSession(
ctx context.Context,
tokenHash []byte,
userID string,
expiresAt time.Time,
) error
GetUserBySession(
ctx context.Context,
tokenHash []byte,
) (domain.User, error)
DeleteSession(
ctx context.Context,
tokenHash []byte,
) error
}
var _ Repository = (*PostgreSQLStore)(nil)