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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderStatusNew                = 1
	OrderStatusDeclined           = 2
	OrderStatusPending            = 3
	OrderStatusCancelled          = 4
	OrderStatusOngoing            = 5
	OrderStatusInProgress         = 6
	OrderStatusCompletedButUnpaid = 7
	OrderStatusCompletedAndPaid   = 8
	OrderStatusArchived           = 9

	OrderTypeAnotherUnassigned = 0
	OrderTypeResidential       = 1
	OrderTypeCommercial        = 2
	OrderTypeUnassigned        = 3

	OrderInvoicePaidToAssociate    = 1
	OrderInvoicePaidToOrganization = 2

	OrderUnassignedReasonOther                        = 1
	OrderUnassignedReasonAossicateNotAFit             = 2
	OrderUnassignedReasonJobBiggerThanThought         = 3
	OrderUnassignedReasonClientChangedJobRequirements = 4
	OrderUnassignedReasonAssociateNeedsMoreTime       = 5

	PaymentMethodOther          = 1
	PaymentMethodCash           = 2
	PaymentMethodCheque         = 3
	PaymentMethodETransfer      = 4
	PaymentMethodDebit          = 5
	PaymentMethodCredit         = 6
	PaymentMethodPurchaseOrder  = 7
	PaymentMethodCryptocurrency = 8
)
View Source
const (
	SortOrderAscending  = 1
	SortOrderDescending = -1
)

Variables

View Source
var OrderClosingReasonLabels = map[int8]string{
	1:  "Other",
	2:  "Quote was too high",
	3:  "Job completed by someone else",
	4:  "Unspecified",
	5:  "Work no longer needed",
	6:  "Client not satisfied with Associate",
	7:  "Client did work themselves",
	8:  "No Associate available",
	9:  "Work environment unsuitable",
	10: "Client did not return call",
	11: "Associate did not have necessary equipment",
	12: "Repair not possible",
	13: "Could not meet deadline",
	14: "Associate did not call client",
	15: "Member issue",
	16: "Client billing issue",
}
View Source
var OrderOrganizationInvoicePaidToLabels = map[int8]string{
	OrderInvoicePaidToAssociate:    "Associate",
	OrderInvoicePaidToOrganization: "Organization",
}
View Source
var OrderStatusLabels = map[int8]string{
	OrderStatusArchived:           "Archived",
	OrderStatusNew:                "New",
	OrderStatusDeclined:           "Declined",
	OrderStatusPending:            "Pending",
	OrderStatusCancelled:          "Cancelled",
	OrderStatusOngoing:            "Ongoing",
	OrderStatusInProgress:         "In Progress",
	OrderStatusCompletedButUnpaid: "Completed but Unpaid",
	OrderStatusCompletedAndPaid:   "Completed and Paid",
}
View Source
var OrderTypeLabels = map[int8]string{
	OrderTypeResidential:       "Residential",
	OrderTypeCommercial:        "Commercial",
	OrderTypeUnassigned:        "Unassigned",
	OrderTypeAnotherUnassigned: "-",
}
View Source
var OrderUnassignedReasonToLabels = map[int8]string{
	OrderUnassignedReasonOther:                        "Other",
	OrderUnassignedReasonAossicateNotAFit:             "Associate not a fit",
	OrderUnassignedReasonJobBiggerThanThought:         "Job bigger than thought",
	OrderUnassignedReasonClientChangedJobRequirements: "Client changed job requirements",
	OrderUnassignedReasonAssociateNeedsMoreTime:       "Associate needs more time",
}
View Source
var PaymentMethodLabels = map[int8]string{
	PaymentMethodOther:          "Other",
	PaymentMethodCash:           "Cash",
	PaymentMethodCheque:         "Cheque",
	PaymentMethodETransfer:      "E-Transfer",
	PaymentMethodDebit:          "Debit",
	PaymentMethodCredit:         "Credit",
	PaymentMethodPurchaseOrder:  "Purchase Order",
	PaymentMethodCryptocurrency: "Cryptocurrency",
}

Functions

This section is empty.

Types

type Order

