controller

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderController

type OrderController interface {
	Create(ctx context.Context, req *OrderCreateRequestIDO) (*o_s.Order, error)
	GetByID(ctx context.Context, id primitive.ObjectID) (*o_s.Order, error)
	GetByWJID(ctx context.Context, wjid uint64) (*o_s.Order, error)
	UpdateByWJID(ctx context.Context, req *OrderUpdateRequestIDO) (*o_s.Order, error)
	UpdateFinancialByWJID(ctx context.Context, req *OrderFinancialUpdateRequestIDO) (*o_s.Order, error)
	// UpdateByID(ctx context.Context, req *OrderUpdateRequestIDO) (*o_s.Order, error)
	// ListByFilter(ctx context.Context, f *o_s.OrderListFilter) (*o_s.OrderListResult, error)
	LiteListAndCountByFilter(ctx context.Context, f *o_s.OrderPaginationListFilter) (*o_s.OrderPaginationLiteListAndCountResult, error)
	// ArchiveByID(ctx context.Context, id primitive.ObjectID) (*user_s.User, error)
	DeleteByWJID(ctx context.Context, orderWJID uint64) error
	CreateComment(ctx context.Context, req *OrderOperationCreateCommentRequest) (*o_s.Order, error)
	Close(ctx context.Context, req *OrderOperationCloseRequest) (*o_s.Order, error)
	Postpone(ctx context.Context, req *OrderOperationPostponeRequest) (*o_s.Order, error)
	Unassign(ctx context.Context, req *OrderOperationUnassignRequest) (*o_s.Order, error)
	Transfer(ctx context.Context, req *OrderOperationTransferRequest) (*o_s.Order, error)
	GenerateInvoice(ctx context.Context, req *OrderOperationGenerateInvoiceRequest) (*o_s.Order, error)
	Clone(ctx context.Context, req *OrderOperationCloneRequest) (*o_s.Order, error)
}

OrderController Interface for customer business logic controller.

func NewController

func NewController(
	appCfg *config.Conf,
	loggerp *slog.Logger,
	uuidp uuid.Provider,
	s3 s3_storage.S3Storager,
	passwordp password.Provider,
	kmux kmutex.Provider,
	temailer templatedemailer.TemplatedEmailer,
	client *mongo.Client,
	ai_builder pdfbuilder.AssociateInvoiceBuilder,
	org_storer ten_s.TenantStorer,
	com_storer com_s.CommentStorer,
	hh_storer hh_s.HowHearAboutUsItemStorer,
	skillset_s ss_s.SkillSetStorer,
	t_storer t_s.TagStorer,
	ti_storer ti_s.TaskItemStorer,
	usr_storer user_s.UserStorer,
	c_storer c_s.CustomerStorer,
	a_storer a_s.AssociateStorer,
	o_storer o_s.OrderStorer,
	servicefee_s servicefee_s.ServiceFeeStorer,
	act_storer act_s.ActivitySheetStorer,
	attch_storer attachment_s.AttachmentStorer,
) OrderController

type OrderControllerImpl

type OrderControllerImpl struct {
	Config                  *config.Conf
	Logger                  *slog.Logger
	UUID                    uuid.Provider
	S3                      s3_storage.S3Storager
	Password                password.Provider
	Kmutex                  kmutex.Provider
	TemplatedEmailer        templatedemailer.TemplatedEmailer
	DbClient                *mongo.Client
	TenantStorer            ten_s.TenantStorer
	AssociateInvoiceBuilder pdfbuilder.AssociateInvoiceBuilder
	CommentStorer           com_s.CommentStorer
	HowHearStorer           hh_s.HowHearAboutUsItemStorer
	TagStorer               t_s.TagStorer
	UserStorer              user_s.UserStorer
	CustomerStorer          c_s.CustomerStorer
	AssociateStorer         a_s.AssociateStorer
	OrderStorer             o_s.OrderStorer
	SkillSetStorer          ss_s.SkillSetStorer
	TaskItemStorer          ti_s.TaskItemStorer
	ServiceFeeStorer        servicefee_s.ServiceFeeStorer
	ActivitySheetStorer     act_s.ActivitySheetStorer
	AttachmentStorer        attachment_s.AttachmentStorer
}

func (*OrderControllerImpl) Clone

