Documentation
¶
Index ¶
- Constants
- type Attachment
- type AttachmentAsSelectOption
- type AttachmentListFilter
- type AttachmentListResult
- type AttachmentStorer
- type AttachmentStorerImpl
- func (impl AttachmentStorerImpl) CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
- func (impl AttachmentStorerImpl) Create(ctx context.Context, u *Attachment) error
- func (impl AttachmentStorerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error
- func (impl AttachmentStorerImpl) GetByEmail(ctx context.Context, email string) (*Attachment, error)
- func (impl AttachmentStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Attachment, error)
- func (impl AttachmentStorerImpl) GetByPublicID(ctx context.Context, oldID uint64) (*Attachment, error)
- func (impl AttachmentStorerImpl) GetByVerificationCode(ctx context.Context, verificationCode string) (*Attachment, error)
- func (impl AttachmentStorerImpl) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*Attachment, error)
- func (impl AttachmentStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *AttachmentListFilter) ([]*AttachmentAsSelectOption, error)
- func (impl AttachmentStorerImpl) ListByFilter(ctx context.Context, f *AttachmentListFilter) (*AttachmentListResult, error)
- func (impl AttachmentStorerImpl) ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*AttachmentListResult, error)
- func (impl AttachmentStorerImpl) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*AttachmentListResult, error)
- func (impl AttachmentStorerImpl) ListByType(ctx context.Context, typeOf int8) (*AttachmentListResult, error)
- func (impl *AttachmentStorerImpl) PermanentlyDeleteAllByAssociateID(ctx context.Context, associateID primitive.ObjectID) error
- func (impl *AttachmentStorerImpl) PermanentlyDeleteAllByCustomerID(ctx context.Context, customerID primitive.ObjectID) error
- func (impl AttachmentStorerImpl) PermanentlyDeleteAllByStaffID(ctx context.Context, staffID primitive.ObjectID) error
- func (impl AttachmentStorerImpl) UpdateByID(ctx context.Context, m *Attachment) error
Constants ¶
View Source
const ( AttachmentStatusActive = 1 AttachmentStatusArchived = 2 AttachmentTypeCustomer = 1 AttachmentTypeAssociate = 2 AttachmentTypeOrder = 3 AttachmentTypeStaff = 4 )
View Source
const ( OrderAscending = 1 OrderDescending = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { ID primitive.ObjectID `bson:"_id" json:"id"` TenantID primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"` Filename string `bson:"filename" json:"filename"` // 4 FileType string `bson:"filetype" json:"filetype"` ObjectKey string `bson:"object_key" json:"object_key"` // 4 ObjectURL string `bson:"object_url" json:"object_url"` // 4 Title string `bson:"title" json:"title"` // 5 Description string `bson:"description" json:"description"` // 6 CreatedAt time.Time `bson:"created_at" json:"created_at"` CreatedByUserID primitive.ObjectID `bson:"created_by_user_id" json:"created_by_user_id,omitempty"` CreatedByUserName string `bson:"created_by_user_name" json:"created_by_user_name"` CreatedFromIPAddress string `bson:"created_from_ip_address" json:"created_from_ip_address"` ModifiedAt time.Time `bson:"modified_at" json:"modified_at"` ModifiedByUserID primitive.ObjectID `bson:"modified_by_user_id" json:"modified_by_user_id,omitempty"` ModifiedByUserName string `bson:"modified_by_user_name" json:"modified_by_user_name"` ModifiedFromIPAddress string `bson:"modified_from_ip_address" json:"modified_from_ip_address"` AssociateID primitive.ObjectID `bson:"associate_id" json:"associate_id"` // 14 AssociateName string `bson:"associate_name" json:"associate_name"` CustomerID primitive.ObjectID `bson:"customer_id" json:"customer_id"` //15 CustomerName string `bson:"customer_name" json:"customer_name"` StaffID primitive.ObjectID `bson:"staff_id" json:"staff_id"` // 17 StaffName string `bson:"staff_name" json:"staff_name"` OrderID primitive.ObjectID `bson:"order_id" json:"order_id"` // 18 OrderWJID uint64 `bson:"order_wjid" json:"order_wjid"` // 18 OrderTenantIDWithWJID string `bson:"order_tenant_id_with_wjid" json:"order_tenant_id_with_wjid"` // TenantIDWithWJID is a combination of `tenancy_id` and `wjid` values written in the following structure `%v_%v`. Status int8 `bson:"status" json:"status"` // 19 PublicID uint64 `bson:"public_id" json:"public_id"` // 20 Type int8 `bson:"type" json:"type"` // 19 }
type AttachmentListFilter ¶
type AttachmentListFilter struct { // Pagination related. Cursor primitive.ObjectID PageSize int64 SortField string SortOrder int8 // 1=ascending | -1=descending // Filter related. TenantID primitive.ObjectID CustomerID primitive.ObjectID AssociateID primitive.ObjectID OrderID primitive.ObjectID OrderWJID uint64 StaffID primitive.ObjectID Status int8 Type int8 ExcludeArchived bool SearchText string }
type AttachmentListResult ¶
type AttachmentListResult struct { Results []*Attachment `json:"results"` NextCursor primitive.ObjectID `json:"next_cursor"` HasNextPage bool `json:"has_next_page"` }
type AttachmentStorer ¶
type AttachmentStorer interface { Create(ctx context.Context, m *Attachment) error GetByID(ctx context.Context, id primitive.ObjectID) (*Attachment, error) GetByPublicID(ctx context.Context, oldID uint64) (*Attachment, error) GetByEmail(ctx context.Context, email string) (*Attachment, error) GetByVerificationCode(ctx context.Context, verificationCode string) (*Attachment, error) CheckIfExistsByEmail(ctx context.Context, email string) (bool, error) UpdateByID(ctx context.Context, m *Attachment) error ListByFilter(ctx context.Context, f *AttachmentListFilter) (*AttachmentListResult, error) ListAsSelectOptionByFilter(ctx context.Context, f *AttachmentListFilter) ([]*AttachmentAsSelectOption, error) ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*AttachmentListResult, error) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*AttachmentListResult, error) ListByType(ctx context.Context, typeOf int8) (*AttachmentListResult, error) DeleteByID(ctx context.Context, id primitive.ObjectID) error PermanentlyDeleteAllByCustomerID(ctx context.Context, customerID primitive.ObjectID) error PermanentlyDeleteAllByAssociateID(ctx context.Context, associateID primitive.ObjectID) error PermanentlyDeleteAllByStaffID(ctx context.Context, staffID primitive.ObjectID) error }
AttachmentStorer Interface for user.
func NewDatastore ¶
type AttachmentStorerImpl ¶
type AttachmentStorerImpl struct { Logger *slog.Logger DbClient *mongo.Client Collection *mongo.Collection }
func (AttachmentStorerImpl) CheckIfExistsByEmail ¶
func (AttachmentStorerImpl) Create ¶
func (impl AttachmentStorerImpl) Create(ctx context.Context, u *Attachment) error
func (AttachmentStorerImpl) DeleteByID ¶
func (AttachmentStorerImpl) GetByEmail ¶
func (impl AttachmentStorerImpl) GetByEmail(ctx context.Context, email string) (*Attachment, error)
func (AttachmentStorerImpl) GetByID ¶
func (impl AttachmentStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Attachment, error)
func (AttachmentStorerImpl) GetByPublicID ¶
func (impl AttachmentStorerImpl) GetByPublicID(ctx context.Context, oldID uint64) (*Attachment, error)
func (AttachmentStorerImpl) GetByVerificationCode ¶
func (impl AttachmentStorerImpl) GetByVerificationCode(ctx context.Context, verificationCode string) (*Attachment, error)
func (AttachmentStorerImpl) GetLatestByTenantID ¶
func (impl AttachmentStorerImpl) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*Attachment, error)
func (AttachmentStorerImpl) ListAsSelectOptionByFilter ¶
func (impl AttachmentStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *AttachmentListFilter) ([]*AttachmentAsSelectOption, error)
func (AttachmentStorerImpl) ListByFilter ¶
func (impl AttachmentStorerImpl) ListByFilter(ctx context.Context, f *AttachmentListFilter) (*AttachmentListResult, error)
func (AttachmentStorerImpl) ListByOrderID ¶
func (impl AttachmentStorerImpl) ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*AttachmentListResult, error)
func (AttachmentStorerImpl) ListByOrderWJID ¶
func (impl AttachmentStorerImpl) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*AttachmentListResult, error)
func (AttachmentStorerImpl) ListByType ¶
func (impl AttachmentStorerImpl) ListByType(ctx context.Context, typeOf int8) (*AttachmentListResult, error)
func (*AttachmentStorerImpl) PermanentlyDeleteAllByAssociateID ¶
func (*AttachmentStorerImpl) PermanentlyDeleteAllByCustomerID ¶
func (AttachmentStorerImpl) PermanentlyDeleteAllByStaffID ¶
func (AttachmentStorerImpl) UpdateByID ¶
func (impl AttachmentStorerImpl) UpdateByID(ctx context.Context, m *Attachment) error
Click to show internal directories.
Click to hide internal directories.