type Order struct {
	ID                                    primitive.ObjectID           `bson:"_id" json:"id"`
	WJID                                  uint64                       `bson:"wjid" json:"wjid"` // A.K.A. `Workery Job ID` (Not including tenancy)
	CustomerID                            primitive.ObjectID           `bson:"customer_id" json:"customer_id"`
	CustomerPublicID                      uint64                       `bson:"customer_public_id" json:"customer_public_id"`
	CustomerOrganizationName              string                       `bson:"customer_organization_name" json:"customer_organization_name"`
	CustomerOrganizationType              int8                         `bson:"customer_organization_type" json:"customer_organization_type"`
	CustomerFirstName                     string                       `bson:"customer_first_name" json:"customer_first_name,omitempty"`
	CustomerLastName                      string                       `bson:"customer_last_name" json:"customer_last_name,omitempty"`
	CustomerName                          string                       `bson:"customer_name" json:"customer_name,omitempty"`
	CustomerLexicalName                   string                       `bson:"customer_lexical_name" json:"customer_lexical_name,omitempty"`
	CustomerGender                        int8                         `bson:"customer_gender" json:"customer_gender"`
	CustomerGenderOther                   string                       `bson:"customer_gender_other" json:"customer_gender_other"`
	CustomerBirthdate                     time.Time                    `bson:"customer_birthdate" json:"customer_birthdate"`
	CustomerEmail                         string                       `bson:"customer_email" json:"customer_email"`
	CustomerPhone                         string                       `bson:"customer_phone" json:"customer_phone,omitempty"`
	CustomerPhoneType                     int8                         `bson:"customer_phone_type" json:"customer_phone_type"`
	CustomerPhoneExtension                string                       `bson:"customer_phone_extension" json:"customer_phone_extension"`
	CustomerOtherPhone                    string                       `bson:"customer_other_phone" json:"customer_other_phone"`
	CustomerOtherPhoneExtension           string                       `bson:"customer_other_phone_extension" json:"customer_other_phone_extension"`
	CustomerOtherPhoneType                int8                         `bson:"customer_other_phone_type" json:"customer_other_phone_type"`
	CustomerFullAddressWithoutPostalCode  string                       `bson:"customer_full_address_without_postal_code" json:"customer_full_address_without_postal_code"`
	CustomerFullAddressURL                string                       `bson:"customer_full_address_url" json:"customer_full_address_url"`
	CustomerTags                          []*OrderTag                  `bson:"customer_tags" json:"customer_tags,omitempty"`
	AssociateID                           primitive.ObjectID           `bson:"associate_id" json:"associate_id"`
	AssociatePublicID                     uint64                       `bson:"associate_public_id" json:"associate_public_id"`
	AssociateOrganizationName             string                       `bson:"associate_organization_name" json:"associate_organization_name"`
	AssociateOrganizationType             int8                         `bson:"associate_organization_type" json:"associate_organization_type"`
	AssociateFirstName                    string                       `bson:"associate_first_name" json:"associate_first_name,omitempty"`
	AssociateLastName                     string                       `bson:"associate_last_name" json:"associate_last_name,omitempty"`
	AssociateName                         string                       `bson:"associate_name" json:"associate_name,omitempty"`
	AssociateLexicalName                  string                       `bson:"associate_lexical_name" json:"associate_lexical_name,omitempty"`
	AssociateGender                       int8                         `bson:"associate_gender" json:"associate_gender"`
	AssociateGenderOther                  string                       `bson:"associate_gender_other" json:"associate_gender_other"`
	AssociateBirthdate                    time.Time                    `bson:"associate_birthdate" json:"associate_birthdate"`
	AssociateEmail                        string                       `bson:"associate_email" json:"associate_email,omitempty"`
	AssociatePhone                        string                       `bson:"associate_phone" json:"associate_phone,omitempty"`
	AssociatePhoneType                    int8                         `bson:"associate_phone_type" json:"associate_phone_type"`
	AssociatePhoneExtension               string                       `bson:"associate_phone_extension" json:"associate_phone_extension"`
	AssociateOtherPhone                   string                       `bson:"associate_other_phone" json:"associate_other_phone"`
	AssociateOtherPhoneExtension          string                       `bson:"associate_other_phone_extension" json:"associate_other_phone_extension"`
	AssociateOtherPhoneType               int8                         `bson:"associate_other_phone_type" json:"associate_other_phone_type"`
	AssociateFullAddressWithoutPostalCode string                       `bson:"associate_full_address_without_postal_code" json:"associate_full_address_without_postal_code"`
	AssociateFullAddressURL               string                       `bson:"associate_full_address_url" json:"associate_full_address_url"`
	AssociateTags                         []*OrderTag                  `bson:"associate_tags" json:"associate_tags,omitempty"`
	AssociateSkillSets                    []*OrderSkillSet             `bson:"associate_skill_sets" json:"associate_skill_sets,omitempty"`
	AssociateInsuranceRequirements        []*OrderInsuranceRequirement `bson:"associate_insurance_requirements" json:"associate_insurance_requirements,omitempty"`
	AssociateVehicleTypes                 []*OrderVehicleType          `bson:"associate_vehicle_types" json:"associate_vehicle_types,omitempty"`
	AssociateTaxID                        string                       `bson:"associate_tax_id" json:"associate_tax_id"`
	AssociateServiceFeeID                 primitive.ObjectID           `bson:"associate_service_fee_id" json:"associate_service_fee_id"`
	AssociateServiceFeeName               string                       `bson:"associate_service_fee_name" json:"associate_service_fee_name"`
	AssociateServiceFeePercentage         float64                      `bson:"associate_service_fee_percentage" json:"associate_service_fee_percentage"`
	TenantID                              primitive.ObjectID           `bson:"tenant_id" json:"tenant_id,omitempty"`
	TenantIDWithWJID                      string                       `bson:"tenant_id_with_wjid" json:"tenant_id_with_wjid"` // TenantIDWithWJID is a combination of `tenancy_id` and `wjid` values written in the following structure `%v_%v`.
	Description                           string                       `bson:"description" json:"description"`
	AssignmentDate                        time.Time                    `bson:"assignment_date" json:"assignment_date"`
	IsOngoing                             bool                         `bson:"is_ongoing" json:"is_ongoing"`
	IsHomeSupportService                  bool                         `bson:"is_home_support_service" json:"is_home_support_service"`
	StartDate                             time.Time                    `bson:"start_date" json:"start_date"`
	CompletionDate                        time.Time                    `bson:"completion_date" json:"completion_date"`
	Hours                                 float64                      `bson:"hours" json:"hours"`
	Type                                  int8                         `bson:"type" json:"type"`
	IndexedText                           string                       `bson:"indexed_text" json:"indexed_text"`
	ClosingReason                         int8                         `bson:"closing_reason" json:"closing_reason"`
	ClosingReasonOther                    string                       `bson:"closing_reason_other" json:"closing_reason_other"`
	Status                                int8                         `bson:"status" json:"status"`
	Currency                              string                       `bson:"currency" json:"currency"`
	WasJobSatisfactory                    bool                         `bson:"was_job_satisfactory" json:"was_job_satisfactory"`
	WasJobFinishedOnTimeAndOnBudget       bool                         `bson:"was_job_finished_on_time_and_on_budget" json:"was_job_finished_on_time_and_on_budget"`
	WasAssociatePunctual                  bool                         `bson:"was_associate_punctual" json:"was_associate_punctual"`
	WasAssociateProfessional              bool                         `bson:"was_associate_professional" json:"was_associate_professional"`
	WouldCustomerReferOurOrganization     bool                         `bson:"would_customer_refer_our_organization" json:"would_customer_refer_our_organization"`
	Score                                 float64                      `bson:"score" json:"score"`
	InvoiceDate                           time.Time                    `bson:"invoice_date" json:"invoice_date"`
	InvoiceQuoteAmount                    float64                      `bson:"invoice_quote_amount" json:"invoice_quote_amount"`
	InvoiceLabourAmount                   float64                      `bson:"invoice_labour_amount" json:"invoice_labour_amount"`
	InvoiceMaterialAmount                 float64                      `bson:"invoice_material_amount" json:"invoice_material_amount"`
	InvoiceTaxAmount                      float64                      `bson:"invoice_tax_amount" json:"invoice_tax_amount"`
	InvoiceIsCustomTaxAmount              bool                         `bson:"invoice_is_custom_tax_amount" json:"invoice_is_custom_tax_amount"`
	InvoiceTotalAmount                    float64                      `bson:"invoice_total_amount" json:"invoice_total_amount"`
	InvoiceServiceFeeAmount               float64                      `bson:"invoice_service_fee_amount" json:"invoice_service_fee_amount"`
	InvoiceServiceFeePaymentDate          time.Time                    `bson:"invoice_service_fee_payment_date" json:"invoice_service_fee_payment_date"`
	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"`
	InvoiceServiceFeeID                   primitive.ObjectID           `bson:"invoice_service_fee_id" json:"invoice_service_fee_id"`
	InvoiceServiceFeeName                 string                       `bson:"invoice_service_fee_name" json:"invoice_service_fee_name"`
	InvoiceServiceFeeDescription          string                       `bson:"invoice_service_fee_description" json:"invoice_service_fee_description"`
	InvoiceServiceFeePercentage           float64                      `bson:"invoice_service_fee_percentage" json:"invoice_service_fee_percentage"`
	LatestPendingTaskID                   primitive.ObjectID           `bson:"latest_pending_task_id" json:"latest_pending_task_id"`
	LatestPendingTaskTitle                string                       `bson:"latest_pending_task_title" json:"latest_pending_task_title"`
	LatestPendingTaskDescription          string                       `bson:"latest_pending_task_description" json:"latest_pending_task_description"`
	LatestPendingTaskDueDate              time.Time                    `bson:"latest_pending_task_due_date" json:"latest_pending_task_due_date"`
	LatestPendingTaskType                 int8                         `bson:"latest_pending_task_type" json:"latest_pending_task_type"`
	OngoingOrderID                        primitive.ObjectID           `bson:"ongoing_work_order_id" json:"ongoing_work_order_id"`
	WasSurveyConducted                    bool                         `bson:"was_survey_conducted" json:"was_survey_conducted"`
	WasThereFinancialsInputted            bool                         `bson:"was_there_financials_inputted" json:"was_there_financials_inputted"`
	InvoiceActualServiceFeeAmountPaid     float64                      `bson:"invoice_actual_service_fee_amount_paid" json:"invoice_actual_service_fee_amount_paid"`
	InvoiceBalanceOwingAmount             float64                      `bson:"invoice_balance_owing_amount" json:"invoice_balance_owing_amount"`
	InvoiceQuotedLabourAmount             float64                      `bson:"invoice_quoted_labour_amount" json:"invoice_quoted_labour_amount"`
	InvoiceQuotedMaterialAmount           float64                      `bson:"invoice_quoted_material_amount" json:"invoice_quoted_material_amount"`
	InvoiceTotalQuoteAmount               float64                      `bson:"invoice_total_quote_amount" json:"invoice_total_quote_amount"`
	Visits                                int8                         `bson:"visits" json:"visits"`
	InvoiceIDs                            string                       `bson:"invoice_ids" json:"invoice_ids"`
	NoSurveyConductedReason               int8                         `bson:"no_survey_conducted_reason" json:"no_survey_conducted_reason"`
	NoSurveyConductedReasonOther          string                       `bson:"no_survey_conducted_reason_other" json:"no_survey_conducted_reason_other"`
	ClonedFromOrderID                     primitive.ObjectID           `bson:"cloned_from_order_id" json:"cloned_from_order_id"`
	InvoiceDepositAmount                  float64                      `bson:"invoice_deposit_amount_id" json:"invoice_deposit_amount"`
	InvoiceOtherCostsAmount               float64                      `bson:"invoice_other_costs_amount" json:"invoice_other_costs_amount"`
	InvoiceQuotedOtherCostsAmount         float64                      `bson:"invoice_quoted_other_costs_amount" json:"invoice_quoted_other_costs_amount"`
	InvoicePaidTo                         int8                         `bson:"invoice_paid_to" json:"invoice_paid_to"`
	InvoiceAmountDue                      float64                      `bson:"invoice_amount_due" json:"invoice_amount_due"`
	PaymentMethods                        []int8                       `bson:"payment_methods" json:"payment_methods,omitempty"`
	InvoiceSubTotalAmount                 float64                      `bson:"invoice_sub_total_amount" json:"invoice_sub_total_amount"`
	ClosingReasonComment                  string                       `bson:"closing_reason_comment" json:"closing_reason_comment"`
	Tags                                  []*OrderTag                  `bson:"tags" json:"tags,omitempty"`
	SkillSets                             []*OrderSkillSet             `bson:"skill_sets" json:"skill_sets,omitempty"`
	Comments                              []*OrderComment              `bson:"comments" json:"comments,omitempty"`
	Deposits                              []*OrderDeposit              `bson:"deposits" json:"deposits,omitempty"`
	Invoice                               *OrderInvoice                `bson:"invoice" json:"invoice,omitempty"`
	PastInvoices                          []*OrderInvoice              `bson:"past_invoices" json:"past_invoices,omitempty"`
	OrderIncidentCount                    uint64                       `bson:"order_incident_count" json:"order_incident_count,omitempty"`
}