func (*OrderControllerImpl) Close

func (*OrderControllerImpl) Create

func (*OrderControllerImpl) CreateComment

func (*OrderControllerImpl) DeleteByWJID

func (impl *OrderControllerImpl) DeleteByWJID(ctx context.Context, orderWJID uint64) error

func (*OrderControllerImpl) GenerateInvoice

func (*OrderControllerImpl) GetByID

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

func (*OrderControllerImpl) GetByWJID

func (impl *OrderControllerImpl) GetByWJID(ctx context.Context, wjid uint64) (*o_s.Order, error)

func (*OrderControllerImpl) Postpone

func (*OrderControllerImpl) Transfer

func (*OrderControllerImpl) Unassign

func (*OrderControllerImpl) UpdateByWJID

func (impl *OrderControllerImpl) UpdateByWJID(ctx context.Context, req *OrderUpdateRequestIDO) (*o_s.Order, error)

func (*OrderControllerImpl) UpdateFinancialByWJID

func (impl *OrderControllerImpl) UpdateFinancialByWJID(ctx context.Context, req *OrderFinancialUpdateRequestIDO) (*o_s.Order, error)

func (*OrderControllerImpl) UpdateRelatedBySkillSets

func (impl *OrderControllerImpl) UpdateRelatedBySkillSets(ctx context.Context, o *o_c.Order, modifiedSSIDs []primitive.ObjectID) error

UpdateRelatedBySkillSets function will take the inputted `skill sets` with the order.

func (*OrderControllerImpl) UpdateRelatedByTags

func (impl *OrderControllerImpl) UpdateRelatedByTags(ctx context.Context, o *o_c.Order, modifiedTIDs []primitive.ObjectID) error

UpdateRelatedByTags function will take the inputted `tags` with the order.

type OrderCreateRequestIDO

type OrderCreateRequestIDO struct {
	CustomerID           primitive.ObjectID   `bson:"customer_id" json:"customer_id"`
	StartDate            string               `bson:"start_date" json:"start_date"`
	StartDateFormatted   time.Time            `bson:"start_date" json:"-"`
	IsOngoing            int8                 `bson:"is_ongoing" json:"is_ongoing"`
	IsHomeSupportService int8                 `bson:"is_home_support_service" json:"is_home_support_service"`
	Description          string               `bson:"description" json:"description"`
	AdditionalComment    string               `bson:"additional_comment" json:"additional_comment"`
	SkillSets            []primitive.ObjectID `bson:"skill_sets" json:"skill_sets,omitempty"`
	Tags                 []primitive.ObjectID `bson:"tags" json:"tags,omitempty"`
}

type OrderFinancialUpdateRequestIDO

type OrderFinancialUpdateRequestIDO struct {
	WJID                          uint64             `bson:"wjid" json:"wjid"`
	CompletionDate                string             `bson:"completion_date" json:"completion_date"`
	CompletionDateFormatted       time.Time          `bson:"-" json:"-"`
	InvoicePaidTo                 int8               `bson:"invoice_paid_to" json:"invoice_paid_to"`
	PaymentStatus                 int8               `bson:"payment_status" json:"payment_status"`
	InvoiceDate                   string             `bson:"invoice_date" json:"invoice_date"`
	InvoiceDateFormatted          time.Time          `bson:"-" json:"-"`
	InvoiceIDs                    string             `bson:"invoice_ids" json:"invoice_ids"`
	InvoiceQuotedLabourAmount     float64            `bson:"invoice_quoted_labour_amount" json:"invoice_quoted_labour_amount"`
	InvoiceQuotedMaterialAmount   float64            `bson:"invoice_quoted_material_amount" json:"invoice_quoted_material_amount"`
	InvoiceQuotedOtherCostsAmount float64            `bson:"invoice_quoted_other_costs_amount" json:"invoice_quoted_other_costs_amount"`
	InvoiceTotalQuoteAmount       float64            `bson:"invoice_total_quote_amount" json:"invoice_total_quote_amount"`
	InvoiceLabourAmount           float64            `bson:"invoice_labour_amount" json:"invoice_labour_amount"`
	InvoiceMaterialAmount         float64            `bson:"invoice_material_amount" json:"invoice_material_amount"`
	InvoiceOtherCostsAmount       float64            `bson:"invoice_other_costs_amount" json:"invoice_other_costs_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"`
	InvoiceDepositAmount          float64            `bson:"invoice_deposit_amount" json:"invoice_deposit_amount"`
	InvoiceAmountDue              float64            `bson:"invoice_amount_due" json:"invoice_amount_due"`
	InvoiceServiceFeeID           primitive.ObjectID `bson:"invoice_service_fee_id" json:"invoice_service_fee_id"`
	// InvoiceServiceFeePercentage   float64            `bson:"invoice_service_fee_percentage" json:"invoice_service_fee_percentage"`
	// InvoiceServiceFeeOther        string             `bson:"invoice_service_fee_other" json:"invoice_service_fee_other"`
	// IsInvoiceServiceFeeOther              bool               `bson:"is_invoice_service_fee_other" json:"is_invoice_service_fee_other"`
	InvoiceServiceFeeAmount               float64   `bson:"invoice_service_fee_amount" json:"invoice_service_fee_amount"`
	InvoiceServiceFeePaymentDate          string    `bson:"invoice_service_fee_payment_date" json:"invoice_service_fee_payment_date"`
	InvoiceServiceFeePaymentDateFormatted time.Time `bson:"-" json:"-"`
	PaymentMethods                        []int8    `bson:"payment_methods" json:"payment_methods,omitempty"`
	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"`
}

