oncalloverwrite

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const OverwriteJournal = "dutyRosterOverwrites"

OverwriteJournal is used to keep track of emergency-duty-overwrites.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByTime

type ByTime []*structs.Overwrite

ByTime can be used to sort a slice of overwrites by From time.

func (ByTime) Len

func (sl ByTime) Len() int

func (ByTime) Less

func (sl ByTime) Less(i, j int) bool

func (ByTime) Swap

func (sl ByTime) Swap(i, j int)

type Database

type Database interface {
	// CreateOverwrite configures an emergency doctor-on-duty overwrite for the
	// given date.
	CreateOverwrite(ctx context.Context, creatorId string, from, to time.Time, user, phone, displayName string) (structs.Overwrite, error)

	// GetOverwrite returns the currently active overwrite for the given date/time.
	GetActiveOverwrite(ctx context.Context, date time.Time) (*structs.Overwrite, error)

	// GetOverwrite returns a single overwrite identified by id. Even entries that are marked as deleted
	// will be returned.
	GetOverwrite(ctx context.Context, id string) (*structs.Overwrite, error)

	// GetOverwrites returns all overwrites that have start or time between from and to.
	GetOverwrites(ctx context.Context, from, to time.Time, includeDeleted bool) ([]*structs.Overwrite, error)

	// DeleteOverwrite deletes the roster overwrite for the given
	// day.
	DeleteActiveOverwrite(ctx context.Context, date time.Time) error

	// DeleteOverwrite deletes the roster overwrite with the given ID
	DeleteOverwrite(ctx context.Context, id string) error
}

Database is the database interface for the duty rosters.

func New

func New(ctx context.Context, dbName string, client *mongo.Client) (Database, error)

New is like new but directly accepts the mongoDB client to use.

Jump to

Keyboard shortcuts

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