service

package
v0.0.0-...-3c68a0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddStoryRequest

type AddStoryRequest struct {
	ID              types.ID  `json:"-"`
	CreatorID       types.ID  `json:"-"`
	MediaFileID     types.ID  `json:"media_file_id"`
	Title           string    `json:"title"`
	Caption         string    `json:"caption"`
	LinkURL         string    `json:"link_url"`
	LinkText        string    `json:"link_text"`
	DurationSeconds int       `json:"duration_seconds"`
	PublishAt       time.Time `json:"publish_at"`
	ExpiresAt       time.Time `json:"expires_at"`
}

type AddStoryResponse

type AddStoryResponse struct {
	Story
}

type Repository

type Repository interface {
	SaveStory(ctx context.Context, req AddStoryRequest) (Story, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(repo Repository, vld Validate, storageService StorageService, tokenManager *tokenmanager.TokenManager,
	logger *slog.Logger) Service

func (Service) AddStory

func (s Service) AddStory(ctx context.Context, req AddStoryRequest, creatorID types.ID) (AddStoryResponse, error)

type StorageService

type StorageService interface {
	GetFileInfo(ctx context.Context, req *storagepb.GetFileInfoRequest, opts ...grpc.CallOption) (*storagepb.File, error)
	ConfirmFile(ctx context.Context, req *storagepb.ConfirmFileRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}

type Story

type Story struct {
	ID              types.ID  `json:"id"`
	MediaFileID     types.ID  `json:"media_file_id"`
	Title           string    `json:"title"`
	Caption         string    `json:"caption"`
	LinkURL         string    `json:"link_url"`
	LinkText        string    `json:"link_text"`
	DurationSeconds int       `json:"duration_seconds"`
	IsActive        bool      `json:"is_active"`
	CreatedAt       time.Time `json:"created_at"`
	PublishAt       time.Time `json:"publish_at"`
	ExpiresAt       time.Time `json:"expires_at"`
	CreatorID       types.ID  `json:"creator_id"`
	IsViewed        bool      `json:"is_viewed"`
}

func (*Story) IsVisible

func (s *Story) IsVisible() bool

type StoryView

type StoryView struct {
	StoryID  types.ID
	ViewerID types.ID
	ViewedAt time.Time
}

type Validate

type Validate struct {
	// contains filtered or unexported fields
}

func NewValidate

func NewValidate(t *translation.Translate) Validate

func (Validate) ValidateAddStoryRequest

func (v Validate) ValidateAddStoryRequest(req AddStoryRequest) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL