oncalloverwrite

package
v1.6.13 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OverwriteJournal is used to keep track of emergency-duty-overwrites.
	OverwriteJournal = "dutyRosterOverwrites"

	// InboundNumberCollection is the name of the MongoDB collection that
	// stores inbound numbers.
	InboundNumberCollection = "inboundNumbers"
)

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, inboundNumber string) (structs.Overwrite, error)

	// GetOverwrite returns the currently active overwrite for the given date/time.
	GetActiveOverwrite(ctx context.Context, date time.Time, inboundNumbers []string) (*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, inboundNumbers []string) ([]*structs.Overwrite, error)

	// DeleteOverwrite deletes the roster overwrite for the given
	// day.
	DeleteActiveOverwrite(ctx context.Context, date time.Time, inboundNumber []string) (*structs.Overwrite, error)

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

	// CreateInboundNumber creates a new inbound number
	CreateInboundNumber(ctx context.Context, model structs.InboundNumber) error

	// DeleteInboundNumber deletes an existing inbound number.
	DeleteInboundNumber(ctx context.Context, number string) error

	// UpdateInboundNumber updates the display name of an existing inbound number
	UpdateInboundNumber(ctx context.Context, model structs.InboundNumber) error

	// ListInboundNumbers returns a list of existing inbound numbers.
	ListInboundNumbers(ctx context.Context) ([]structs.InboundNumber, error)

	// GetInboundNumber returns the inbound number for the given number.
	GetInboundNumber(ctx context.Context, number string) (structs.InboundNumber, 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