@@ -18,12 +18,12 @@ class Credentials(BaseDbModel):
1818 """User credentials"""
1919
2020 id : Mapped [int ] = mapped_column (Integer , primary_key = True )
21- group : Mapped [int ] = mapped_column (String , nullable = False )
22- email : Mapped [int ] = mapped_column (String , nullable = False )
23- scope : Mapped [int ] = mapped_column (JSON , nullable = False )
24- token : Mapped [int ] = mapped_column (JSON , nullable = False )
25- create_ts : Mapped [int ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow )
26- update_ts : Mapped [int ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow , onupdate = datetime .utcnow )
21+ group : Mapped [str ] = mapped_column (String , nullable = False )
22+ email : Mapped [str ] = mapped_column (String , nullable = False )
23+ scope : Mapped [JSON ] = mapped_column (JSON , nullable = False )
24+ token : Mapped [JSON ] = mapped_column (JSON , nullable = False )
25+ create_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow )
26+ update_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow , onupdate = datetime .utcnow )
2727
2828
2929class Direction (str , Enum ):
@@ -36,7 +36,7 @@ class Room(BaseDbModel):
3636 direction : Mapped [Direction ] = mapped_column (DbEnum (Direction , native_enum = False ), nullable = True )
3737 building : Mapped [str ] = mapped_column (String , nullable = True )
3838 building_url : Mapped [str ] = mapped_column (String , nullable = True )
39- is_deleted : Mapped [bool ] = mapped_column (Boolean , default = False )
39+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
4040
4141 events : Mapped [list [Event ]] = relationship (
4242 "Event" ,
@@ -51,9 +51,9 @@ class Lecturer(BaseDbModel):
5151 first_name : Mapped [str ] = mapped_column (String , nullable = False )
5252 middle_name : Mapped [str ] = mapped_column (String , nullable = False )
5353 last_name : Mapped [str ] = mapped_column (String , nullable = False )
54- avatar_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("photo.id" ))
54+ avatar_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("photo.id" ), nullable = True )
5555 description : Mapped [str ] = mapped_column (Text , nullable = True )
56- is_deleted : Mapped [bool ] = mapped_column (Boolean , default = False )
56+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
5757
5858 avatar : Mapped [Photo ] = relationship (
5959 "Photo" ,
@@ -98,9 +98,9 @@ def last_photo(self) -> Photo | None:
9898
9999
100100class Group (BaseDbModel ):
101- name : Mapped [int ] = mapped_column (String , nullable = False )
102- number : Mapped [int ] = mapped_column (String , nullable = False , unique = True )
103- is_deleted : Mapped [int ] = mapped_column (Boolean , default = False )
101+ name : Mapped [str ] = mapped_column (String , nullable = False )
102+ number : Mapped [str ] = mapped_column (String , nullable = False , unique = True )
103+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
104104
105105 events : Mapped [list [Event ]] = relationship (
106106 "Event" ,
@@ -111,11 +111,11 @@ class Group(BaseDbModel):
111111
112112
113113class Event (BaseDbModel ):
114- name : Mapped [int ] = mapped_column (String , nullable = False )
115- group_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("group.id" ))
116- start_ts : Mapped [int ] = mapped_column (DateTime , nullable = False )
117- end_ts : Mapped [int ] = mapped_column (DateTime , nullable = False )
118- is_deleted : Mapped [int ] = mapped_column (Boolean , default = False )
114+ name : Mapped [str ] = mapped_column (String , nullable = False )
115+ group_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("group.id" ), nullable = True )
116+ start_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False )
117+ end_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False )
118+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
119119
120120 room : Mapped [list [Room ]] = relationship (
121121 "Room" ,
@@ -144,20 +144,20 @@ class Event(BaseDbModel):
144144
145145
146146class EventsLecturers (BaseDbModel ):
147- event_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("event.id" ))
148- lecturer_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("lecturer.id" ))
147+ event_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("event.id" ), nullable = False )
148+ lecturer_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("lecturer.id" ), nullable = False )
149149
150150
151151class EventsRooms (BaseDbModel ):
152- event_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("event.id" ))
153- room_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("room.id" ))
152+ event_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("event.id" ), nullable = False )
153+ room_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("room.id" ), nullable = False )
154154
155155
156156class Photo (BaseDbModel ):
157- lecturer_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("lecturer.id" ))
158- link : Mapped [int ] = mapped_column (String , unique = True )
159- approve_status : Mapped [int ] = mapped_column (DbEnum (ApproveStatuses , native_enum = False ), nullable = False )
160- is_deleted : Mapped [int ] = mapped_column (Boolean , default = False )
157+ lecturer_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("lecturer.id" ), nullable = False )
158+ link : Mapped [str ] = mapped_column (String , unique = True , nullable = False )
159+ approve_status : Mapped [ApproveStatuses ] = mapped_column (DbEnum (ApproveStatuses , native_enum = False ), nullable = False )
160+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
161161
162162 lecturer : Mapped [Lecturer ] = relationship (
163163 "Lecturer" ,
@@ -169,13 +169,13 @@ class Photo(BaseDbModel):
169169
170170
171171class CommentLecturer (BaseDbModel ):
172- lecturer_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("lecturer.id" ))
173- author_name : Mapped [int ] = mapped_column (String , nullable = False )
174- text : Mapped [int ] = mapped_column (String , nullable = False )
175- approve_status : Mapped [int ] = mapped_column (DbEnum (ApproveStatuses , native_enum = False ), nullable = False )
176- create_ts : Mapped [int ] = mapped_column (DateTime , default = datetime .utcnow ())
177- update_ts : Mapped [int ] = mapped_column (DateTime , default = datetime .utcnow (), onupdate = datetime .utcnow ())
178- is_deleted : Mapped [int ] = mapped_column (Boolean , default = False )
172+ lecturer_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("lecturer.id" ), nullable = False )
173+ author_name : Mapped [str ] = mapped_column (String , nullable = False )
174+ text : Mapped [str ] = mapped_column (String , nullable = False )
175+ approve_status : Mapped [ApproveStatuses ] = mapped_column (DbEnum (ApproveStatuses , native_enum = False ), nullable = False )
176+ create_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow ())
177+ update_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow (), onupdate = datetime .utcnow ())
178+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
179179
180180 lecturer : Mapped [Lecturer ] = relationship (
181181 "Lecturer" ,
@@ -186,13 +186,13 @@ class CommentLecturer(BaseDbModel):
186186
187187
188188class CommentEvent (BaseDbModel ):
189- event_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("event.id" ))
190- author_name : Mapped [int ] = mapped_column (String , nullable = False )
191- text : Mapped [int ] = mapped_column (String , nullable = False )
192- approve_status : Mapped [int ] = mapped_column (DbEnum (ApproveStatuses , native_enum = False ), nullable = False )
193- create_ts : Mapped [int ] = mapped_column (DateTime , default = datetime .utcnow ())
194- update_ts : Mapped [int ] = mapped_column (DateTime , default = datetime .utcnow (), onupdate = datetime .utcnow ())
195- is_deleted : Mapped [int ] = mapped_column (Boolean , default = False )
189+ event_id : Mapped [int ] = mapped_column (Integer , ForeignKey ("event.id" ), nullable = False )
190+ author_name : Mapped [str ] = mapped_column (String , nullable = False )
191+ text : Mapped [str ] = mapped_column (String , nullable = False )
192+ approve_status : Mapped [ApproveStatuses ] = mapped_column (DbEnum (ApproveStatuses , native_enum = False ), nullable = False )
193+ create_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow ())
194+ update_ts : Mapped [datetime ] = mapped_column (DateTime , nullable = False , default = datetime .utcnow (), onupdate = datetime .utcnow ())
195+ is_deleted : Mapped [bool ] = mapped_column (Boolean , nullable = False , default = False )
196196
197197 event : Mapped [Event ] = relationship (
198198 "Event" ,
0 commit comments