type OrderAsSelectOption

type OrderAsSelectOption 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 OrderComment

type OrderComment 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"`                               // Workery Job ID
	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"`
	TenantID              primitive.ObjectID `bson:"tenant_id" json:"tenant_id"`
	CreatedAt             time.Time          `bson:"created_at,omitempty" json:"created_at,omitempty"`
	CreatedByUserID       primitive.ObjectID `bson:"created_by_user_id" json:"created_by_user_id"`
	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,omitempty" json:"modified_at,omitempty"`
	ModifiedByUserID      primitive.ObjectID `bson:"modified_by_user_id" json:"modified_by_user_id"`
	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"` // Workery Job ID
}

func GetLatestComment

func GetLatestComment(order *Order) *OrderComment

type OrderDeposit

type OrderDeposit 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"`                               // Workery Job ID
	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`.
	TenantID              primitive.ObjectID `bson:"tenant_id" json:"tenant_id"`
	PaidAt                time.Time          `bson:"paid_at,omitempty" json:"paid_at"`
	DepositMethod         int8               `bson:"deposit_method" json:"deposit_method"`
	PaidTo                int8               `bson:"paid_to,omitempty" json:"paid_to"`
	Currency              string             `bson:"currency" json:"currency"`
	Amount                float64            `bson:"amount" json:"amount"`
	PaidFor               int8               `bson:"paid_for" json:"paid_for"`
	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"`
	PublicID              uint64             `bson:"public_id" json:"public_id"`
}

