Documentation
¶
Overview ¶
Package attachments provides domain, repository and service logic for task attachments.
Index ¶
- Constants
- Variables
- func Module() fx.Option
- type Attachment
- type AttachmentInput
- type AttachmentStatus
- type AttachmentWithURL
- type Config
- type Repository
- func (r *Repository) Confirm(ctx context.Context, id int64) error
- func (r *Repository) Create(ctx context.Context, input AttachmentInput, storageKey string) (*Attachment, error)
- func (r *Repository) Delete(ctx context.Context, id int64) error
- func (r *Repository) GetByID(ctx context.Context, id int64) (*Attachment, error)
- func (r *Repository) Import(ctx context.Context, model *attachmentModel) (*Attachment, error)
- func (r *Repository) ListByTask(ctx context.Context, taskID int64) ([]Attachment, error)
- type Service
- func (s *Service) ConfirmUpload(ctx context.Context, id int64, uploaderID int64) (*Attachment, error)
- func (s *Service) Delete(ctx context.Context, user *users.User, id int64) error
- func (s *Service) GetDownloadURL(ctx context.Context, id int64) (string, error)
- func (s *Service) Import(ctx context.Context, taskID int64, fileName, localFilePath string, ...) (*Attachment, error)
- func (s *Service) InitUpload(ctx context.Context, input AttachmentInput) (*UploadResult, error)
- func (s *Service) ListByTask(ctx context.Context, taskID int64) ([]AttachmentWithURL, error)
- type UploadResult
Constants ¶
View Source
const ( DefaultMaxFileSizeBytes uint64 = 104857600 MaxFileNameLength int = 255 )
Variables ¶
Functions ¶
Types ¶
type Attachment ¶
type AttachmentInput ¶
func (AttachmentInput) Validate ¶
func (i AttachmentInput) Validate(maxFileSize uint64) error
type AttachmentStatus ¶
type AttachmentStatus string
const ( StatusPending AttachmentStatus = "pending" StatusUploaded AttachmentStatus = "uploaded" )
type AttachmentWithURL ¶
type AttachmentWithURL struct {
Attachment
DownloadURL string
}
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *bun.DB) *Repository
func (*Repository) Create ¶
func (r *Repository) Create(ctx context.Context, input AttachmentInput, storageKey string) (*Attachment, error)
func (*Repository) GetByID ¶
func (r *Repository) GetByID(ctx context.Context, id int64) (*Attachment, error)
func (*Repository) Import ¶ added in v0.2.0
func (r *Repository) Import(ctx context.Context, model *attachmentModel) (*Attachment, error)
func (*Repository) ListByTask ¶
func (r *Repository) ListByTask(ctx context.Context, taskID int64) ([]Attachment, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ConfirmUpload ¶
func (*Service) GetDownloadURL ¶
func (*Service) InitUpload ¶
func (s *Service) InitUpload(ctx context.Context, input AttachmentInput) (*UploadResult, error)
func (*Service) ListByTask ¶
type UploadResult ¶
type UploadResult struct {
Attachment *Attachment
UploadURL string
}
Click to show internal directories.
Click to hide internal directories.