forked from mtusi2026/mtusi2026lab3
перенос лабы 2
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user