type OrderInsuranceRequirement

type OrderInsuranceRequirement struct {
	ID          primitive.ObjectID `bson:"_id" json:"id"`
	Name        string             `bson:"name" json:"name"`
	Description string             `bson:"description" json:"description"`
	Status      int8               `bson:"status" json:"status"`
}

type OrderInvoice

type OrderInvoice 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"`                               // Workery Job ID
	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`.
	TenantID                 primitive.ObjectID `bson:"tenant_id" json:"tenant_id"`
	CreatedAt                time.Time          `bson:"created_at,omitempty" json:"created_at,omitempty"`
	CreatedByUserID          primitive.ObjectID `bson:"created_by_user_id" json:"created_by_user_id"`
	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,omitempty" json:"modified_at,omitempty"`
	ModifiedByUserID         primitive.ObjectID `bson:"modified_by_user_id" json:"modified_by_user_id"`
	ModifiedByUserName       string             `bson:"modified_by_user_name" json:"modified_by_user_name"`
	ModifiedFromIPAddress    string             `bson:"modified_from_ip_address" json:"modified_from_ip_address"`
	InvoiceID                string             `bson:"invoice_id" json:"invoice_id"`
	InvoiceDate              time.Time          `bson:"invoice_date" json:"invoice_date"`
	AssociateName            string             `bson:"associate_name" json:"associate_name"`
	AssociatePhone           string             `bson:"associate_phone" json:"associate_phone"`
	ClientName               string             `bson:"client_name" json:"client_name"`
	ClientPhone              string             `bson:"client_phone" json:"client_phone"`
	ClientEmail              string             `bson:"client_email" json:"client_email"`
	Line01Qty                int64              `bson:"line_01_qty" json:"line_01_qty"`
	Line01Desc               string             `bson:"line_01_desc" json:"line_01_desc"`
	Line01Price              float64            `bson:"line_01_price" json:"line_01_price"`
	Line01Amount             float64            `bson:"line_01_amount" json:"line_01_amount"`
	Line02Qty                int64              `bson:"line_02_qty" json:"line_02_qty"` // Make `int8`
	Line02Desc               string             `bson:"line_02_desc" json:"line_02_desc"`
	Line02Price              float64            `bson:"line_02_price" json:"line_02_price"`
	Line02Amount             float64            `bson:"line_02_amount" json:"line_02_amount"`
	Line03Qty                int64              `bson:"line_03_qty" json:"line_03_qty"` // Make `int8`
	Line03Desc               string             `bson:"line_03_desc" json:"line_03_desc"`
	Line03Price              float64            `bson:"line_03_price" json:"line_03_price"`
	Line03Amount             float64            `bson:"line_03_amount" json:"line_03_amount"`
	Line04Qty                int64              `bson:"line_04_qty" json:"line_04_qty"` // Make `int8`
	Line04Desc               string             `bson:"line_04_desc" json:"line_04_desc"`
	Line04Price              float64            `bson:"line_04_price" json:"line_04_price"`
	Line04Amount             float64            `bson:"line_04_amount" json:"line_04_amount"`
	Line05Qty                int64              `bson:"line_05_qty" json:"line_05_qty"` // Make `int8`
	Line05Desc               string             `bson:"line_05_desc" json:"line_05_desc"`
	Line05Price              float64            `bson:"line_05_price" json:"line_05_price"`
	Line05Amount             float64            `bson:"line_05_amount" json:"line_05_amount"`
	Line06Qty                int64              `bson:"line_06_qty" json:"line_06_qty"` // Make `int8`
	Line06Desc               string             `bson:"line_06_desc" json:"line_06_desc"`
	Line06Price              float64            `bson:"line_06_price" json:"line_06_price"`
	Line06Amount             float64            `bson:"line_06_amount" json:"line_06_amount"`
	Line07Qty                int64              `bson:"line_07_qty" json:"line_07_qty"` // Make `int8`
	Line07Desc               string             `bson:"line_07_desc" json:"line_07_desc"`
	Line07Price              float64            `bson:"line_07_price" json:"line_07_price"`
	Line07Amount             float64            `bson:"line_07_amount" json:"line_07_amount"`
	Line08Qty                int64              `bson:"line_08_qty" json:"line_08_qty"` // Make `int8`
	Line08Desc               string             `bson:"line_08_desc" json:"line_08_desc"`
	Line08Price              float64            `bson:"line_08_price" json:"line_08_price"`
	Line08Amount             float64            `bson:"line_08_amount" json:"line_08_amount"`
	Line09Qty                int64              `bson:"line_09_qty" json:"line_09_qty"` // Make `int8`
	Line09Desc               string             `bson:"line_09_desc" json:"line_09_desc"`
	Line09Price              float64            `bson:"line_09_price" json:"line_09_price"`
	Line09Amount             float64            `bson:"line_09_amount" json:"line_09_amount"`
	Line10Qty                int64              `bson:"line_10_qty" json:"line_10_qty"` // Make `int8`
	Line10Desc               string             `bson:"line_10_desc" json:"line_10_desc"`
	Line10Price              float64            `bson:"line_10_price" json:"line_10_price"`
	Line10Amount             float64            `bson:"line_10_amount" json:"line_10_amount"`
	Line11Qty                int64              `bson:"line_11_qty" json:"line_11_qty"` // Make `int8`
	Line11Desc               string             `bson:"line_11_desc" json:"line_11_desc"`
	Line11Price              float64            `bson:"line_11_price" json:"line_11_price"`
	Line11Amount             float64            `bson:"line_11_amount" json:"line_11_amount"`
	Line12Qty                int64              `bson:"line_12_qty" json:"line_12_qty"` // Make `int8`
	Line12Desc               string             `bson:"line_12_desc" json:"line_12_desc"`
	Line12Price              float64            `bson:"line_12_price" json:"line_12_price"`
	Line12Amount             float64            `bson:"line_12_amount" json:"line_12_amount"`
	Line13Qty                int64              `bson:"line_13_qty" json:"line_13_qty"` // Make `int8`
	Line13Desc               string             `bson:"line_13_desc" json:"line_13_desc"`
	Line13Price              float64            `bson:"line_13_price" json:"line_13_price"`
	Line13Amount             float64            `bson:"line_13_amount" json:"line_13_amount"`
	Line14Qty                int64              `bson:"line_14_qty" json:"line_14_qty"` // Make `int8`
	Line14Desc               string             `bson:"line_14_desc" json:"line_14_desc"`
	Line14Price              float64            `bson:"line_14_price" json:"line_14_price"`
	Line14Amount             float64            `bson:"line_14_amount" json:"line_14_amount"`
	Line15Qty                int64              `bson:"line_15_qty" json:"line_15_qty"` // Make `int8`
	Line15Desc               string             `bson:"line_15_desc" json:"line_15_desc"`
	Line15Price              float64            `bson:"line_15_price" json:"line_15_price"`
	Line15Amount             float64            `bson:"line_15_amount" json:"line_15_amount"`
	InvoiceQuoteDays         int8               `bson:"invoice_quote_days" json:"invoice_quote_days"`
	InvoiceAssociateTax      string             `bson:"invoice_associate_tax" json:"invoice_associate_tax"`
	InvoiceQuoteDate         time.Time          `bson:"invoice_quote_date" json:"invoice_quote_date"`
	InvoiceCustomersApproval string             `bson:"invoice_customers_approval" json:"invoice_customers_approval"`
	Line01Notes              string             `bson:"line_01_notes" json:"line_01_notes"`
	Line02Notes              string             `bson:"line_02_notes" json:"line_02_notes"`
	TotalLabour              float64            `bson:"total_labour" json:"total_labour"`
	TotalMaterials           float64            `bson:"total_materials" json:"total_materials"`
	OtherCosts               float64            `bson:"other_costs" json:"other_costs"`
	Tax                      float64            `bson:"tax" json:"tax"`
	IsCustomTax              bool               `bson:"is_custom_tax" json:"is_custom_tax"`
	Total                    float64            `bson:"total" json:"total"`
	PaymentAmount            float64            `bson:"payment_amount" json:"payment_amount"`
	DateClientPaidInvoice    time.Time          `bson:"date_client_paid_invoice" json:"date_client_paid_invoice"`
	PaymentMethods           []int8             `bson:"payment_methods" json:"payment_methods,omitempty"`
	ClientSignature          string             `bson:"client_signature" json:"client_signature"`
	AssociateSignDate        time.Time          `bson:"associate_sign_date" json:"associate_sign_date"`
	AssociateSignature       string             `bson:"associate_signature" json:"associate_signature"`
	WorkOrderID              uint64             `bson:"work_order_id" json:"work_order_id"`
	ClientAddress            string             `bson:"client_address" json:"client_address"`
	RevisionVersion          int8               `bson:"revision_version" json:"revision_version"`
	Deposit                  float64            `bson:"deposit" json:"deposit"`
	AmountDue                float64            `bson:"amount_due" json:"amount_due"`
	SubTotal                 float64            `bson:"sub_total" json:"sub_total"`
	FileObjectKey            string             `bson:"file_object_key" json:"file_object_key"`
	FileTitle                string             `bson:"file_title" json:"file_title"`
	FileObjectURL            string             `bson:"file_object_url" json:"file_object_url,omitempty"`       // (Optional, added by endpoint)
	FileObjectExpiry         time.Time          `bson:"file_object_expiry" json:"file_object_expiry,omitempty"` // (Optional, added by endpoint)
	Status                   int8               `bson:"status" json:"status"`
	PublicID                 uint64             `bson:"public_id" json:"public_id"`
}