type OrderOperationCloneRequest

type OrderOperationCloneRequest struct {
	OrderWJID uint64 `bson:"order_wjid" json:"order_wjid"`
}

type OrderOperationCloseRequest

type OrderOperationCloseRequest struct {
	OrderID            primitive.ObjectID `bson:"order_id" json:"order_id"`
	WasCompleted       uint64             `bson:"was_completed" json:"was_completed"`
	Reason             int8               `bson:"reason" json:"reason"`
	ReasonOther        string             `bson:"reason_other" json:"reason_other"`
	CompletionDate     time.Time          `bson:"completion_date" json:"completion_date"`
	DescribeTheComment string             `bson:"describe_the_comment" json:"describe_the_comment"`
	Visits             int8               `bson:"visits" json:"visits"`
}

type OrderOperationCreateCommentRequest

type OrderOperationCreateCommentRequest struct {
	OrderWJID uint64 `bson:"order_wjid" json:"order_wjid"`
	Content   string `bson:"content" json:"content"`
}

type OrderOperationGenerateInvoiceRequest

type OrderOperationGenerateInvoiceRequest struct {
	OrderID                        primitive.ObjectID `json:"order_id,omitempty"`
	InvoiceID                      string             `json:"invoice_id,omitempty"`
	InvoiceDate                    string             `json:"invoice_date,omitempty"`
	InvoiceDateFormatted           time.Time          `json:"-"`
	AssociateName                  string             `json:"associate_name,omitempty"`
	AssociatePhone                 string             `json:"associate_phone,omitempty"`
	ClientName                     string             `json:"client_name,omitempty"`
	ClientPhone                    string             `json:"client_phone,omitempty"`
	ClientEmail                    string             `json:"client_email,omitempty"`
	Line01Qty                      int64              `json:"line_01_quantity"`
	Line01Desc                     string             `json:"line_01_description,omitempty"`
	Line01Price                    float64            `json:"line_01_unit_price,omitempty"`
	Line01Amount                   float64            `json:"line_01_amount,omitempty"`
	Line02Qty                      int64              `json:"line_02_quantity,omitempty"`
	Line02Desc                     string             `json:"line_02_description,omitempty"`
	Line02Price                    float64            `json:"line_02_unit_price,omitempty"`
	Line02Amount                   float64            `json:"line_02_amount,omitempty"`
	Line03Qty                      int64              `json:"line_03_quantity,omitempty"`
	Line03Desc                     string             `json:"line_03_description,omitempty"`
	Line03Price                    float64            `json:"line_03_unit_price,omitempty"`
	Line03Amount                   float64            `json:"line_03_amount,omitempty"`
	Line04Qty                      int64              `json:"line_04_quantity,omitempty"`
	Line04Desc                     string             `json:"line_04_description,omitempty"`
	Line04Price                    float64            `json:"line_04_unit_price,omitempty"`
	Line04Amount                   float64            `json:"line_04_amount,omitempty"`
	Line05Qty                      int64              `json:"line_05_quantity,omitempty"`
	Line05Desc                     string             `json:"line_05_description,omitempty"`
	Line05Price                    float64            `json:"line_05_unit_price,omitempty"`
	Line05Amount                   float64            `json:"line_05_amount,omitempty"`
	Line06Qty                      int64              `json:"line_06_quantity,omitempty"`
	Line06Desc                     string             `json:"line_06_description,omitempty"`
	Line06Price                    float64            `json:"line_06_unit_price,omitempty"`
	Line06Amount                   float64            `json:"line_06_amount,omitempty"`
	Line07Qty                      int64              `json:"line_07_quantity,omitempty"`
	Line07Desc                     string             `json:"line_07_description,omitempty"`
	Line07Price                    float64            `json:"line_07_unit_price,omitempty"`
	Line07Amount                   float64            `json:"line_07_amount,omitempty"`
	Line08Qty                      int64              `json:"line_08_quantity,omitempty"`
	Line08Desc                     string             `json:"line_08_description,omitempty"`
	Line08Price                    float64            `json:"line_08_unit_price,omitempty"`
	Line08Amount                   float64            `json:"line_08_amount,omitempty"`
	Line09Qty                      int64              `json:"line_09_quantity,omitempty"`
	Line09Desc                     string             `json:"line_09_description,omitempty"`
	Line09Price                    float64            `json:"line_09_unit_price,omitempty"`
	Line09Amount                   float64            `json:"line_09_amount,omitempty"`
	Line10Qty                      int64              `json:"line_10_quantity,omitempty"`
	Line10Desc                     string             `json:"line_10_description,omitempty"`
	Line10Price                    float64            `json:"line_10_unit_price,omitempty"`
	Line10Amount                   float64            `json:"line_10_amount,omitempty"`
	Line11Qty                      int64              `json:"line_11_quantity,omitempty"`
	Line11Desc                     string             `json:"line_11_description,omitempty"`
	Line11Price                    float64            `json:"line_11_unit_price,omitempty"`
	Line11Amount                   float64            `json:"line_11_amount,omitempty"`
	Line12Qty                      int64              `json:"line_12_quantity,omitempty"`
	Line12Desc                     string             `json:"line_12_description,omitempty"`
	Line12Price                    float64            `json:"line_12_unit_price,omitempty"`
	Line12Amount                   float64            `json:"line_12_amount,omitempty"`
	Line13Qty                      int64              `json:"line_13_quantity,omitempty"`
	Line13Desc                     string             `json:"line_13_description,omitempty"`
	Line13Price                    float64            `json:"line_13_unit_price,omitempty"`
	Line13Amount                   float64            `json:"line_13_amount,omitempty"`
	Line14Qty                      int64              `json:"line_14_quantity,omitempty"`
	Line14Desc                     string             `json:"line_14_description,omitempty"`
	Line14Price                    float64            `json:"line_14_unit_price,omitempty"`
	Line14Amount                   float64            `json:"line_14_amount,omitempty"`
	Line15Qty                      int64              `json:"line_15_quantity,omitempty"`
	Line15Desc                     string             `json:"line_15_description,omitempty"`
	Line15Price                    float64            `json:"line_15_unit_price,omitempty"`
	Line15Amount                   float64            `json:"line_15_amount,omitempty"`
	InvoiceQuoteDays               int8               `json:"invoice_quote_days,omitempty"`
	InvoiceAssociateTax            string             `json:"invoice_associate_tax,omitempty"`
	InvoiceQuoteDate               string             `json:"invoice_quote_date,omitempty"`
	InvoiceQuoteDateFormatted      time.Time          `json:"-"`
	InvoiceCustomersApproval       string             `json:"invoice_customers_approval,omitempty"`
	Line01Notes                    string             `json:"line_01_notes,omitempty"`
	Line02Notes                    string             `json:"line_02_notes,omitempty"`
	TotalLabour                    float64            `json:"total_labour,omitempty"`
	TotalMaterials                 float64            `json:"total_materials,omitempty"`
	OtherCosts                     float64            `json:"other_costs,omitempty"`
	SubTotal                       float64            `json:"sub_total,omitempty"`
	Tax                            float64            `json:"tax,omitempty"`
	IsCustomTax                    bool               `bson:"is_custom_tax" json:"is_custom_tax,omitempty"`
	Total                          float64            `json:"total,omitempty"`
	PaymentAmount                  float64            `json:"payment_amount,omitempty"`
	DateClientPaidInvoice          string             `json:"date_client_paid_invoice,omitempty"`
	DateClientPaidInvoiceFormatted time.Time          `json:"-"`
	PaymentMethods                 []int8             `bson:"payment_methods" json:"payment_methods,omitempty"`
	ClientSignature                string             `json:"client_signature,omitempty"`
	AssociateSignDate              string             `json:"associate_sign_date,omitempty"`
	AssociateSignDateFormatted     time.Time          `json:"-"`
	AssociateSignature             string             `json:"associate_signature,omitempty"`
	WorkOrderId                    string             `json:"work_order_id,omitempty"`
	CreatedTime                    string             `json:"created_time,omitempty"`
	LastModifiedTime               string             `json:"last_modified_time,omitempty"`
	CreatedById                    string             `json:"created_by_id,omitempty"`
	CreatedByName                  string             `json:"created_by_name,omitempty"`
	LastModifiedById               string             `json:"last_modified_by_id,omitempty"`
	LastModifiedByName             string             `json:"last_modified_by_name,omitempty"`
	CreatedFrom                    string             `json:"created_from,omitempty"`
	CreatedFromIsPublic            string             `json:"created_from_is_public,omitempty"`
	LastModifiedFrom               string             `json:"last_modified_from,omitempty"`
	LastModifiedFromIsPublic       string             `json:"last_modified_from_is_public,omitempty"`
	ClientAddress                  string             `json:"client_address,omitempty"`
	RevisionVersion                string             `json:"revision_version,omitempty"`
	Deposit                        float64            `json:"deposit,omitempty"`
	AmountDue                      float64            `json:"amount_due,omitempty"`
	State                          string             `json:"state,omitempty"` // IsArchived string `json:"is_archived,omitempty"`
	OldId                          string             `json:"public_id,omitempty"`
}

