sites

package
v0.0.0-...-f1c2737 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSite

func DeleteSite(ctx context.Context, db *sqlx.DB, siteSlug string) error

Types

type DailySchedule

type DailySchedule struct {
	Id          int64  `json:"-" db:"id"`
	SiteId      int64  `json:"-" db:"site_id"`
	DotwDefault string `json:"-" db:"dotw_default"`     // Enum for the days of the week. If this column is not null, then it specifies a site's default schedule for that day of the week.
	Day         string `json:"date" db:"override_date"` // Expected format: YYYY-MM-DD
	OpenTime    string `json:"open" db:"open_time"`     // Expected format: HH:MM
	CloseTime   string `json:"close" db:"close_time"`   // Expected format: HH:MM
	IsOpen      bool   `json:"is_open" db:"is_open"`
}

type DailyScheduleRow

type DailyScheduleRow struct {
	Id          sql.NullInt64  `db:"id"`
	SiteId      sql.NullInt64  `db:"site_id"`
	DotwDefault sql.NullString `db:"dotw_default"`  // Enum for the days of the week. If this column is not null, then it specifies a site's default schedule for that day of the week.
	Day         sql.NullString `db:"override_date"` // Expected format: YYYY-MM-DD
	OpenTime    sql.NullString `db:"open_time"`     // Expected format: HH:MM
	CloseTime   sql.NullString `db:"close_time"`    // Expected format: HH:MM
	IsOpen      sql.NullBool   `db:"is_open"`
}

type ListSitesRow

type ListSitesRow struct {
	Site

	CoordinatorGuid  sql.NullString `db:"user_guid"`
	CoordinatorEmail sql.NullString `db:"email"`

	ScheduleDefaultDay sql.NullString `db:"dotw_default"`
	ScheduleOverride   sql.NullString `db:"override_date"`
	OpenTime           sql.NullString `db:"open_time"`
	CloseTime          sql.NullString `db:"close_time"`
	IsOpen             sql.NullBool   `db:"is_open"`
}

type Location

type Location struct {
	Latitude      string `json:"lat" db:"lat"`
	Longitude     string `json:"lon" db:"lon"`
	GooglePlaceId string `json:"google_place_id" db:"gplace_id"`
	Street        string `json:"street" db:"street"`
	City          string `json:"city" db:"city"`
	State         string `json:"state" db:"state"`
	ZipCode       string `json:"zip" db:"zip"`
}

type Site

type Site struct {
	Id             uint64 `json:"-" db:"id"`
	OrganizationId uint64 `json:"organization_id" db:"organization_id"`

	Slug   string `json:"slug" db:"slug"`
	Name   string `json:"name" db:"name_l10n"`
	Locale string `json:"locale" db:"locale"`

	Location

	IsActive bool `json:"active" db:"is_active"`

	// List of Site Coordinators/Managers
	Managers []users.User `json:"managers"`

	// Default Schedule
	DefaultSchedule map[string]DailySchedule `json:"default_schedule"`

	// Calendar Overrides
	CalendarOverrides []DailySchedule `json:"-"`

	// Computed Calendar
	Calendar []DailySchedule `json:"calendar"`
}
type WeeklySchedule struct {
	Monday    DailySchedule `json:"monday"`
	Tuesday   DailySchedule `json:"tuesday"`
	Wednesday DailySchedule `json:"wednesday"`
	Thursday  DailySchedule `json:"thursday"`
	Friday    DailySchedule `json:"friday"`
	Saturday  DailySchedule `json:"saturday"`
	Sunday    DailySchedule `json:"sunday"`
}

func CoallateSiteSet

func CoallateSiteSet(rows []ListSitesRow) []Site

func DescribeSite

func DescribeSite(ctx context.Context, slug string, db *sqlx.DB) (site *Site, err error)

func ListSites

func ListSites(ctx context.Context, db *sqlx.DB) (sites []Site, err error)

func (*Site) Create

func (site *Site) Create(ctx context.Context, db *sqlx.DB) error

func (*Site) UpdateSiteAdmin

func (site *Site) UpdateSiteAdmin(ctx context.Context, db *sqlx.DB, updateData *UpdateSiteRequestAdmin) error

type SiteCoordinator

type SiteCoordinator struct {
	Id        uint64 `db:"id"`
	SiteId    uint64 `db:"site_id"`
	UserId    uint64 `db:"user_id"`
	IsPrimary bool   `db:"is_primary"`
}

type UpdateSiteRequestAdmin

type UpdateSiteRequestAdmin struct {
	Site
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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