Documentation ¶
Index ¶
- Constants
- type Comment
- type CommentAsSelectOption
- type CommentPaginationListFilter
- type CommentPaginationListResult
- type CommentStorer
- type CommentStorerImpl
- func (impl CommentStorerImpl) CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
- func (impl CommentStorerImpl) Create(ctx context.Context, u *Comment) error
- func (impl CommentStorerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error
- func (impl CommentStorerImpl) GetByEmail(ctx context.Context, email string) (*Comment, error)
- func (impl CommentStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Comment, error)
- func (impl CommentStorerImpl) GetByPublicID(ctx context.Context, oldID uint64) (*Comment, error)
- func (impl CommentStorerImpl) GetByVerificationCode(ctx context.Context, verificationCode string) (*Comment, error)
- func (impl CommentStorerImpl) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*Comment, error)
- func (impl CommentStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *CommentPaginationListFilter) ([]*CommentAsSelectOption, error)
- func (impl CommentStorerImpl) ListByFilter(ctx context.Context, f *CommentPaginationListFilter) (*CommentPaginationListResult, error)
- func (impl CommentStorerImpl) ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*CommentPaginationListResult, error)
- func (impl CommentStorerImpl) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*CommentPaginationListResult, error)
- func (impl *CommentStorerImpl) PermanentlyDeleteAllByAssociateID(ctx context.Context, associateID primitive.ObjectID) error
- func (impl *CommentStorerImpl) PermanentlyDeleteAllByCustomerID(ctx context.Context, customerID primitive.ObjectID) error
- func (impl *CommentStorerImpl) PermanentlyDeleteAllByOrderID(ctx context.Context, orderID primitive.ObjectID) error
- func (impl *CommentStorerImpl) PermanentlyDeleteAllByStaffID(ctx context.Context, staffID primitive.ObjectID) error
- func (impl CommentStorerImpl) UpdateByID(ctx context.Context, m *Comment) error
Constants ¶
View Source
const ( CommentStatusActive = 1 CommentStatusArchived = 2 BelongsToCustomer = 1 BelongsToAssociate = 2 BelongsToOrder = 3 BelongsToStaff = 4 )
View Source
const ( OrderAscending = 1 OrderDescending = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID primitive.ObjectID `bson:"_id" json:"id"` BelongsTo int8 `bson:"belongs_to" json:"belongs_to"` CustomerID primitive.ObjectID `bson:"customer_id" json:"customer_id,omitempty"` CustomerName string `bson:"customer_name" json:"customer_name"` AssociateID primitive.ObjectID `bson:"associate_id" json:"associate_id,omitempty"` AssociateName string `bson:"associate_name" json:"associate_name"` OrderID primitive.ObjectID `bson:"order_id" json:"order_id,omitempty"` OrderWJID uint64 `bson:"order_wjid" json:"order_wjid"` OrderTenantIDWithWJID string `bson:"order_tenant_id_with_wjid" json:"order_tenant_id_with_wjid"` // OrderTenantIDWithWJID is a combination of `tenancy_id` and `wjid` values written in the following structure `%v_%v`. OrderIncidentID primitive.ObjectID `bson:"order_incident_id" json:"order_incident_id,omitempty"` OrderIncidentPublicID uint64 `bson:"order_incident_public_id" json:"order_incident_public_id"` StaffID primitive.ObjectID `bson:"staff_id" json:"staff_id,omitempty"` StaffName string `bson:"staff_name" json:"staff_name"` TenantID primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"` 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"` Content string `bson:"content" json:"content"` Status int8 `bson:"status" json:"status"` PublicID uint64 `bson:"public_id" json:"public_id"` }
type CommentAsSelectOption ¶
type CommentPaginationListFilter ¶
type CommentPaginationListFilter struct { // Pagination related. Cursor string 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 ExcludeArchived bool SearchText string BelongsTo int8 }
type CommentPaginationListResult ¶
type CommentPaginationListResult struct { Results []*Comment `json:"results"` NextCursor string `json:"next_cursor"` HasNextPage bool `json:"has_next_page"` }
CommentPaginationListResult represents the paginated list results for the associate records.
type CommentStorer ¶
type CommentStorer interface { Create(ctx context.Context, m *Comment) error GetByID(ctx context.Context, id primitive.ObjectID) (*Comment, error) GetByPublicID(ctx context.Context, oldID uint64) (*Comment, error) GetByEmail(ctx context.Context, email string) (*Comment, error) GetByVerificationCode(ctx context.Context, verificationCode string) (*Comment, error) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*Comment, error) CheckIfExistsByEmail(ctx context.Context, email string) (bool, error) UpdateByID(ctx context.Context, m *Comment) error ListByFilter(ctx context.Context, f *CommentPaginationListFilter) (*CommentPaginationListResult, error) ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*CommentPaginationListResult, error) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*CommentPaginationListResult, error) ListAsSelectOptionByFilter(ctx context.Context, f *CommentPaginationListFilter) ([]*CommentAsSelectOption, 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 PermanentlyDeleteAllByOrderID(ctx context.Context, orderID primitive.ObjectID) error }
CommentStorer Interface for user.
func NewDatastore ¶
type CommentStorerImpl ¶
type CommentStorerImpl struct { Logger *slog.Logger DbClient *mongo.Client Collection *mongo.Collection }
func (CommentStorerImpl) CheckIfExistsByEmail ¶
func (CommentStorerImpl) Create ¶
func (impl CommentStorerImpl) Create(ctx context.Context, u *Comment) error
func (CommentStorerImpl) DeleteByID ¶
func (CommentStorerImpl) GetByEmail ¶
func (CommentStorerImpl) GetByPublicID ¶
func (CommentStorerImpl) GetByVerificationCode ¶
func (CommentStorerImpl) GetLatestByTenantID ¶
func (CommentStorerImpl) ListAsSelectOptionByFilter ¶
func (impl CommentStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *CommentPaginationListFilter) ([]*CommentAsSelectOption, error)
func (CommentStorerImpl) ListByFilter ¶
func (impl CommentStorerImpl) ListByFilter(ctx context.Context, f *CommentPaginationListFilter) (*CommentPaginationListResult, error)
func (CommentStorerImpl) ListByOrderID ¶
func (impl CommentStorerImpl) ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*CommentPaginationListResult, error)
func (CommentStorerImpl) ListByOrderWJID ¶
func (impl CommentStorerImpl) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*CommentPaginationListResult, error)
func (*CommentStorerImpl) PermanentlyDeleteAllByAssociateID ¶
func (*CommentStorerImpl) PermanentlyDeleteAllByCustomerID ¶
func (*CommentStorerImpl) PermanentlyDeleteAllByOrderID ¶
func (*CommentStorerImpl) PermanentlyDeleteAllByStaffID ¶
func (CommentStorerImpl) UpdateByID ¶
func (impl CommentStorerImpl) UpdateByID(ctx context.Context, m *Comment) error
Click to show internal directories.
Click to hide internal directories.