type OrderOperationPostponeRequest

type OrderOperationPostponeRequest struct {
	OrderID            primitive.ObjectID `bson:"order_id" json:"order_id"`
	Reason             int8               `bson:"reason" json:"reason"`
	ReasonOther        string             `bson:"reason_other" json:"reason_other"`
	StartDate          string             `bson:"start_date" json:"start_date"`
	StartDateFormatted time.Time          `bson:"-" json:"-"`
	DescribeTheComment string             `bson:"describe_the_comment" json:"describe_the_comment"`
}

type OrderOperationTransferRequest

type OrderOperationTransferRequest struct {
	OrderID     primitive.ObjectID `bson:"order_id" json:"order_id"`
	ClientID    primitive.ObjectID `bson:"client_id" json:"client_id,omityempty"`
	AssociateID primitive.ObjectID `bson:"associate_id" json:"associate_id,omityempty"`
}

type OrderOperationUnassignRequest

type OrderOperationUnassignRequest struct {
	OrderID     primitive.ObjectID `bson:"order_id" json:"order_id"`
	Reason      int8               `bson:"reason" json:"reason"`
	ReasonOther string             `bson:"reason_other" json:"reason_other"`
}

type OrderUpdateRequestIDO

type OrderUpdateRequestIDO struct {
	WJID uint64 `bson:"wjid" json:"wjid"`
	// CustomerID           primitive.ObjectID   `bson:"customer_id" json:"customer_id"`
	StartDate            string    `bson:"start_date" json:"start_date"`
	StartDateFormatted   time.Time `bson:"start_date" json:"-"`
	IsOngoing            int8      `bson:"is_ongoing" json:"is_ongoing"`
	IsHomeSupportService int8      `bson:"is_home_support_service" json:"is_home_support_service"`
	Description          string    `bson:"description" json:"description"`
	// AdditionalComment    string               `bson:"additional_comment" json:"additional_comment"`
	SkillSets []primitive.ObjectID `bson:"skill_sets" json:"skill_sets,omitempty"`
	Tags      []primitive.ObjectID `bson:"tags" json:"tags,omitempty"`
}

Jump to

Keyboard shortcuts

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