type OrderListFilter

type OrderListFilter 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
	Status           int8
	Type             int8
	ExcludeArchived  bool
	SearchText       string
	ModifiedByUserID primitive.ObjectID
}

type OrderListResult

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

type OrderLite

type OrderLite struct {
	ID                   primitive.ObjectID `bson:"_id" json:"id"`
	WJID                 uint64             `bson:"wjid" json:"wjid"` // A.K.A. `Workery Job ID`
	CustomerID           primitive.ObjectID `bson:"customer_id" json:"customer_id"`
	CustomerName         string             `bson:"customer_name" json:"customer_name,omitempty"`
	CustomerLexicalName  string             `bson:"customer_lexical_name" json:"customer_lexical_name,omitempty"`
	CustomerGender       int8               `bson:"customer_gender" json:"customer_gender"`
	CustomerGenderOther  string             `bson:"customer_gender_other" json:"customer_gender_other"`
	CustomerBirthdate    time.Time          `bson:"customer_birthdate" json:"customer_birthdate"`
	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"`
	AssociateGender      int8               `bson:"associate_gender" json:"associate_gender"`
	AssociateGenderOther string             `bson:"associate_gender_other" json:"associate_gender_other"`
	AssociateBirthdate   time.Time          `bson:"associate_birthdate" json:"associate_birthdate"`
	TenantID             primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"`
	Description          string             `bson:"description" json:"description"`
	AssignmentDate       time.Time          `bson:"assignment_date" json:"assignment_date"`
	IsOngoing            bool               `bson:"is_ongoing" json:"is_ongoing"`
	IsHomeSupportService bool               `bson:"is_home_support_service" json:"is_home_support_service"`
	StartDate            time.Time          `bson:"start_date" json:"start_date"`
	CompletionDate       time.Time          `bson:"completion_date" json:"completion_date"`
	Status               int8               `bson:"status" json:"status"`
	Type                 int8               `bson:"type" json:"type"`
	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"`
	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"`
}

