datastore

package
v0.0.0-...-53e80a7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AssociateAwayLogStatusActive   = 1
	AssociateAwayLogStatusArchived = 2
	UntilFurtherNoticeUnspecified  = 0
	UntilFurtherNoticeYes          = 1
	UntilFurtherNoticeNo           = 2
	ReasonUnspecified              = 0
	ReasonOther                    = 1
)
View Source
const (
	OrderAscending  = 1
	OrderDescending = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssociateAwayLog

type AssociateAwayLog struct {
	ID                    primitive.ObjectID `bson:"_id" json:"id"`
	TenantID              primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"`
	AssociateID           primitive.ObjectID `bson:"associate_id" json:"associate_id"`
	AssociateName         string             `bson:"associate_name" json:"associate_name,omitempty"`
	AssociateLexicalName  string             `bson:"associate_lexical_name" json:"associate_lexical_name,omitempty"`
	Reason                int8               `bson:"reason" json:"reason"`
	ReasonOther           string             `bson:"reason_other" json:"reason_other"`
	UntilFurtherNotice    int8               `bson:"until_further_notice" json:"until_further_notice"`
	UntilDate             time.Time          `bson:"until_date" json:"until_date"`
	StartDate             time.Time          `bson:"start_date" json:"start_date"`
	Status                int8               `bson:"status" json:"status"`
	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"`
	PublicID              uint64             `bson:"public_id" json:"public_id"`
}

type AssociateAwayLogAsSelectOption

type AssociateAwayLogAsSelectOption 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 AssociateAwayLogListFilter

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

	// Filter related.
	TenantID        primitive.ObjectID
	AssociateID     primitive.ObjectID
	Status          int8
	ExcludeArchived bool
	SearchText      string
}

type AssociateAwayLogListResult

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

type AssociateAwayLogPaginationListAndCountResult

type AssociateAwayLogPaginationListAndCountResult struct {
	Results     []*AssociateAwayLog `json:"results"`
	NextCursor  string              `json:"next_cursor"`
	HasNextPage bool                `json:"has_next_page"`
	Count       int64               `json:"count"`
}

AssociateAwayLogPaginationListResult represents the paginated list results for the AssociateAwayLog records (meaning limited).

type AssociateAwayLogPaginationListFilter

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

	// Filter related.
	TenantID    primitive.ObjectID
	AssociateID primitive.ObjectID
	Status      int8
	SearchText  string
}

type AssociateAwayLogPaginationListResult

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

AssociateAwayLogPaginationListResult represents the paginated list results for the associate records.

type AssociateAwayLogStorer

type AssociateAwayLogStorer interface {
	Create(ctx context.Context, m *AssociateAwayLog) error
	GetByID(ctx context.Context, id primitive.ObjectID) (*AssociateAwayLog, error)
	GetByPublicID(ctx context.Context, oldID uint64) (*AssociateAwayLog, error)
	GetByEmail(ctx context.Context, email string) (*AssociateAwayLog, error)
	GetByVerificationCode(ctx context.Context, verificationCode string) (*AssociateAwayLog, error)
	GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*AssociateAwayLog, error)
	CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
	UpdateByID(ctx context.Context, m *AssociateAwayLog) error
	ListByFilter(ctx context.Context, f *AssociateAwayLogPaginationListFilter) (*AssociateAwayLogPaginationListResult, error)
	ListAsSelectOptionByFilter(ctx context.Context, f *AssociateAwayLogPaginationListFilter) ([]*AssociateAwayLogAsSelectOption, error)
	CountByFilter(ctx context.Context, f *AssociateAwayLogPaginationListFilter) (int64, error)
	ListAndCountByFilter(ctx context.Context, f *AssociateAwayLogPaginationListFilter) (*AssociateAwayLogPaginationListAndCountResult, error)
	DeleteByID(ctx context.Context, id primitive.ObjectID) error
}

AssociateAwayLogStorer Interface for user.

func NewDatastore

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

type AssociateAwayLogStorerImpl

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

func (AssociateAwayLogStorerImpl) CheckIfExistsByEmail

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

func (AssociateAwayLogStorerImpl) CountByFilter

func (AssociateAwayLogStorerImpl) Create

func (AssociateAwayLogStorerImpl) DeleteByID

func (AssociateAwayLogStorerImpl) GetByEmail

func (impl AssociateAwayLogStorerImpl) GetByEmail(ctx context.Context, email string) (*AssociateAwayLog, error)

func (AssociateAwayLogStorerImpl) GetByID

func (AssociateAwayLogStorerImpl) GetByPublicID

func (impl AssociateAwayLogStorerImpl) GetByPublicID(ctx context.Context, oldID uint64) (*AssociateAwayLog, error)

func (AssociateAwayLogStorerImpl) GetByVerificationCode

func (impl AssociateAwayLogStorerImpl) GetByVerificationCode(ctx context.Context, verificationCode string) (*AssociateAwayLog, error)

func (AssociateAwayLogStorerImpl) GetLatestByTenantID

func (impl AssociateAwayLogStorerImpl) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*AssociateAwayLog, error)

func (AssociateAwayLogStorerImpl) ListAsSelectOptionByFilter

func (AssociateAwayLogStorerImpl) UpdateByID

Jump to

Keyboard shortcuts

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