-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgig.py
More file actions
37 lines (23 loc) · 740 Bytes
/
gig.py
File metadata and controls
37 lines (23 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from datetime import date, time
from sqlmodel import Field, Relationship, SQLModel
from ..schema.client import Client
from ..schema.venue import Venue
class GigBase(SQLModel):
date: date
time: time
name: str
class Gig(GigBase, table=True):
id: int = Field(default=None, primary_key=True)
venue_id: int = Field(default=None, foreign_key="venue.id")
venue: Venue = Relationship(back_populates="gigs")
client_id: int = Field(default=None, foreign_key="client.id")
client: Client = Relationship(back_populates="gigs")
class GigCreate(GigBase):
venue_id: int
client_id: int
class GigPublic(GigBase):
id: int
venue_id: int
client_id: int
class Gigs(SQLModel):
gigs: list[Gig]