datastore

package
v0.0.0-...-ee53a0f Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivitySheetStatusPending  = 5 // Deprecated.
	ActivitySheetStatusDeclined = 4
	ActivitySheetStatusAccepted = 3
	ActivitySheetStatusError    = 2
	ActivitySheetStatusArchived = 1

	ActivitySheetTypeUnassigned = 1
	ActivitySheetTypeResidentia = 2
	ActivitySheetTypeCommercial = 3
)
View Source
const (
	SortOrderAscending  = 1
	SortOrderDescending = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivitySheet

type ActivitySheet struct {
	ID                        primitive.ObjectID `bson:"_id" json:"id"`
	OrderID                   primitive.ObjectID `bson:"order_id" json:"order_id"`
	OrderWJID                 uint64             `bson:"order_wjid" json:"order_wjid"` // A.K.A. `Workery Job ID`
	AssociateOrganizationName string             `bson:"associate_organization_name" json:"associate_organization_name"`
	AssociateOrganizationType int8               `bson:"associate_organization_type" json:"associate_organization_type"`
	AssociateID               primitive.ObjectID `bson:"associate_id" json:"associate_id"`
	AssociateName             string             `bson:"associate_name" json:"associate_name"`
	AssociateLexicalName      string             `bson:"associate_lexical_name" json:"associate_lexical_name"`
	Comment                   string             `bson:"comment" json:"comment"`
	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"`
	Status                    int8               `bson:"status" json:"status"`
	Type                      int8               `bson:"type_of" json:"type_of"`
	TenantID                  primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"`
	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`.
	PublicID                  uint64             `bson:"public_id" json:"public_id"`
}

type ActivitySheetAsSelectOption

type ActivitySheetAsSelectOption struct {
	Value primitive.ObjectID `bson:"_id" json:"value"` // Extract from the database `_id` field and output through API as `value`.
	Label string             `bson:"name" json:"label"`
}

type ActivitySheetListFilter

type ActivitySheetListFilter struct {
	// Pagination related.
	Cursor    primitive.ObjectID
	PageSize  int64
	SortField string
	SortOrder int8 // 1=ascending | -1=descending

	// Filter related.
	TenantID        primitive.ObjectID
	AssociateID     primitive.ObjectID
	OrderID         primitive.ObjectID
	OrderWJID       uint64 // A.K.A. `Workery Job ID`
	Status          int8
	ExcludeArchived bool
	SearchText      string
}

type ActivitySheetListResult

type ActivitySheetListResult struct {
	Results     []*ActivitySheet   `json:"results"`
	NextCursor  primitive.ObjectID `json:"next_cursor"`
	HasNextPage bool               `json:"has_next_page"`
}

type ActivitySheetLite

type ActivitySheetLite struct {
	ID                    primitive.ObjectID `bson:"_id" json:"id"`
	OrderID               primitive.ObjectID `bson:"order_id" json:"order_id"`
	OrderWJID             uint64             `bson:"order_wjid" json:"order_wjid"` // A.K.A. `Workery Job ID`
	AssociateID           primitive.ObjectID `bson:"associate_id" json:"associate_id"`
	AssociateName         string             `bson:"associate_name" json:"associate_name"`
	AssociateLexicalName  string             `bson:"associate_lexical_name" json:"associate_lexical_name"`
	CreatedAt             time.Time          `bson:"created_at" json:"created_at"`
	Status                int8               `bson:"status" json:"status"`
	Type                  int8               `bson:"type_of" json:"type_of"`
	TenantID              primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"`
	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`.
}

type ActivitySheetLiteListResult

type ActivitySheetLiteListResult struct {
	Results     []*ActivitySheetLite `json:"results"`
	NextCursor  primitive.ObjectID   `json:"next_cursor"`
	HasNextPage bool                 `json:"has_next_page"`
}

type ActivitySheetPaginationListFilter

type ActivitySheetPaginationListFilter struct {
	// Pagination related.
	Cursor    string
	PageSize  int64
	SortField string
	SortOrder int8 // 1=ascending | -1=descending

	// Filter related.
	TenantID        primitive.ObjectID
	AssociateID     primitive.ObjectID
	OrderID         primitive.ObjectID
	OrderWJID       uint64 // A.K.A. `Workery Job ID`
	Status          int8
	ExcludeArchived bool
	SearchText      string
}

type ActivitySheetPaginationListResult

type ActivitySheetPaginationListResult struct {
	Results     []*ActivitySheet `json:"results"`
	NextCursor  string           `json:"next_cursor"`
	HasNextPage bool             `json:"has_next_page"`
}

ActivitySheetPaginationListResult represents the paginated list results for the activity sheet records.

type ActivitySheetPaginationLiteListResult

type ActivitySheetPaginationLiteListResult struct {
	Results     []*ActivitySheetLite `json:"results"`
	NextCursor  string               `json:"next_cursor"`
	HasNextPage bool                 `json:"has_next_page"`
}

ActivitySheetPaginationLiteListResults represents the paginated list results for the activity sheet records.

type ActivitySheetStorer

type ActivitySheetStorer interface {
	Create(ctx context.Context, m *ActivitySheet) error
	GetByID(ctx context.Context, id primitive.ObjectID) (*ActivitySheet, error)
	GetByPublicID(ctx context.Context, oldID uint64) (*ActivitySheet, error)
	GetByEmail(ctx context.Context, email string) (*ActivitySheet, error)
	GetByVerificationCode(ctx context.Context, verificationCode string) (*ActivitySheet, error)
	GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*ActivitySheet, error)
	CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
	UpdateByID(ctx context.Context, m *ActivitySheet) error
	ListByFilter(ctx context.Context, f *ActivitySheetPaginationListFilter) (*ActivitySheetPaginationListResult, error)
	LiteListByFilter(ctx context.Context, f *ActivitySheetPaginationListFilter) (*ActivitySheetPaginationLiteListResult, error)
	ListAsSelectOptionByFilter(ctx context.Context, f *ActivitySheetPaginationListFilter) ([]*ActivitySheetAsSelectOption, error)
	ListByOrderID(ctx context.Context, orderID primitive.ObjectID) (*ActivitySheetPaginationListResult, error)
	ListByOrderWJID(ctx context.Context, orderWJID uint64) (*ActivitySheetPaginationListResult, error)
	DeleteByID(ctx context.Context, id primitive.ObjectID) error
	PermanentlyDeleteAllByAssociateID(ctx context.Context, associateID primitive.ObjectID) error
	CountByFilter(ctx context.Context, f *ActivitySheetPaginationListFilter) (int64, error)
	CountByLast30DaysForAssociateID(ctx context.Context, associateID primitive.ObjectID) (int64, error)
}

ActivitySheetStorer Interface for user.

func NewDatastore

func NewDatastore(appCfg *c.Conf, loggerp *slog.Logger, client *mongo.Client) ActivitySheetStorer

type ActivitySheetStorerImpl

type ActivitySheetStorerImpl struct {
	Logger     *slog.Logger
	DbClient   *mongo.Client
	Collection *mongo.Collection
}

func (ActivitySheetStorerImpl) CheckIfExistsByEmail

func (impl ActivitySheetStorerImpl) CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)

func (ActivitySheetStorerImpl) CountByFilter

func (ActivitySheetStorerImpl) CountByLast30DaysForAssociateID

func (impl ActivitySheetStorerImpl) CountByLast30DaysForAssociateID(ctx context.Context, associateID primitive.ObjectID) (int64, error)

func (ActivitySheetStorerImpl) Create

func (ActivitySheetStorerImpl) DeleteByID

func (ActivitySheetStorerImpl) GetByEmail

func (impl ActivitySheetStorerImpl) GetByEmail(ctx context.Context, email string) (*ActivitySheet, error)

func (ActivitySheetStorerImpl) GetByID

func (ActivitySheetStorerImpl) GetByPublicID

func (impl ActivitySheetStorerImpl) GetByPublicID(ctx context.Context, oldID uint64) (*ActivitySheet, error)

func (ActivitySheetStorerImpl) GetByVerificationCode

func (impl ActivitySheetStorerImpl) GetByVerificationCode(ctx context.Context, verificationCode string) (*ActivitySheet, error)

func (ActivitySheetStorerImpl) GetLatestByTenantID

func (impl ActivitySheetStorerImpl) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*ActivitySheet, error)

func (ActivitySheetStorerImpl) ListAsSelectOptionByFilter

func (ActivitySheetStorerImpl) ListByOrderID

func (ActivitySheetStorerImpl) ListByOrderWJID

func (impl ActivitySheetStorerImpl) ListByOrderWJID(ctx context.Context, orderWJID uint64) (*ActivitySheetPaginationListResult, error)

func (*ActivitySheetStorerImpl) PermanentlyDeleteAllByAssociateID

func (impl *ActivitySheetStorerImpl) PermanentlyDeleteAllByAssociateID(ctx context.Context, associateID primitive.ObjectID) error

func (ActivitySheetStorerImpl) UpdateByID

func (impl ActivitySheetStorerImpl) UpdateByID(ctx context.Context, m *ActivitySheet) error

Jump to

Keyboard shortcuts

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