models

package
v0.0.0-...-193100d 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

This section is empty.

Functions

func DeleteOneEmployee

func DeleteOneEmployee(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	employeeID primitive.ObjectID,
) (*mongo.DeleteResult, error)

func FindManyEmployees

func FindManyEmployees(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	startValue primitive.ObjectID,
	nPerPage int64,
) (*mongo.Cursor, error)

func FindManyTimeFrames

func FindManyTimeFrames(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	serviceID primitive.ObjectID,
	day string,
	startValue primitive.ObjectID,
	nPerPage int64,
) (*mongo.Cursor, error)

func FindOneEmployee

func FindOneEmployee(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	employeeID primitive.ObjectID,
) *mongo.SingleResult

Types

type Employee

type Employee struct {
	ID         primitive.ObjectID   `bson:"_id,omitempty"`
	CompanyID  primitive.ObjectID   `bson:"company_id,omitempty"`
	Name       string               `bson:"name,omitempty"`
	Surname    string               `bson:"surname,omitempty"`
	WorkTimes  WorkTimes            `bson:"work_times,omitempty"`
	Competence []primitive.ObjectID `bson:"competence,omitempty"`
}

Employees not only have personal work times but also competence: set of services which they can perform.

func (*Employee) InsertOne

func (employee *Employee) InsertOne(
	ctx context.Context,
	db *mongo.Database,
) (*mongo.InsertOneResult, error)

type EmployeeUpdate

type EmployeeUpdate struct {
	Name       *string              `bson:"name,omitempty"`
	Surname    *string              `bson:"surname,omitempty"`
	WorkTimes  *WorkTimes           `bson:"work_times,omitempty"`
	Competence []primitive.ObjectID `bson:"competence,omitempty"`
}

func (*EmployeeUpdate) UpdateOne

func (employeeUpdate *EmployeeUpdate) UpdateOne(
	ctx context.Context,
	db *mongo.Database,
	companyID primitive.ObjectID,
	employeeID primitive.ObjectID,
) (*mongo.UpdateResult, error)

type TimeFrame

type TimeFrame struct {
	From int32 `bson:"from,omitempty"`
	To   int32 `bson:"to,omitempty"`
}

Stores work time intervals. Time is stored as number of minutes since 00:00.

type WorkTimes

type WorkTimes struct {
	Mo []TimeFrame `bson:"mo,omitempty"`
	Tu []TimeFrame `bson:"tu,omitempty"`
	We []TimeFrame `bson:"we,omitempty"`
	Th []TimeFrame `bson:"th,omitempty"`
	Fr []TimeFrame `bson:"fr,omitempty"`
	Sa []TimeFrame `bson:"sa,omitempty"`
	Su []TimeFrame `bson:"su,omitempty"`
}

At each day there may be many work time intervals.

Jump to

Keyboard shortcuts

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