type OrderPaginationListAndCountResult

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

OrderPaginationListResult represents the paginated list results for the Order records (meaning limited).

type OrderPaginationListFilter

type OrderPaginationListFilter 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
	InvoiceServiceFeeID       primitive.ObjectID
	Status                    int8
	Statuses                  []int8
	Type                      int8
	ExcludeArchived           bool
	SearchText                string
	CustomerOrganizationName  string
	CustomerFirstName         string
	CustomerLastName          string
	CustomerEmail             string
	CustomerPhone             string
	ModifiedByUserID          primitive.ObjectID
	AssociateOrganizationName string
	AssociateFirstName        string
	AssociateLastName         string
	AssociateEmail            string
	AssociatePhone            string
	OrderWJID                 string

	// InSkillSetIDs filter is used if you want to find one or more skill set
	// ids inside the associate.
	InSkillSetIDs []primitive.ObjectID

	// AllSkillSetIDs filter is used if you want to find all skill set ids for
	// the associate.
	AllSkillSetIDs []primitive.ObjectID

	// InTagIDs filter is used if you want to find one or more tag
	// ids inside the associate.
	InTagIDs []primitive.ObjectID

	// AllTagIDs filter is used if you want to find all tag ids for
	// the associate.
	AllTagIDs []primitive.ObjectID

	AssignmentDateGT  time.Time
	AssignmentDateGTE time.Time
	AssignmentDateLT  time.Time
	AssignmentDateLTE time.Time

	InvoiceServiceFeePaymentDateGT  time.Time
	InvoiceServiceFeePaymentDateGTE time.Time
	InvoiceServiceFeePaymentDateLT  time.Time
	InvoiceServiceFeePaymentDateLTE time.Time

	CompletionDateGT  time.Time
	CompletionDateGTE time.Time
	CompletionDateLT  time.Time
	CompletionDateLTE time.Time
}

