Documentation ¶
Index ¶
- Constants
- type Offer
- type OfferAsSelectOption
- type OfferListFilter
- type OfferListResult
- type OfferPaginationListFilter
- type OfferPaginationListResult
- type OfferStorer
- type OfferStorerImpl
- func (impl OfferStorerImpl) CheckIfExistsByID(ctx context.Context, id primitive.ObjectID) (bool, error)
- func (impl OfferStorerImpl) CheckIfExistsByNameInOrgBranch(ctx context.Context, name string, orgID primitive.ObjectID, ...) (bool, error)
- func (impl OfferStorerImpl) Create(ctx context.Context, u *Offer) error
- func (impl OfferStorerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error
- func (impl OfferStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Offer, error)
- func (impl OfferStorerImpl) GetByName(ctx context.Context, name string) (*Offer, error)
- func (impl OfferStorerImpl) GetByServiceType(ctx context.Context, serviceType int8) (*Offer, error)
- func (impl OfferStorerImpl) GetByStripePriceID(ctx context.Context, stripePriceID string) (*Offer, error)
- func (impl OfferStorerImpl) GetByStripeProductID(ctx context.Context, stripeProductID string) (*Offer, error)
- func (impl OfferStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *OfferPaginationListFilter) ([]*OfferAsSelectOption, error)
- func (impl OfferStorerImpl) ListByFilter(ctx context.Context, f *OfferPaginationListFilter) (*OfferPaginationListResult, error)
- func (impl OfferStorerImpl) UpdateByID(ctx context.Context, m *Offer) error
- func (impl OfferStorerImpl) Upsert(ctx context.Context, offer *Offer) error
Constants ¶
View Source
const ( // StatusPending indicates the user has not posted this offer and remains hidden from all the users until active status is used. StatusPending = 1 // StatusActive controls that offer is active. StatusActive = 2 // StatusArchived controls that offer is deleted. StatusArchived = 3 // BusinessFunctionUnspecified indicates no business logic was set with this offer. BusinessFunctionUnspecified = 0 // BusinessFunctionGrantsComicbookSubmissionServices indicates the offer is based on this applications ability to allow making comicbook submissions by the retailer. BusinessFunctionGrantsComicbookSubmissionServices = 1 // PayFrequencyOneTime indicates user only pays once PayFrequencyOneTime = 1 PayFrequencyDay = 2 PayFrequencyWeek = 3 // PayFrequencyMonthly indicates user pays monthly. PayFrequencyMonthly = 4 // PayFrequencyAnnual indicates user pays annual. PayFrequencyAnnual = 5 // OfferTypeService indicates user gets access to Gym or staff OfferTypeService = 1 // OfferTypeProduct indicates user gets physical product OfferTypeProduct = 2 )
View Source
const ( SortOrderAscending = 1 SortOrderDescending = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Offer ¶
type Offer struct { Name string `bson:"name" json:"name"` Description string `bson:"description" json:"description"` Price float64 `bson:"price" json:"price"` PriceCurrency string `bson:"price_currency" json:"price_currency"` PayFrequency int8 `bson:"pay_frequency" json:"pay_frequency"` Status int8 `bson:"status" json:"status"` Type int8 `bson:"type" json:"type"` CreatedAt time.Time `bson:"created_at,omitempty" json:"created_at,omitempty"` ModifiedAt time.Time `bson:"modified_at,omitempty" json:"modified_at,omitempty"` ID primitive.ObjectID `bson:"_id" json:"id"` PaymentProcessorName string `bson:"payment_processor_name" json:"payment_processor_name"` StripeProductID string `bson:"stripe_product_id" json:"stripe_product_id"` StripePriceID string `bson:"stripe_price_id" json:"stripe_price_id"` StripeImageURL string `bson:"stripe_image_url" json:"stripe_image_url"` IsSubscription bool `bson:"is_subscription" json:"is_subscription"` // Controls how the user is able to book in our system. Special thanks to http://www.heppnetz.de/ontologies/goodrelations/v1#BusinessFunction. BusinessFunction int8 `bson:"business_function" json:"business_function"` // ServiceType indicatest the comic book service type associated with this // offer. ServiceType int8 `bson:"service_type" json:"service_type"` }
type OfferAsSelectOption ¶
type OfferListFilter ¶
type OfferListResult ¶
type OfferPaginationListResult ¶
type OfferPaginationListResult struct { Results []*Offer `json:"results"` NextCursor string `json:"next_cursor"` HasNextPage bool `json:"has_next_page"` }
OfferPaginationListResult represents the paginated list results for the associate records.
type OfferStorer ¶
type OfferStorer interface { Create(ctx context.Context, m *Offer) error GetByID(ctx context.Context, id primitive.ObjectID) (*Offer, error) GetByStripeProductID(ctx context.Context, stripeProductID string) (*Offer, error) GetByStripePriceID(ctx context.Context, stripePriceID string) (*Offer, error) GetByName(ctx context.Context, name string) (*Offer, error) GetByServiceType(ctx context.Context, serviceType int8) (*Offer, error) UpdateByID(ctx context.Context, m *Offer) error // Upsert will create the `Offer` record if the `ID` field doesn't exist, or update the `Offer` record if the `ID` exists. Upsert(ctx context.Context, offer *Offer) error ListByFilter(ctx context.Context, m *OfferPaginationListFilter) (*OfferPaginationListResult, error) ListAsSelectOptionByFilter(ctx context.Context, f *OfferPaginationListFilter) ([]*OfferAsSelectOption, error) DeleteByID(ctx context.Context, id primitive.ObjectID) error CheckIfExistsByNameInOrgBranch(ctx context.Context, name string, orgID primitive.ObjectID, branchID primitive.ObjectID) (bool, error) CheckIfExistsByID(ctx context.Context, id primitive.ObjectID) (bool, error) }
OfferStorer Interface for store.
func NewDatastore ¶
type OfferStorerImpl ¶
type OfferStorerImpl struct { Logger *slog.Logger DbClient *mongo.Client Collection *mongo.Collection }
func (OfferStorerImpl) CheckIfExistsByID ¶
func (OfferStorerImpl) CheckIfExistsByNameInOrgBranch ¶
func (OfferStorerImpl) Create ¶
func (impl OfferStorerImpl) Create(ctx context.Context, u *Offer) error
func (OfferStorerImpl) DeleteByID ¶
func (OfferStorerImpl) GetByServiceType ¶
func (OfferStorerImpl) GetByStripePriceID ¶
func (OfferStorerImpl) GetByStripeProductID ¶
func (OfferStorerImpl) ListAsSelectOptionByFilter ¶
func (impl OfferStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *OfferPaginationListFilter) ([]*OfferAsSelectOption, error)
func (OfferStorerImpl) ListByFilter ¶
func (impl OfferStorerImpl) ListByFilter(ctx context.Context, f *OfferPaginationListFilter) (*OfferPaginationListResult, error)
func (OfferStorerImpl) UpdateByID ¶
func (impl OfferStorerImpl) UpdateByID(ctx context.Context, m *Offer) error
Click to show internal directories.
Click to hide internal directories.