Skip to content

Commit

Permalink
feat: add details about rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemSBulgakov committed Sep 30, 2024
1 parent de85ec7 commit 258d8e1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions settings.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ environment: development
rooms:
- id: "301"
title: "Lecture Room 301"
short_name: "301"
ics_url: ""
my_uni_id: 1
30 changes: 30 additions & 0 deletions settings.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ $defs:
description: Room title
title: Title
type: string
short_name:
description: Shorter version of room title
title: Short Name
type: string
ics_url:
description: URL of the ICS calendar
title: Ics Url
Expand All @@ -42,9 +46,35 @@ $defs:
description: ID of room on My University portal
title: My Uni Id
type: integer
capacity:
anyOf:
- type: integer
- type: 'null'
default: null
description: Room capacity, amount of people
title: Capacity
access_level:
anyOf:
- enum:
- yellow
- red
- special
type: string
- type: 'null'
default: null
description: Access level to the room. Yellow = for students. Red = for employees.
Special = special rules apply.
title: Access Level
restrict_daytime:
default: false
description: Prohibit to book during working hours. True = this room is available
only at night 19:00-8:00, or full day on weekends.
title: Restrict Daytime
type: boolean
required:
- id
- title
- short_name
- ics_url
- my_uni_id
title: Room
Expand Down
9 changes: 9 additions & 0 deletions src/config_schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import StrEnum
from pathlib import Path
from typing import Literal

import yaml
from pydantic import BaseModel, Field, ConfigDict
Expand All @@ -21,10 +22,18 @@ class Room(SettingBaseModel):
"Room slug"
title: str
"Room title"
short_name: str
"Shorter version of room title"
ics_url: str = Field(exclude=True)
"URL of the ICS calendar"
my_uni_id: int
"ID of room on My University portal"
capacity: int | None = None
"Room capacity, amount of people"
access_level: Literal["yellow", "red", "special"] | None = None
"Access level to the room. Yellow = for students. Red = for employees. Special = special rules apply."
restrict_daytime: bool = False
"Prohibit to book during working hours. True = this room is available only at night 19:00-8:00, or full day on weekends."


class Accounts(SettingBaseModel):
Expand Down

0 comments on commit 258d8e1

Please sign in to comment.