Documentation
¶
Index ¶
- type Comment
- type CreateIn
- type Service
- func (s *Service) Create(ctx context.Context, db database.TenantDB, in CreateIn) (uuid.UUID, error)
- func (s *Service) Edit(ctx context.Context, db database.TenantDB, id uuid.UUID, expectedVersion int, ...) error
- func (s *Service) List(ctx context.Context, db database.TenantDB, ref resource.Ref) ([]Comment, error)
- func (s *Service) Void(ctx context.Context, db database.TenantDB, id uuid.UUID, expectedVersion int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct {
ID uuid.UUID
Resource resource.Ref
ParentID *uuid.UUID
AuthorCapacityID uuid.UUID
Body string
Status string
Version int
CreatedAt time.Time
CreatedBy uuid.UUID
UpdatedAt *time.Time
UpdatedBy *uuid.UUID
}
Comment is a persisted comment row.
type CreateIn ¶
type CreateIn struct {
Resource resource.Ref
ParentID *uuid.UUID
AuthorCapacityID uuid.UUID
Body string
}
CreateIn is the input to Create.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages comments inside a tenant transaction.
func (*Service) Create ¶
Create inserts a new comment. Validates inputs; checks parent thread consistency.
func (*Service) Edit ¶
func (s *Service) Edit(ctx context.Context, db database.TenantDB, id uuid.UUID, expectedVersion int, newBody string) error
Edit updates a comment body with optimistic locking. Voided comments cannot be edited. When ob is wired, emits "comment.edited" with previous and new body for audit history.
Click to show internal directories.
Click to hide internal directories.