Skip to content

ResourceConfig

Bases: BaseSettings

Reservation resource configuration model, loaded from the yaml files you add to your resource-configs directory. Encapsulates as many individual calendars as you put in the calendars dict, and together they constitute the total reservation capacity for a resource.

The fields maximum_days_ahead, minutes_before_reminder, calendar_shown, and contact_email can be set globally in app-config.yaml, in which case those fields should be omitted from the resource config yaml file.

Attributes:

Name Type Description
file_prefix str

the loaded yaml file prefix for this resource, used as a short name in the app.

route_prefix str

the fastapi endpoint prefix for this resource, will be /file_prefix unless there's only one resource, then it will be set to the empty string to avoid an unnecessary extra url path component.

name str

the webpage title for this resources.

calendars dict[str, CalendarInfo]

dict of "calendar short name" to CalendarInfos for each individual calendar. If more than 4 calendars are included

day_start_time AmPmTime

The beginning of the day for a resource, passed as a string of the form HH:MM AM/PM. Defaults to 12:00 AM.

day_end_time AmPmTime

The end of the day for a resource, passed as a string of the form HH:MM AM/PM. Defaults to 11:59 PM.

minutes_increment int

Positive integer, the increment between allowed start/end time slots. Defaults to 30.

maximum_minutes int

Positive integer, the maximum number of minutes allowed for a reservation. Must be a multiple of minutes_increment. Defaults to 120.

allow_end_next_day bool

Include the checkbox for making a reservation end time the next day. Should be enabled if overnight reservations are allowed. Defaults to False.

allow_shareable bool

Include the checkbox for the user to note that they're willing to share a resource. Should only be enabled for a resource that can be shared. Defaults to False.

emoji str

emoji symbol to append to the form page title. Defaults to ''.

description str

descriptive sub-heading for the resource page. Defaults to ''.

image ImageFile | None

Bundle object for image to display on the webpage. Images can be helpful diagrams or just pretty pictures, whatever your heart desires. All image files must be in the root of the resource-configs dir (no nesting). You can have one image per page, for now. Defaults to None.

custom_form_fields list[CustomFormField]

custom html form input fields to add for the resource page. Defaults to empty list.

maximum_days_ahead int | None

Positive integer, how many days ahead the user can reserve this resource. If None, reservations can be made for any time in the future. Overrides the value defined in app config file, if present. Defaults to 14 if not.

minutes_before_reminder int

Positive integer, how many minutes before the reservation to send an email reminder to the user, if they've selected to receive one. Overrides the value defined in app config file, if present. Defaults to 60 if not.

calendar_shown bool

If False, omit the embedded Google calendar from the form page. The calendar view will also be omitted if the resource has more than 4 calendars, to avoid visual clutter. Overrides the value defined in app config file, if present. Defaults to True if not.

contact_email str

A contact email address for user issues, listed on this reservation page, if desired. Overrides the value defined in app config file, if present. Defaults to None if not.

DEFAULT_TO_APP_CONFIG_FIELDS = ('maximum_days_ahead', 'minutes_before_reminder', 'calendar_shown', 'contact_email') class-attribute instance-attribute

These required fields are duplicated between both AppConfig and ResourceConfig models. Supply them either globally in app-config.yaml, or per-resource in the resource-config yaml file. If they're specifid in both, the resource-config value takes precedence.

MAX_CALENDARS_SHOWN = 4 class-attribute instance-attribute

If a resource page has more than this many individual resource calendars, the Google calendar view won't be shown on the form webpage. It'd be too hectic with the potential for lots of overlapping reservations.