forked from mtusi2026/mtusi2026lab6
feat: add bounded observability and verified SLO incident alerts
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// Package service defines the application operations consumed by HTTP controllers.
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab6/internal/model/dto"
|
||||
)
|
||||
|
||||
// Service validates raw input and enforces identity and membership requirements.
|
||||
// Implementations must not expose transport-specific types or storage internals.
|
||||
type Service interface {
|
||||
// UsersCreate registers a user or reports invalid input, conflict or capacity exhaustion.
|
||||
UsersCreate(ctx context.Context, request dto.UsersCreateRequestDTO) (dto.UserDTO, error)
|
||||
|
||||
// UsersCheckIdentity verifies that an identity belongs to an existing user.
|
||||
UsersCheckIdentity(ctx context.Context, userID string) error
|
||||
|
||||
// UsersGetMe resolves the authenticated caller, rejecting malformed or unknown identifiers.
|
||||
UsersGetMe(ctx context.Context, userID string) (dto.UserDTO, error)
|
||||
|
||||
// ChatsCreate validates all members and creates one chat atomically.
|
||||
ChatsCreate(ctx context.Context, request dto.ChatsCreateRequestDTO) (dto.ChatDTO, error)
|
||||
|
||||
// ChatsGetByID hides missing and inaccessible chats behind the same not-found result.
|
||||
ChatsGetByID(ctx context.Context, userID, chatID string) (dto.ChatDTO, error)
|
||||
|
||||
// ChatsGetPage lists only chats visible to the caller, using resource-bound cursors.
|
||||
ChatsGetPage(ctx context.Context, request dto.PageRequestDTO) (dto.ChatPageDTO, error)
|
||||
|
||||
// MessagesCreate derives the sender from the identity and appends validated text.
|
||||
MessagesCreate(ctx context.Context, request dto.MessagesCreateRequestDTO) (dto.MessageDTO, error)
|
||||
|
||||
// MessagesGetPage authorizes the caller and returns history after a verified cursor.
|
||||
MessagesGetPage(ctx context.Context, request dto.PageRequestDTO) (dto.MessagePageDTO, error)
|
||||
}
|
||||
Reference in New Issue
Block a user