Documentation ¶
Index ¶
- Constants
- type ConstraintDatabase
- type DatabaseImpl
- func (db *DatabaseImpl) AddOffTimeCost(ctx context.Context, costs *structs.OffTimeCosts) error
- func (db *DatabaseImpl) ApproveDutyRoster(ctx context.Context, rosterID string, approverID string) error
- func (db *DatabaseImpl) ApproveOffTimeRequest(ctx context.Context, id string, approval *structs.Approval) error
- func (db *DatabaseImpl) CreateConstraint(ctx context.Context, constraint *structs.Constraint) error
- func (db *DatabaseImpl) CreateOffTimeRequest(ctx context.Context, req *structs.OffTimeEntry) error
- func (db *DatabaseImpl) DeleteConstraint(ctx context.Context, id string) error
- func (db *DatabaseImpl) DeleteDutyRoster(ctx context.Context, id string, supersededBy primitive.ObjectID) error
- func (db *DatabaseImpl) DeleteOffTimeCosts(ctx context.Context, ids ...string) error
- func (db *DatabaseImpl) DeleteOffTimeCostsByRoster(ctx context.Context, rosterID string) error
- func (db *DatabaseImpl) DeleteOffTimeRequest(ctx context.Context, ids ...string) error
- func (db *DatabaseImpl) DeleteRosterType(ctx context.Context, rosterTypeName string) error
- func (db *DatabaseImpl) DeleteWorkShift(ctx context.Context, id string) error
- func (db *DatabaseImpl) DeleteWorkTime(ctx context.Context, ids ...string) error
- func (db *DatabaseImpl) DutyRosterByID(ctx context.Context, id string) (structs.DutyRoster, error)
- func (db *DatabaseImpl) DutyRostersByTime(ctx context.Context, t time.Time) ([]structs.DutyRoster, error)
- func (db *DatabaseImpl) FindConstraints(ctx context.Context, staffs []string, roles []string) ([]structs.Constraint, error)
- func (db *DatabaseImpl) FindOffTimeRequests(ctx context.Context, from, to time.Time, approved *bool, staff []string) ([]structs.OffTimeEntry, error)
- func (db *DatabaseImpl) FindRostersWithActiveShifts(ctx context.Context, t time.Time) ([]structs.DutyRoster, error)
- func (db *DatabaseImpl) FindRostersWithActiveShiftsInRange(ctx context.Context, from, to time.Time) ([]structs.DutyRoster, error)
- func (db *DatabaseImpl) GetConstraintByID(ctx context.Context, id string) (*structs.Constraint, error)
- func (db *DatabaseImpl) GetCurrentWorkTimes(ctx context.Context, until time.Time) (map[string]structs.WorkTime, error)
- func (db *DatabaseImpl) GetOffTimeCosts(ctx context.Context, user_ids ...string) ([]structs.OffTimeCosts, error)
- func (db *DatabaseImpl) GetOffTimeRequest(ctx context.Context, ids ...string) ([]structs.OffTimeEntry, error)
- func (db *DatabaseImpl) GetRosterType(ctx context.Context, name string) (structs.RosterType, error)
- func (db *DatabaseImpl) GetRosterTypes(ctx context.Context) ([]structs.RosterType, error)
- func (db *DatabaseImpl) GetShiftsForDay(ctx context.Context, weekDay time.Weekday, isHoliday bool) ([]structs.WorkShift, error)
- func (db *DatabaseImpl) GetSupersededDutyRoster(ctx context.Context, rosterID primitive.ObjectID) (*structs.DutyRoster, error)
- func (db *DatabaseImpl) GetWorktimeByID(ctx context.Context, id string) (*structs.WorkTime, error)
- func (db *DatabaseImpl) ListWorkShifts(ctx context.Context) ([]structs.WorkShift, error)
- func (db *DatabaseImpl) LoadDutyRosters(ctx context.Context) ([]structs.DutyRoster, error)
- func (db *DatabaseImpl) SaveDutyRoster(ctx context.Context, roster *structs.DutyRoster, casIndex *uint64) (bool, error)
- func (db *DatabaseImpl) SaveRosterType(ctx context.Context, model structs.RosterType) error
- func (db *DatabaseImpl) SaveWorkShift(ctx context.Context, workShift *structs.WorkShift) error
- func (db *DatabaseImpl) SaveWorkTimePerWeek(ctx context.Context, wt *structs.WorkTime) error
- func (db *DatabaseImpl) SetDebug(v bool)
- func (db *DatabaseImpl) UpdateConstraint(ctx context.Context, constraint *structs.Constraint) error
- func (db *DatabaseImpl) UpdateOffTimeRequest(ctx context.Context, req *structs.OffTimeEntry) error
- func (db *DatabaseImpl) UpdateWorkTime(ctx context.Context, wt *structs.WorkTime) error
- func (db *DatabaseImpl) WorkTimeHistoryForStaff(ctx context.Context, userID string) ([]structs.WorkTime, error)
- type DutyRosterDatabase
- type OffTimeDatabase
- type WorkShiftDatabase
- type WorkTimeDatabase
Constants ¶
View Source
const ( ShiftCollection = "rosterd-shifts" RosterCollection = "rosterd-rosters" OffTimeRequestCollection = "rosterd-offtime" OffTimeCostsCollection = "rosterd-offtime-costs" ConstraintCollection = "rosterd-constraints" WorktimeCollection = "rosterd-worktime" DutyRosterCollection = "rosterd-dutyrosters" RosterTypeCollection = "rosterd-rostertypes" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstraintDatabase ¶
type ConstraintDatabase interface { CreateConstraint(ctx context.Context, req *structs.Constraint) error UpdateConstraint(ctx context.Context, constraint *structs.Constraint) error DeleteConstraint(ctx context.Context, id string) error FindConstraints(ctx context.Context, staff []string, roleIds []string) ([]structs.Constraint, error) }
type DatabaseImpl ¶
type DatabaseImpl struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func (*DatabaseImpl) AddOffTimeCost ¶
func (db *DatabaseImpl) AddOffTimeCost(ctx context.Context, costs *structs.OffTimeCosts) error
func (*DatabaseImpl) ApproveDutyRoster ¶
func (*DatabaseImpl) ApproveOffTimeRequest ¶
func (*DatabaseImpl) CreateConstraint ¶
func (db *DatabaseImpl) CreateConstraint(ctx context.Context, constraint *structs.Constraint) error
func (*DatabaseImpl) CreateOffTimeRequest ¶
func (db *DatabaseImpl) CreateOffTimeRequest(ctx context.Context, req *structs.OffTimeEntry) error
func (*DatabaseImpl) DeleteConstraint ¶
func (db *DatabaseImpl) DeleteConstraint(ctx context.Context, id string) error
func (*DatabaseImpl) DeleteDutyRoster ¶
func (*DatabaseImpl) DeleteOffTimeCosts ¶
func (db *DatabaseImpl) DeleteOffTimeCosts(ctx context.Context, ids ...string) error
func (*DatabaseImpl) DeleteOffTimeCostsByRoster ¶
func (db *DatabaseImpl) DeleteOffTimeCostsByRoster(ctx context.Context, rosterID string) error
func (*DatabaseImpl) DeleteOffTimeRequest ¶
func (db *DatabaseImpl) DeleteOffTimeRequest(ctx context.Context, ids ...string) error
func (*DatabaseImpl) DeleteRosterType ¶
func (db *DatabaseImpl) DeleteRosterType(ctx context.Context, rosterTypeName string) error
func (*DatabaseImpl) DeleteWorkShift ¶
func (db *DatabaseImpl) DeleteWorkShift(ctx context.Context, id string) error
func (*DatabaseImpl) DeleteWorkTime ¶
func (db *DatabaseImpl) DeleteWorkTime(ctx context.Context, ids ...string) error
func (*DatabaseImpl) DutyRosterByID ¶
func (db *DatabaseImpl) DutyRosterByID(ctx context.Context, id string) (structs.DutyRoster, error)
func (*DatabaseImpl) DutyRostersByTime ¶
func (db *DatabaseImpl) DutyRostersByTime(ctx context.Context, t time.Time) ([]structs.DutyRoster, error)
func (*DatabaseImpl) FindConstraints ¶
func (db *DatabaseImpl) FindConstraints(ctx context.Context, staffs []string, roles []string) ([]structs.Constraint, error)
func (*DatabaseImpl) FindOffTimeRequests ¶
func (db *DatabaseImpl) FindOffTimeRequests(ctx context.Context, from, to time.Time, approved *bool, staff []string) ([]structs.OffTimeEntry, error)
func (*DatabaseImpl) FindRostersWithActiveShifts ¶
func (db *DatabaseImpl) FindRostersWithActiveShifts(ctx context.Context, t time.Time) ([]structs.DutyRoster, error)
func (*DatabaseImpl) FindRostersWithActiveShiftsInRange ¶ added in v1.4.15
func (db *DatabaseImpl) FindRostersWithActiveShiftsInRange(ctx context.Context, from, to time.Time) ([]structs.DutyRoster, error)
func (*DatabaseImpl) GetConstraintByID ¶
func (db *DatabaseImpl) GetConstraintByID(ctx context.Context, id string) (*structs.Constraint, error)
func (*DatabaseImpl) GetCurrentWorkTimes ¶
func (*DatabaseImpl) GetOffTimeCosts ¶
func (db *DatabaseImpl) GetOffTimeCosts(ctx context.Context, user_ids ...string) ([]structs.OffTimeCosts, error)
func (*DatabaseImpl) GetOffTimeRequest ¶
func (db *DatabaseImpl) GetOffTimeRequest(ctx context.Context, ids ...string) ([]structs.OffTimeEntry, error)
func (*DatabaseImpl) GetRosterType ¶
func (db *DatabaseImpl) GetRosterType(ctx context.Context, name string) (structs.RosterType, error)
func (*DatabaseImpl) GetRosterTypes ¶
func (db *DatabaseImpl) GetRosterTypes(ctx context.Context) ([]structs.RosterType, error)
func (*DatabaseImpl) GetShiftsForDay ¶
func (*DatabaseImpl) GetSupersededDutyRoster ¶
func (db *DatabaseImpl) GetSupersededDutyRoster(ctx context.Context, rosterID primitive.ObjectID) (*structs.DutyRoster, error)
func (*DatabaseImpl) GetWorktimeByID ¶
func (*DatabaseImpl) ListWorkShifts ¶
func (*DatabaseImpl) LoadDutyRosters ¶
func (db *DatabaseImpl) LoadDutyRosters(ctx context.Context) ([]structs.DutyRoster, error)
func (*DatabaseImpl) SaveDutyRoster ¶
func (db *DatabaseImpl) SaveDutyRoster(ctx context.Context, roster *structs.DutyRoster, casIndex *uint64) (bool, error)
func (*DatabaseImpl) SaveRosterType ¶
func (db *DatabaseImpl) SaveRosterType(ctx context.Context, model structs.RosterType) error
func (*DatabaseImpl) SaveWorkShift ¶
func (*DatabaseImpl) SaveWorkTimePerWeek ¶
func (*DatabaseImpl) SetDebug ¶
func (db *DatabaseImpl) SetDebug(v bool)
func (*DatabaseImpl) UpdateConstraint ¶
func (db *DatabaseImpl) UpdateConstraint(ctx context.Context, constraint *structs.Constraint) error
func (*DatabaseImpl) UpdateOffTimeRequest ¶
func (db *DatabaseImpl) UpdateOffTimeRequest(ctx context.Context, req *structs.OffTimeEntry) error
func (*DatabaseImpl) UpdateWorkTime ¶
func (*DatabaseImpl) WorkTimeHistoryForStaff ¶
type DutyRosterDatabase ¶
type DutyRosterDatabase interface { SaveDutyRoster(ctx context.Context, roster *structs.DutyRoster, casIndex *uint64) (bool, error) DeleteDutyRoster(ctx context.Context, rosterID string, supersededBy primitive.ObjectID) error ApproveDutyRoster(ctx context.Context, rosterID, approver string) error DutyRosterByID(ctx context.Context, id string) (structs.DutyRoster, error) DutyRostersByTime(ctx context.Context, time time.Time) ([]structs.DutyRoster, error) GetSupersededDutyRoster(ctx context.Context, rosterID primitive.ObjectID) (*structs.DutyRoster, error) FindRostersWithActiveShifts(ctx context.Context, t time.Time) ([]structs.DutyRoster, error) FindRostersWithActiveShiftsInRange(ctx context.Context, from, to time.Time) ([]structs.DutyRoster, error) }
type OffTimeDatabase ¶
type OffTimeDatabase interface { GetOffTimeRequest(ctx context.Context, ids ...string) ([]structs.OffTimeEntry, error) CreateOffTimeRequest(ctx context.Context, req *structs.OffTimeEntry) error DeleteOffTimeRequest(ctx context.Context, id ...string) error FindOffTimeRequests(ctx context.Context, from, to time.Time, approved *bool, userIds []string) ([]structs.OffTimeEntry, error) ApproveOffTimeRequest(ctx context.Context, id string, approval *structs.Approval) error AddOffTimeCost(ctx context.Context, cost *structs.OffTimeCosts) error GetOffTimeCosts(ctx context.Context, user_ids ...string) ([]structs.OffTimeCosts, error) DeleteOffTimeCosts(ctx context.Context, ids ...string) error }
type WorkShiftDatabase ¶
type WorkShiftDatabase interface { SaveWorkShift(context.Context, *structs.WorkShift) error DeleteWorkShift(context.Context, string) error ListWorkShifts(context.Context) ([]structs.WorkShift, error) GetShiftsForDay(ctx context.Context, weekDay time.Weekday, isHoliday bool) ([]structs.WorkShift, error) }
type WorkTimeDatabase ¶
type WorkTimeDatabase interface { SaveWorkTimePerWeek(ctx context.Context, wt *structs.WorkTime) error WorkTimeHistoryForStaff(ctx context.Context, staff string) ([]structs.WorkTime, error) GetCurrentWorkTimes(ctx context.Context, until time.Time) (map[string]structs.WorkTime, error) DeleteWorkTime(ctx context.Context, ids ...string) error GetWorktimeByID(ctx context.Context, id string) (*structs.WorkTime, error) UpdateWorkTime(ctx context.Context, wt *structs.WorkTime) error }
Click to show internal directories.
Click to hide internal directories.