type OrderPaginationListResult

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

OrderPaginationListResult represents the paginated list results for the order lite records (meaning limited).

type OrderPaginationLiteListAndCountResult

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

OrderPaginationLiteListResult represents the paginated list results for the Order lite records (meaning limited).

type OrderPaginationLiteListResult

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

OrderPaginationLiteListResult represents the paginated list results for the order lite records (meaning limited).

type OrderSkillSet

type OrderSkillSet struct {
	ID          primitive.ObjectID `bson:"_id" json:"id"`                              // Referenced value from 'skillsets'.
	Category    string             `bson:"category" json:"category,omitempty"`         // Referenced value from 'skillsets'.
	SubCategory string             `bson:"sub_category" json:"sub_category,omitempty"` // Referenced value from 'skillsets'.
	Description string             `bson:"description" json:"description,omitempty"`   // Referenced value from 'skillsets'.
	Status      int8               `bson:"status" json:"status"`
}

type OrderStorer

type OrderStorer interface {
	Create(ctx context.Context, m *Order) error
	GetByID(ctx context.Context, id primitive.ObjectID) (*Order, error)
	GetByWJID(ctx context.Context, wjid uint64) (*Order, error)
	GetLatestOrderByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*Order, error)
	GetLatestCommentByOrderID(ctx context.Context, orderID primitive.ObjectID) (*OrderComment, error)
	// GetByPublicID(ctx context.Context, oldID uint64) (*Order, error)
	// GetByEmail(ctx context.Context, email string) (*Order, error)
	// GetByVerificationCode(ctx context.Context, verificationCode string) (*Order, error)
	// CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
	UpdateByID(ctx context.Context, m *Order) error
	ListByFilter(ctx context.Context, f *OrderPaginationListFilter) (*OrderPaginationListResult, error)
	LiteListByFilter(ctx context.Context, f *OrderPaginationListFilter) (*OrderPaginationLiteListResult, error)
	ListByCustomerID(ctx context.Context, customerID primitive.ObjectID) (*OrderPaginationListResult, error)
	ListByAssociateID(ctx context.Context, associateID primitive.ObjectID) (*OrderPaginationListResult, error)
	ListByServiceFeeID(ctx context.Context, serviceFeeID primitive.ObjectID) (*OrderPaginationListResult, error)
	// ListAsSelectOptionByFilter(ctx context.Context, f *OrderListFilter) ([]*OrderAsSelectOption, error)
	DeleteByID(ctx context.Context, id primitive.ObjectID) error
	CountByFilter(ctx context.Context, f *OrderPaginationListFilter) (int64, error)
	CountByAssociateID(ctx context.Context, associateID primitive.ObjectID) (int64, error)
	CountByTenantID(ctx context.Context, tenantID primitive.ObjectID) (int64, error)
	LiteListAndCountByFilter(ctx context.Context, f *OrderPaginationListFilter) (*OrderPaginationLiteListAndCountResult, error)
	ListAndCountByFilter(ctx context.Context, f *OrderPaginationListFilter) (*OrderPaginationListAndCountResult, error)
	PermanentlyDeleteAllByCustomerID(ctx context.Context, customerID primitive.ObjectID) error
	PermanentlyDeleteAllByAssociateID(ctx context.Context, associateID primitive.ObjectID) error
	CheckIfAnyExistsByCustomerID(ctx context.Context, customerID primitive.ObjectID) (bool, error)
	GetAllByCustomerIDsByAssociateID(ctx context.Context, associateID primitive.ObjectID) ([]primitive.ObjectID, error)
	GetAllByAssociateIDsByCustomerID(ctx context.Context, customerID primitive.ObjectID) ([]primitive.ObjectID, error)
}

