models

package
v0.0.0-...-e7a328b Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BookedError = errors.New("this Date is already booked")

Functions

func CancelOneOrder

func CancelOneOrder(
	ctx context.Context,
	client *mongo.Client,
	customerID primitive.ObjectID,
	id primitive.ObjectID,
) (*mongo.UpdateResult, error)

func FindManyOrders

func FindManyOrders(
	ctx context.Context,
	client *mongo.Client,
	customerID *primitive.ObjectID,
	companyID *primitive.ObjectID,
	nPerPage *int64,
	startDate *primitive.DateTime,
	startValue *primitive.ObjectID,
	isCanceled *bool,
) (*mongo.Cursor, error)

todo needs fixing

func IsBookedTimeFrame

func IsBookedTimeFrame(
	ctx context.Context,
	client *mongo.Client,
	employeeID primitive.ObjectID,
	startTime primitive.DateTime,
	endTime primitive.DateTime,
) error

Types

type CancelRequest

type CancelRequest struct {
	CustomerID string `json:"customer_id"`
	OrderID    string `json:"order_id"`
}

type Order

type Order struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	CustomerID primitive.ObjectID `bson:"customer_id,omitempty"`
	CompanyID  primitive.ObjectID `bson:"company_id,omitempty"`
	ServiceID  primitive.ObjectID `bson:"service_id,omitempty"`
	EmployeeID primitive.ObjectID `bson:"employee_id,omitempty"`
	OrderTime  primitive.DateTime `bson:"order_time,omitempty"`
	IsCanceled bool               `bson:"is_canceled"`
	StartTime  primitive.DateTime `bson:"start_time,omitempty"`
	EndTime    primitive.DateTime `bson:"end_time,omitempty"`
}

func (*Order) InsertOneOrder

func (order *Order) InsertOneOrder(
	ctx context.Context,
	client *mongo.Client,
) (*mongo.InsertOneResult, error)

todo: check if this employee can perfom this service and whether this service and employee is in this company

Jump to

Keyboard shortcuts

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