forked from mtusi2026/mtusi2026lab4
29 lines
961 B
Go
29 lines
961 B
Go
package chat
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/jackc/pgx/v5"
|
|
|
|
"gitea.privcloud.tech/mtusi2026/internal/dto"
|
|
)
|
|
|
|
type chatsRepo interface {
|
|
CreateTx(ctx context.Context, tx pgx.Tx, req dto.Chat) error
|
|
GetForMember(ctx context.Context, req dto.ChatMember) (*dto.Chat, error)
|
|
ListForMember(ctx context.Context, userID uuid.UUID, page dto.PageQuery) ([]dto.Chat, error)
|
|
}
|
|
|
|
type messagesRepo interface {
|
|
AttachmentsForMessageTx(ctx context.Context, tx pgx.Tx, ids []uuid.UUID) ([]dto.MessageAttachment, error)
|
|
CreateIdempotentTx(ctx context.Context, tx pgx.Tx, req dto.CreateMessage) (*dto.Message, error)
|
|
GetByIDForChat(ctx context.Context, chatID, messageID uuid.UUID) (*dto.Message, error)
|
|
ListForChat(ctx context.Context, chatID uuid.UUID, page dto.PageQuery) ([]dto.Message, error)
|
|
}
|
|
|
|
type chatsCache interface {
|
|
Create(ctx context.Context, req dto.Chat) error
|
|
Get(ctx context.Context, chatID uuid.UUID) (*dto.Chat, error)
|
|
}
|