OrderStorer Interface for user.

func NewDatastore

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

type OrderStorerImpl

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

func (OrderStorerImpl) CheckIfAnyExistsByCustomerID

func (impl OrderStorerImpl) CheckIfAnyExistsByCustomerID(ctx context.Context, customerID primitive.ObjectID) (bool, error)

func (OrderStorerImpl) CountByAssociateID

func (impl OrderStorerImpl) CountByAssociateID(ctx context.Context, tenantID primitive.ObjectID) (int64, error)

func (OrderStorerImpl) CountByFilter

func (impl OrderStorerImpl) CountByFilter(ctx context.Context, f *OrderPaginationListFilter) (int64, error)

func (OrderStorerImpl) CountByTenantID

func (impl OrderStorerImpl) CountByTenantID(ctx context.Context, tenantID primitive.ObjectID) (int64, error)

func (OrderStorerImpl) Create

func (impl OrderStorerImpl) Create(ctx context.Context, u *Order) error

func (OrderStorerImpl) DeleteByID

func (impl OrderStorerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error

func (OrderStorerImpl) GetAllByAssociateIDsByCustomerID

func (impl OrderStorerImpl) GetAllByAssociateIDsByCustomerID(ctx context.Context, customerID primitive.ObjectID) ([]primitive.ObjectID, error)

func (OrderStorerImpl) GetAllByCustomerIDsByAssociateID

func (impl OrderStorerImpl) GetAllByCustomerIDsByAssociateID(ctx context.Context, associateID primitive.ObjectID) ([]primitive.ObjectID, error)

func (OrderStorerImpl) GetByID

func (impl OrderStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Order, error)

func (OrderStorerImpl) GetByWJID

func (impl OrderStorerImpl) GetByWJID(ctx context.Context, wjID uint64) (*Order, error)

func (OrderStorerImpl) GetLatestCommentByOrderID

func (impl OrderStorerImpl) GetLatestCommentByOrderID(ctx context.Context, orderID primitive.ObjectID) (*OrderComment, error)

func (OrderStorerImpl) GetLatestOrderByTenantID

func (impl OrderStorerImpl) GetLatestOrderByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*Order, error)

func (*OrderStorerImpl) ListAndCountByFilter

func (OrderStorerImpl) ListAsSelectOptionByFilter

func (impl OrderStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *OrderListFilter) ([]*OrderAsSelectOption, error)

func (OrderStorerImpl) ListByAssociateID

func (impl OrderStorerImpl) ListByAssociateID(ctx context.Context, associateID primitive.ObjectID) (*OrderPaginationListResult, error)

func (OrderStorerImpl) ListByCustomerID

func (impl OrderStorerImpl) ListByCustomerID(ctx context.Context, customerID primitive.ObjectID) (*OrderPaginationListResult, error)

func (OrderStorerImpl) ListByFilter

func (OrderStorerImpl) ListByServiceFeeID

func (impl OrderStorerImpl) ListByServiceFeeID(ctx context.Context, serviceFeeID primitive.ObjectID) (*OrderPaginationListResult, error)

func (OrderStorerImpl) LiteListByFilter

func (*OrderStorerImpl) PermanentlyDeleteAllByAssociateID

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

func (*OrderStorerImpl) PermanentlyDeleteAllByCustomerID

func (impl *OrderStorerImpl) PermanentlyDeleteAllByCustomerID(ctx context.Context, customerID primitive.ObjectID) error

func (OrderStorerImpl) UpdateByID

func (impl OrderStorerImpl) UpdateByID(ctx context.Context, m *Order) error

type OrderTag

type OrderTag struct {
	ID          primitive.ObjectID `bson:"_id" json:"id"`
	Text        string             `bson:"text" json:"text"`
	Description string             `bson:"description" json:"description"`
	Status      int8               `bson:"status" json:"status"`
}

type OrderVehicleType

type OrderVehicleType struct {
	ID          primitive.ObjectID `bson:"_id" json:"id"`
	Name        string             `bson:"name" json:"name"`
	Description string             `bson:"description" json:"description"`
	Status      int8               `bson:"status" json:"status"`
}

Jump to

Keyboard shortcuts

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