ThalamOS
a powerful Flask web application designed to enhance your storage management.
Loading...
Searching...
No Matches
models.py
Go to the documentation of this file.
1
"""
2
Models Module
3
4
This module defines the database models using SQLModel and Pydantic.
5
It includes the StorageItem model and the StorageItemType enumeration.
6
"""
7
from
datetime
import
datetime
8
from
enum
import
Enum
9
from
typing
import
Optional
10
from
sqlmodel
import
Field, SQLModel
11
12
13
class
StorageItemType
(str, Enum):
14
"""Enumeration for different types of storage items."""
15
SENSOR =
"SENSOR"
16
SCREW =
"SCREW"
17
DISPLAY =
"DISPLAY"
18
NAIL =
"NAIL"
19
CABLE =
"CABLE"
20
MISCELLANEOUS =
"MISCELLANEOUS"
21
22
23
class
StorageItem
(SQLModel, table=
True
):
24
"""Data model representing an item in the storage database."""
25
__tablename__ =
"storage"
26
id: Optional[int] = Field(default=
None
, primary_key=
True
)
27
position: int
28
type: StorageItemType
29
name: str
30
info: Optional[str] =
None
31
modification_time: datetime = Field(default_factory=datetime.now)
models.StorageItemType
Definition
models.py:13
models.StorageItem
Definition
models.py:23
app
models.py
Generated by
1.13.2