f3-data-models 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
f3_data_models/models.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from datetime import datetime, date, time
|
2
|
-
from typing import Any, Dict,
|
2
|
+
from typing import Any, Dict, Optional
|
3
3
|
from sqlalchemy import (
|
4
4
|
JSON,
|
5
5
|
TEXT,
|
@@ -9,39 +9,45 @@ from sqlalchemy import (
|
|
9
9
|
DateTime,
|
10
10
|
ForeignKey,
|
11
11
|
Integer,
|
12
|
-
UniqueConstraint,
|
13
12
|
func,
|
13
|
+
UniqueConstraint,
|
14
14
|
)
|
15
15
|
from typing_extensions import Annotated
|
16
|
-
from sqlalchemy.orm import
|
16
|
+
from sqlalchemy.orm import (
|
17
|
+
DeclarativeBase,
|
18
|
+
mapped_column,
|
19
|
+
Mapped,
|
20
|
+
)
|
17
21
|
|
18
22
|
# Custom Annotations
|
19
23
|
time_notz = Annotated[time, TIME]
|
20
24
|
text = Annotated[str, TEXT]
|
25
|
+
intpk = Annotated[int, mapped_column(Integer, primary_key=True, autoincrement=True)]
|
26
|
+
dt_create = Annotated[
|
27
|
+
datetime, mapped_column(DateTime, server_default=func.timezone("utc", func.now()))
|
28
|
+
]
|
29
|
+
dt_update = Annotated[
|
30
|
+
datetime,
|
31
|
+
mapped_column(
|
32
|
+
DateTime,
|
33
|
+
server_default=func.timezone("utc", func.now()),
|
34
|
+
server_onupdate=func.timezone("utc", func.now()),
|
35
|
+
),
|
36
|
+
]
|
21
37
|
|
22
38
|
|
23
39
|
class Base(DeclarativeBase):
|
24
40
|
"""
|
25
|
-
Base class for all models, providing common
|
41
|
+
Base class for all models, providing common methods.
|
26
42
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
43
|
+
Methods:
|
44
|
+
get_id: Get the primary key of the model.
|
45
|
+
get: Get the value of a specified attribute.
|
46
|
+
to_json: Convert the model instance to a JSON-serializable dictionary.
|
47
|
+
__repr__: Get a string representation of the model instance.
|
48
|
+
_update: Update the model instance with the provided fields.
|
31
49
|
"""
|
32
50
|
|
33
|
-
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
34
|
-
# created: Mapped[datetime] = dt_create
|
35
|
-
# updated: Mapped[datetime] = dt_update
|
36
|
-
created: Mapped[datetime] = mapped_column(
|
37
|
-
DateTime, server_default=func.timezone("utc", func.now())
|
38
|
-
)
|
39
|
-
updated: Mapped[datetime] = mapped_column(
|
40
|
-
DateTime,
|
41
|
-
server_default=func.timezone("utc", func.now()),
|
42
|
-
onupdate=func.timezone("utc", func.now()),
|
43
|
-
)
|
44
|
-
|
45
51
|
type_annotation_map = {
|
46
52
|
Dict[str, Any]: JSON,
|
47
53
|
}
|
@@ -112,26 +118,24 @@ class SlackSpace(Base):
|
|
112
118
|
Model representing a Slack workspace.
|
113
119
|
|
114
120
|
Attributes:
|
121
|
+
id (int): Primary Key of the model.
|
115
122
|
team_id (str): The Slack-internal unique identifier for the Slack team.
|
116
123
|
workspace_name (Optional[str]): The name of the Slack workspace.
|
117
124
|
bot_token (Optional[str]): The bot token for the Slack workspace.
|
118
125
|
settings (Optional[Dict[str, Any]]): Slack Bot settings for the Slack workspace.
|
119
|
-
|
120
|
-
|
121
|
-
org (Org): The organization associated with this Slack workspace.
|
126
|
+
created (datetime): The timestamp when the record was created.
|
127
|
+
updated (datetime): The timestamp when the record was last updated.
|
122
128
|
"""
|
123
129
|
|
124
130
|
__tablename__ = "slack_spaces"
|
125
131
|
|
132
|
+
id: Mapped[intpk]
|
126
133
|
team_id: Mapped[str] = mapped_column(VARCHAR, unique=True)
|
127
134
|
workspace_name: Mapped[Optional[str]]
|
128
135
|
bot_token: Mapped[Optional[str]]
|
129
136
|
settings: Mapped[Optional[Dict[str, Any]]]
|
130
|
-
|
131
|
-
|
132
|
-
org: Mapped["Org"] = relationship(
|
133
|
-
back_populates="slack_space", secondary="org_x_slack", lazy="joined"
|
134
|
-
)
|
137
|
+
created: Mapped[dt_create]
|
138
|
+
updated: Mapped[dt_update]
|
135
139
|
|
136
140
|
|
137
141
|
class OrgType(Base):
|
@@ -139,14 +143,20 @@ class OrgType(Base):
|
|
139
143
|
Model representing an organization type / level. 1=AO, 2=Region, 3=Area, 4=Sector
|
140
144
|
|
141
145
|
Attributes:
|
146
|
+
id (int): Primary Key of the model.
|
142
147
|
name (str): The name of the organization type.
|
143
148
|
description (Optional[text]): A description of the organization type.
|
149
|
+
created (datetime): The timestamp when the record was created.
|
150
|
+
updated (datetime): The timestamp when the record was last updated.
|
144
151
|
"""
|
145
152
|
|
146
153
|
__tablename__ = "org_types"
|
147
154
|
|
155
|
+
id: Mapped[intpk]
|
148
156
|
name: Mapped[str]
|
149
157
|
description: Mapped[Optional[text]]
|
158
|
+
created: Mapped[dt_create]
|
159
|
+
updated: Mapped[dt_update]
|
150
160
|
|
151
161
|
|
152
162
|
class EventCategory(Base):
|
@@ -154,19 +164,20 @@ class EventCategory(Base):
|
|
154
164
|
Model representing an event category. These are immutable cateogies that we will define at the Nation level.
|
155
165
|
|
156
166
|
Attributes:
|
167
|
+
id (int): Primary Key of the model.
|
157
168
|
name (str): The name of the event category.
|
158
169
|
description (Optional[text]): A description of the event category.
|
159
|
-
|
170
|
+
created (datetime): The timestamp when the record was created.
|
171
|
+
updated (datetime): The timestamp when the record was last updated.
|
160
172
|
"""
|
161
173
|
|
162
174
|
__tablename__ = "event_categories"
|
163
175
|
|
176
|
+
id: Mapped[intpk]
|
164
177
|
name: Mapped[str]
|
165
178
|
description: Mapped[Optional[text]]
|
166
|
-
|
167
|
-
|
168
|
-
back_populates="event_category"
|
169
|
-
)
|
179
|
+
created: Mapped[dt_create]
|
180
|
+
updated: Mapped[dt_update]
|
170
181
|
|
171
182
|
|
172
183
|
class Role(Base):
|
@@ -174,14 +185,20 @@ class Role(Base):
|
|
174
185
|
Model representing a role. A role is a set of permissions that can be assigned to users.
|
175
186
|
|
176
187
|
Attributes:
|
188
|
+
id (int): Primary Key of the model.
|
177
189
|
name (str): The name of the role.
|
178
190
|
description (Optional[text]): A description of the role.
|
191
|
+
created (datetime): The timestamp when the record was created.
|
192
|
+
updated (datetime): The timestamp when the record was last updated.
|
179
193
|
"""
|
180
194
|
|
181
195
|
__tablename__ = "roles"
|
182
196
|
|
197
|
+
id: Mapped[intpk]
|
183
198
|
name: Mapped[str]
|
184
199
|
description: Mapped[Optional[text]]
|
200
|
+
created: Mapped[dt_create]
|
201
|
+
updated: Mapped[dt_update]
|
185
202
|
|
186
203
|
|
187
204
|
class Permission(Base):
|
@@ -189,14 +206,20 @@ class Permission(Base):
|
|
189
206
|
Model representing a permission.
|
190
207
|
|
191
208
|
Attributes:
|
209
|
+
id (int): Primary Key of the model.
|
192
210
|
name (str): The name of the permission.
|
193
211
|
description (Optional[text]): A description of the permission.
|
212
|
+
created (datetime): The timestamp when the record was created.
|
213
|
+
updated (datetime): The timestamp when the record was last updated.
|
194
214
|
"""
|
195
215
|
|
196
216
|
__tablename__ = "permissions"
|
197
217
|
|
218
|
+
id: Mapped[intpk]
|
198
219
|
name: Mapped[str]
|
199
220
|
description: Mapped[Optional[text]]
|
221
|
+
created: Mapped[dt_create]
|
222
|
+
updated: Mapped[dt_update]
|
200
223
|
|
201
224
|
|
202
225
|
class Role_x_Permission(Base):
|
@@ -206,23 +229,13 @@ class Role_x_Permission(Base):
|
|
206
229
|
Attributes:
|
207
230
|
role_id (int): The ID of the associated role.
|
208
231
|
permission_id (int): The ID of the associated permission.
|
209
|
-
role (Role): The role associated with this relationship.
|
210
|
-
permission (Permission): The permission associated with this relationship.
|
211
232
|
"""
|
212
233
|
|
213
234
|
__tablename__ = "roles_x_permissions"
|
214
|
-
__table_args__ = (
|
215
|
-
UniqueConstraint("role_id", "permission_id", name="_role_permission_uc"),
|
216
|
-
)
|
217
235
|
|
218
|
-
role_id: Mapped[int] = mapped_column(ForeignKey("roles.id"))
|
219
|
-
permission_id: Mapped[int] = mapped_column(
|
220
|
-
|
221
|
-
role: Mapped["Role"] = relationship(
|
222
|
-
back_populates="role_x_permission", lazy="joined"
|
223
|
-
)
|
224
|
-
permissions: Mapped[List["Permission"]] = relationship(
|
225
|
-
back_populates="role_x_permission", lazy="joined"
|
236
|
+
role_id: Mapped[int] = mapped_column(ForeignKey("roles.id"), primary_key=True)
|
237
|
+
permission_id: Mapped[int] = mapped_column(
|
238
|
+
ForeignKey("permissions.id"), primary_key=True
|
226
239
|
)
|
227
240
|
|
228
241
|
|
@@ -234,27 +247,13 @@ class Role_x_User_x_Org(Base):
|
|
234
247
|
role_id (int): The ID of the associated role.
|
235
248
|
user_id (int): The ID of the associated user.
|
236
249
|
org_id (int): The ID of the associated organization.
|
237
|
-
role (Role): The role associated with this relationship.
|
238
|
-
user (User): The user associated with this relationship.
|
239
|
-
org (Org): The organization associated with this relationship.
|
240
250
|
"""
|
241
251
|
|
242
252
|
__tablename__ = "roles_x_users_x_org"
|
243
|
-
__table_args__ = (
|
244
|
-
UniqueConstraint("role_id", "user_id", "org_id", name="_role_user_org_uc"),
|
245
|
-
)
|
246
|
-
|
247
|
-
role_id: Mapped[int] = mapped_column(ForeignKey("roles.id"))
|
248
|
-
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
249
|
-
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
250
253
|
|
251
|
-
|
252
|
-
|
253
|
-
)
|
254
|
-
user: Mapped["User"] = relationship(
|
255
|
-
back_populates="role_x_user_x_org", lazy="joined"
|
256
|
-
)
|
257
|
-
org: Mapped["Org"] = relationship(back_populates="role_x_user_x_org", lazy="joined")
|
254
|
+
role_id: Mapped[int] = mapped_column(ForeignKey("roles.id"), primary_key=True)
|
255
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
256
|
+
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
|
258
257
|
|
259
258
|
|
260
259
|
class Org(Base):
|
@@ -262,6 +261,7 @@ class Org(Base):
|
|
262
261
|
Model representing an organization. The same model is used for all levels of organization (AOs, Regions, etc.).
|
263
262
|
|
264
263
|
Attributes:
|
264
|
+
id (int): Primary Key of the model.
|
265
265
|
parent_id (Optional[int]): The ID of the parent organization.
|
266
266
|
org_type_id (int): The ID of the organization type.
|
267
267
|
default_location_id (Optional[int]): The ID of the default location.
|
@@ -276,16 +276,13 @@ class Org(Base):
|
|
276
276
|
instagram (Optional[str]): The organization's Instagram handle.
|
277
277
|
last_annual_review (Optional[date]): The date of the last annual review.
|
278
278
|
meta (Optional[Dict[str, Any]]): Additional metadata for the organization.
|
279
|
-
|
280
|
-
|
281
|
-
locations (List[Location]): The locations associated with the organization.
|
282
|
-
event_tags (List[EventTag]): The event tags associated with the organization.
|
283
|
-
event_types (List[EventType]): The event types associated with the organization.
|
284
|
-
events (List[Event]): The events associated with the organization.
|
279
|
+
created (datetime): The timestamp when the record was created.
|
280
|
+
updated (datetime): The timestamp when the record was last updated.
|
285
281
|
"""
|
286
282
|
|
287
283
|
__tablename__ = "orgs"
|
288
284
|
|
285
|
+
id: Mapped[intpk]
|
289
286
|
parent_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
|
290
287
|
org_type_id: Mapped[int] = mapped_column(ForeignKey("org_types.id"))
|
291
288
|
default_location_id: Mapped[Optional[int]]
|
@@ -300,23 +297,8 @@ class Org(Base):
|
|
300
297
|
instagram: Mapped[Optional[str]]
|
301
298
|
last_annual_review: Mapped[Optional[date]]
|
302
299
|
meta: Mapped[Optional[Dict[str, Any]]]
|
303
|
-
|
304
|
-
|
305
|
-
"Org", remote_side="Org.id", back_populates="child_orgs"
|
306
|
-
)
|
307
|
-
child_orgs: Mapped[List["Org"]] = relationship(
|
308
|
-
"Org", back_populates="parent_org", join_depth=3
|
309
|
-
)
|
310
|
-
locations: Mapped[List["Location"]] = relationship(
|
311
|
-
back_populates="org", lazy="joined"
|
312
|
-
)
|
313
|
-
event_tags: Mapped[List["EventTag"]] = relationship(
|
314
|
-
back_populates="org", secondary="event_tags_x_org", lazy="joined"
|
315
|
-
)
|
316
|
-
event_types: Mapped[List["EventType"]] = relationship(
|
317
|
-
back_populates="org", secondary="event_types_x_org", lazy="joined"
|
318
|
-
)
|
319
|
-
events: Mapped[List["Event"]] = relationship(back_populates="org", lazy="joined")
|
300
|
+
created: Mapped[dt_create]
|
301
|
+
updated: Mapped[dt_update]
|
320
302
|
|
321
303
|
|
322
304
|
class EventType(Base):
|
@@ -324,23 +306,24 @@ class EventType(Base):
|
|
324
306
|
Model representing an event type. Event types can be shared by regions or not, and should roll up into event categories.
|
325
307
|
|
326
308
|
Attributes:
|
309
|
+
id (int): Primary Key of the model.
|
327
310
|
name (str): The name of the event type.
|
328
311
|
description (Optional[text]): A description of the event type.
|
329
312
|
acronyms (Optional[str]): Acronyms associated with the event type.
|
330
313
|
category_id (int): The ID of the associated event category.
|
331
|
-
|
314
|
+
created (datetime): The timestamp when the record was created.
|
315
|
+
updated (datetime): The timestamp when the record was last updated.
|
332
316
|
"""
|
333
317
|
|
334
318
|
__tablename__ = "event_types"
|
335
319
|
|
320
|
+
id: Mapped[intpk]
|
336
321
|
name: Mapped[str]
|
337
322
|
description: Mapped[Optional[text]]
|
338
323
|
acronyms: Mapped[Optional[str]]
|
339
324
|
category_id: Mapped[int] = mapped_column(ForeignKey("event_categories.id"))
|
340
|
-
|
341
|
-
|
342
|
-
back_populates="event_types", lazy="joined"
|
343
|
-
)
|
325
|
+
created: Mapped[dt_create]
|
326
|
+
updated: Mapped[dt_update]
|
344
327
|
|
345
328
|
|
346
329
|
class EventType_x_Event(Base):
|
@@ -350,23 +333,13 @@ class EventType_x_Event(Base):
|
|
350
333
|
Attributes:
|
351
334
|
event_id (int): The ID of the associated event.
|
352
335
|
event_type_id (int): The ID of the associated event type.
|
353
|
-
event (Event): The event associated with this relationship.
|
354
|
-
event_type (EventType): The event type associated with this relationship.
|
355
336
|
"""
|
356
337
|
|
357
338
|
__tablename__ = "events_x_event_types"
|
358
|
-
__table_args__ = (
|
359
|
-
UniqueConstraint("event_id", "event_type_id", name="_event_event_type_uc"),
|
360
|
-
)
|
361
|
-
|
362
|
-
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"))
|
363
|
-
event_type_id: Mapped[int] = mapped_column(ForeignKey("event_types.id"))
|
364
339
|
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
event_type: Mapped["EventType"] = relationship(
|
369
|
-
back_populates="events_x_event_types", lazy="joined"
|
340
|
+
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
|
341
|
+
event_type_id: Mapped[int] = mapped_column(
|
342
|
+
ForeignKey("event_types.id"), primary_key=True
|
370
343
|
)
|
371
344
|
|
372
345
|
|
@@ -377,24 +350,16 @@ class EventType_x_Org(Base):
|
|
377
350
|
Attributes:
|
378
351
|
event_type_id (int): The ID of the associated event type.
|
379
352
|
org_id (int): The ID of the associated organization.
|
380
|
-
is_default (bool): Whether this is the default event type for the organization.
|
381
|
-
event_type (EventType): The event type associated with this relationship.
|
382
|
-
org (Org): The organization associated with this relationship.
|
353
|
+
is_default (bool): Whether this is the default event type for the organization. Default is False.
|
383
354
|
"""
|
384
355
|
|
385
356
|
__tablename__ = "event_types_x_org"
|
386
|
-
__table_args__ = (
|
387
|
-
UniqueConstraint("event_type_id", "org_id", name="_event_type_org_uc"),
|
388
|
-
)
|
389
|
-
|
390
|
-
event_type_id: Mapped[int] = mapped_column(ForeignKey("event_types.id"))
|
391
|
-
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
392
|
-
is_default: Mapped[bool]
|
393
357
|
|
394
|
-
|
395
|
-
|
358
|
+
event_type_id: Mapped[int] = mapped_column(
|
359
|
+
ForeignKey("event_types.id"), primary_key=True
|
396
360
|
)
|
397
|
-
|
361
|
+
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
|
362
|
+
is_default: Mapped[bool] = mapped_column(Boolean, default=False)
|
398
363
|
|
399
364
|
|
400
365
|
class EventTag(Base):
|
@@ -402,16 +367,22 @@ class EventTag(Base):
|
|
402
367
|
Model representing an event tag. These are used to mark special events, such as anniversaries or special workouts.
|
403
368
|
|
404
369
|
Attributes:
|
370
|
+
id (int): Primary Key of the model.
|
405
371
|
name (str): The name of the event tag.
|
406
372
|
description (Optional[text]): A description of the event tag.
|
407
373
|
color (Optional[str]): The color used for the calendar.
|
374
|
+
created (datetime): The timestamp when the record was created.
|
375
|
+
updated (datetime): The timestamp when the record was last updated.
|
408
376
|
"""
|
409
377
|
|
410
378
|
__tablename__ = "event_tags"
|
411
379
|
|
380
|
+
id: Mapped[intpk]
|
412
381
|
name: Mapped[str]
|
413
382
|
description: Mapped[Optional[text]]
|
414
383
|
color: Mapped[Optional[str]]
|
384
|
+
created: Mapped[dt_create]
|
385
|
+
updated: Mapped[dt_update]
|
415
386
|
|
416
387
|
|
417
388
|
class EventTag_x_Event(Base):
|
@@ -421,23 +392,13 @@ class EventTag_x_Event(Base):
|
|
421
392
|
Attributes:
|
422
393
|
event_id (int): The ID of the associated event.
|
423
394
|
event_tag_id (int): The ID of the associated event tag.
|
424
|
-
event (Event): The event associated with this relationship.
|
425
|
-
event_tag (EventTag): The event tag associated with this relationship.
|
426
395
|
"""
|
427
396
|
|
428
397
|
__tablename__ = "event_tags_x_events"
|
429
|
-
__table_args__ = (
|
430
|
-
UniqueConstraint("event_id", "event_tag_id", name="_event_event_tag_uc"),
|
431
|
-
)
|
432
|
-
|
433
|
-
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"))
|
434
|
-
event_tag_id: Mapped[int] = mapped_column(ForeignKey("event_tags.id"))
|
435
398
|
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
event_tag: Mapped["EventTag"] = relationship(
|
440
|
-
back_populates="event_tag_x_event", lazy="joined"
|
399
|
+
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
|
400
|
+
event_tag_id: Mapped[int] = mapped_column(
|
401
|
+
ForeignKey("event_tags.id"), primary_key=True
|
441
402
|
)
|
442
403
|
|
443
404
|
|
@@ -448,24 +409,16 @@ class EventTag_x_Org(Base):
|
|
448
409
|
Attributes:
|
449
410
|
event_tag_id (int): The ID of the associated event tag.
|
450
411
|
org_id (int): The ID of the associated organization.
|
451
|
-
color_override (Optional[str]): The color override for the event tag (if the region wants to use something other than the default).
|
452
|
-
event_tag (EventTag): The event tag associated with this relationship.
|
453
|
-
org (Org): The organization associated with this relationship.
|
412
|
+
color_override (Optional[str]): The calendar color override for the event tag (if the region wants to use something other than the default).
|
454
413
|
"""
|
455
414
|
|
456
415
|
__tablename__ = "event_tags_x_org"
|
457
|
-
__table_args__ = (
|
458
|
-
UniqueConstraint("event_tag_id", "org_id", name="_event_tag_org_uc"),
|
459
|
-
)
|
460
416
|
|
461
|
-
event_tag_id: Mapped[int] = mapped_column(
|
462
|
-
|
463
|
-
color_override: Mapped[Optional[str]]
|
464
|
-
|
465
|
-
event_tag: Mapped["EventTag"] = relationship(
|
466
|
-
back_populates="event_tag_x_org", lazy="joined"
|
417
|
+
event_tag_id: Mapped[int] = mapped_column(
|
418
|
+
ForeignKey("event_tags.id"), primary_key=True
|
467
419
|
)
|
468
|
-
|
420
|
+
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
|
421
|
+
color_override: Mapped[Optional[str]]
|
469
422
|
|
470
423
|
|
471
424
|
class Org_x_Slack(Base):
|
@@ -475,22 +428,14 @@ class Org_x_Slack(Base):
|
|
475
428
|
Attributes:
|
476
429
|
org_id (int): The ID of the associated organization.
|
477
430
|
slack_space_id (str): The ID of the associated Slack workspace.
|
478
|
-
slack_space (SlackSpace): The Slack workspace associated with this relationship.
|
479
|
-
org (Org): The organization associated with this relationship.
|
480
431
|
"""
|
481
432
|
|
482
433
|
__tablename__ = "org_x_slack"
|
483
|
-
__table_args__ = (
|
484
|
-
UniqueConstraint("org_id", "slack_space_id", name="_org_slack_uc"),
|
485
|
-
)
|
486
|
-
|
487
|
-
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
488
|
-
slack_space_id: Mapped[str] = mapped_column(ForeignKey("slack_spaces.id"))
|
489
434
|
|
490
|
-
|
491
|
-
|
435
|
+
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
|
436
|
+
slack_space_id: Mapped[str] = mapped_column(
|
437
|
+
ForeignKey("slack_spaces.id"), primary_key=True
|
492
438
|
)
|
493
|
-
org: Mapped["Org"] = relationship(back_populates="org_x_slack", lazy="joined")
|
494
439
|
|
495
440
|
|
496
441
|
class Location(Base):
|
@@ -498,6 +443,7 @@ class Location(Base):
|
|
498
443
|
Model representing a location. Locations are expected to belong to a single organization (region).
|
499
444
|
|
500
445
|
Attributes:
|
446
|
+
id (int): Primary Key of the model.
|
501
447
|
org_id (int): The ID of the associated organization.
|
502
448
|
name (str): The name of the location.
|
503
449
|
description (Optional[text]): A description of the location.
|
@@ -510,11 +456,13 @@ class Location(Base):
|
|
510
456
|
address_zip (Optional[str]): The ZIP code of the location.
|
511
457
|
address_country (Optional[str]): The country of the location.
|
512
458
|
meta (Optional[Dict[str, Any]]): Additional metadata for the location.
|
513
|
-
|
459
|
+
created (datetime): The timestamp when the record was created.
|
460
|
+
updated (datetime): The timestamp when the record was last updated.
|
514
461
|
"""
|
515
462
|
|
516
463
|
__tablename__ = "locations"
|
517
464
|
|
465
|
+
id: Mapped[intpk]
|
518
466
|
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
519
467
|
name: Mapped[str]
|
520
468
|
description: Mapped[Optional[text]]
|
@@ -527,8 +475,8 @@ class Location(Base):
|
|
527
475
|
address_zip: Mapped[Optional[str]]
|
528
476
|
address_country: Mapped[Optional[str]]
|
529
477
|
meta: Mapped[Optional[Dict[str, Any]]]
|
530
|
-
|
531
|
-
|
478
|
+
created: Mapped[dt_create]
|
479
|
+
updated: Mapped[dt_update]
|
532
480
|
|
533
481
|
|
534
482
|
class Event(Base):
|
@@ -536,6 +484,7 @@ class Event(Base):
|
|
536
484
|
Model representing an event or series; the same model is used for both with a self-referential relationship for series.
|
537
485
|
|
538
486
|
Attributes:
|
487
|
+
id (int): Primary Key of the model.
|
539
488
|
org_id (int): The ID of the associated organization.
|
540
489
|
location_id (Optional[int]): The ID of the associated location.
|
541
490
|
series_id (Optional[int]): The ID of the associated event series.
|
@@ -561,20 +510,13 @@ class Event(Base):
|
|
561
510
|
preblast_ts (Optional[float]): The Slack post timestamp of the pre-event announcement.
|
562
511
|
backblast_ts (Optional[float]): The Slack post timestamp of the post-event report.
|
563
512
|
meta (Optional[Dict[str, Any]]): Additional metadata for the event.
|
564
|
-
|
565
|
-
|
566
|
-
event_type (EventType): The event type associated with this event.
|
567
|
-
event_tag (EventTag): Any event tags associated with this event.
|
568
|
-
series (Event): The event series associated with this event.
|
569
|
-
attendance (List[Attendance]): The attendance records for this event.
|
570
|
-
event_tags_x_event (List[EventTag_x_Event]): The event tags associated with this event.
|
571
|
-
event_types_x_event (List[EventType_x_Event]): The event types associated with this event.
|
572
|
-
event_tags (List[EventTag]): The event tags associated with this event.
|
573
|
-
event_types (List[EventType]): The event types associated with this event.
|
513
|
+
created (datetime): The timestamp when the record was created.
|
514
|
+
updated (datetime): The timestamp when the record was last updated.
|
574
515
|
"""
|
575
516
|
|
576
517
|
__tablename__ = "events"
|
577
518
|
|
519
|
+
id: Mapped[intpk]
|
578
520
|
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
579
521
|
location_id: Mapped[Optional[int]] = mapped_column(ForeignKey("locations.id"))
|
580
522
|
series_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"))
|
@@ -600,30 +542,8 @@ class Event(Base):
|
|
600
542
|
preblast_ts: Mapped[Optional[float]]
|
601
543
|
backblast_ts: Mapped[Optional[float]]
|
602
544
|
meta: Mapped[Optional[Dict[str, Any]]]
|
603
|
-
|
604
|
-
|
605
|
-
location: Mapped["Location"] = relationship(back_populates="events", lazy="joined")
|
606
|
-
series: Mapped["Event"] = relationship(
|
607
|
-
back_populates="events", remote_side="Event.id", lazy="joined"
|
608
|
-
)
|
609
|
-
occurences: Mapped[List["Event"]] = relationship(
|
610
|
-
back_populates="series", lazy="joined"
|
611
|
-
)
|
612
|
-
attendance: Mapped[List["Attendance"]] = relationship(
|
613
|
-
back_populates="events", lazy="joined"
|
614
|
-
)
|
615
|
-
event_tags_x_event: Mapped[List["EventTag_x_Event"]] = relationship(
|
616
|
-
back_populates="events"
|
617
|
-
)
|
618
|
-
event_types_x_event: Mapped[List["EventType_x_Event"]] = relationship(
|
619
|
-
back_populates="events"
|
620
|
-
)
|
621
|
-
event_tags: Mapped[List["EventTag"]] = relationship(
|
622
|
-
back_populates="event", secondary="event_tags_x_event", lazy="joined"
|
623
|
-
)
|
624
|
-
event_types: Mapped[List["EventType"]] = relationship(
|
625
|
-
back_populates="event", secondary="event_types_x_event", lazy="joined"
|
626
|
-
)
|
545
|
+
created: Mapped[dt_create]
|
546
|
+
updated: Mapped[dt_update]
|
627
547
|
|
628
548
|
|
629
549
|
class AttendanceType(Base):
|
@@ -637,8 +557,11 @@ class AttendanceType(Base):
|
|
637
557
|
|
638
558
|
__tablename__ = "attendance_types"
|
639
559
|
|
560
|
+
id: Mapped[intpk]
|
640
561
|
type: Mapped[str]
|
641
562
|
description: Mapped[Optional[str]]
|
563
|
+
created: Mapped[dt_create]
|
564
|
+
updated: Mapped[dt_update]
|
642
565
|
|
643
566
|
|
644
567
|
class Attendance(Base):
|
@@ -646,33 +569,43 @@ class Attendance(Base):
|
|
646
569
|
Model representing an attendance record.
|
647
570
|
|
648
571
|
Attributes:
|
572
|
+
id (int): Primary Key of the model.
|
649
573
|
event_id (int): The ID of the associated event.
|
650
574
|
user_id (Optional[int]): The ID of the associated user.
|
651
|
-
attendance_type_id (int): The ID of the associated attendance type.
|
652
575
|
is_planned (bool): Whether this is planned attendance (True) vs actual attendance (False).
|
653
576
|
meta (Optional[Dict[str, Any]]): Additional metadata for the attendance.
|
654
|
-
|
655
|
-
|
656
|
-
attendance_type (AttendanceType): The attendance type associated with this attendance.
|
577
|
+
created (datetime): The timestamp when the record was created.
|
578
|
+
updated (datetime): The timestamp when the record was last updated.
|
657
579
|
"""
|
658
580
|
|
659
581
|
__tablename__ = "attendance"
|
660
|
-
__table_args__ = (
|
661
|
-
UniqueConstraint(
|
662
|
-
"event_id", "user_id", "is_planned", name="_event_user_planned_uc"
|
663
|
-
),
|
664
|
-
)
|
582
|
+
__table_args__ = (UniqueConstraint("event_id", "user_id", "is_planned"),)
|
665
583
|
|
584
|
+
id: Mapped[intpk]
|
666
585
|
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"))
|
667
|
-
user_id: Mapped[
|
668
|
-
attendance_type_id: Mapped[int] = mapped_column(ForeignKey("attendance_types.id"))
|
586
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
669
587
|
is_planned: Mapped[bool]
|
670
588
|
meta: Mapped[Optional[Dict[str, Any]]]
|
589
|
+
created: Mapped[dt_create]
|
590
|
+
updated: Mapped[dt_update]
|
591
|
+
|
592
|
+
|
593
|
+
class Attendance_x_AttenanceType(Base):
|
594
|
+
"""
|
595
|
+
Model representing the association between attendance and attendance types.
|
596
|
+
|
597
|
+
Attributes:
|
598
|
+
attendance_id (int): The ID of the associated attendance.
|
599
|
+
attendance_type_id (int): The ID of the associated attendance type.
|
600
|
+
"""
|
671
601
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
602
|
+
__tablename__ = "attendance_x_attendance_types"
|
603
|
+
|
604
|
+
attendance_id: Mapped[int] = mapped_column(
|
605
|
+
ForeignKey("attendance.id"), primary_key=True
|
606
|
+
)
|
607
|
+
attendance_type_id: Mapped[int] = mapped_column(
|
608
|
+
ForeignKey("attendance_types.id"), primary_key=True
|
676
609
|
)
|
677
610
|
|
678
611
|
|
@@ -681,6 +614,7 @@ class User(Base):
|
|
681
614
|
Model representing a user.
|
682
615
|
|
683
616
|
Attributes:
|
617
|
+
id (int): Primary Key of the model.
|
684
618
|
f3_name (Optional[str]): The F3 name of the user.
|
685
619
|
first_name (Optional[str]): The first name of the user.
|
686
620
|
last_name (Optional[str]): The last name of the user.
|
@@ -689,18 +623,13 @@ class User(Base):
|
|
689
623
|
home_region_id (Optional[int]): The ID of the home region.
|
690
624
|
avatar_url (Optional[str]): The URL of the user's avatar.
|
691
625
|
meta (Optional[Dict[str, Any]]): Additional metadata for the user.
|
692
|
-
|
693
|
-
|
694
|
-
slack_users (List[SlackUser]): The Slack users associated with this user.
|
695
|
-
achievements_x_user (List[Achievement_x_User]): The achievements associated with this user.
|
696
|
-
positions_x_orgs_x_users (List[Position_x_Org_x_User]): The positions associated with this user.
|
697
|
-
roles_x_users_x_org (List[Role_x_User_x_Org]): The roles associated with this user.
|
698
|
-
positions (List[Position]): The positions associated with this user.
|
699
|
-
roles (List[Role]): The roles associated with this user.
|
626
|
+
created (datetime): The timestamp when the record was created.
|
627
|
+
updated (datetime): The timestamp when the record was last updated.
|
700
628
|
"""
|
701
629
|
|
702
630
|
__tablename__ = "users"
|
703
631
|
|
632
|
+
id: Mapped[intpk]
|
704
633
|
f3_name: Mapped[Optional[str]]
|
705
634
|
first_name: Mapped[Optional[str]]
|
706
635
|
last_name: Mapped[Optional[str]]
|
@@ -709,32 +638,8 @@ class User(Base):
|
|
709
638
|
home_region_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
|
710
639
|
avatar_url: Mapped[Optional[str]]
|
711
640
|
meta: Mapped[Optional[Dict[str, Any]]]
|
712
|
-
|
713
|
-
|
714
|
-
attendance: Mapped[List["Attendance"]] = relationship(
|
715
|
-
back_populates="users", lazy="joined"
|
716
|
-
)
|
717
|
-
slack_users: Mapped[List["SlackUser"]] = relationship(
|
718
|
-
back_populates="users", lazy="joined"
|
719
|
-
)
|
720
|
-
achievements_x_user: Mapped[List["Achievement_x_User"]] = relationship(
|
721
|
-
back_populates="user"
|
722
|
-
)
|
723
|
-
positions_x_orgs_x_users: Mapped[List["Position_x_Org_x_User"]] = relationship(
|
724
|
-
back_populates="user"
|
725
|
-
)
|
726
|
-
roles_x_users_x_org: Mapped[List["Role_x_User_x_Org"]] = relationship(
|
727
|
-
back_populates="user"
|
728
|
-
)
|
729
|
-
achievements: Mapped[List["Achievement"]] = relationship(
|
730
|
-
back_populates="user", secondary="achievements_x_users", lazy="joined"
|
731
|
-
)
|
732
|
-
positions: Mapped[List["Position"]] = relationship(
|
733
|
-
back_populates="user", secondary="positions_x_orgs_x_users", lazy="joined"
|
734
|
-
)
|
735
|
-
roles: Mapped[List["Role"]] = relationship(
|
736
|
-
back_populates="user", secondary="roles_x_users_x_org", lazy="joined"
|
737
|
-
)
|
641
|
+
created: Mapped[dt_create]
|
642
|
+
updated: Mapped[dt_update]
|
738
643
|
|
739
644
|
|
740
645
|
class SlackUser(Base):
|
@@ -742,6 +647,7 @@ class SlackUser(Base):
|
|
742
647
|
Model representing a Slack user.
|
743
648
|
|
744
649
|
Attributes:
|
650
|
+
id (int): Primary Key of the model.
|
745
651
|
slack_id (str): The Slack ID of the user.
|
746
652
|
user_name (str): The username of the Slack user.
|
747
653
|
email (str): The email of the Slack user.
|
@@ -757,12 +663,13 @@ class SlackUser(Base):
|
|
757
663
|
strava_athlete_id (Optional[int]): The Strava athlete ID of the user.
|
758
664
|
meta (Optional[Dict[str, Any]]): Additional metadata for the Slack user.
|
759
665
|
slack_updated (Optional[datetime]): The last update time of the Slack user.
|
760
|
-
|
761
|
-
|
666
|
+
created (datetime): The timestamp when the record was created.
|
667
|
+
updated (datetime): The timestamp when the record was last updated.
|
762
668
|
"""
|
763
669
|
|
764
670
|
__tablename__ = "slack_users"
|
765
671
|
|
672
|
+
id: Mapped[intpk]
|
766
673
|
slack_id: Mapped[str]
|
767
674
|
user_name: Mapped[str]
|
768
675
|
email: Mapped[str]
|
@@ -778,11 +685,8 @@ class SlackUser(Base):
|
|
778
685
|
strava_athlete_id: Mapped[Optional[int]]
|
779
686
|
meta: Mapped[Optional[Dict[str, Any]]]
|
780
687
|
slack_updated: Mapped[Optional[datetime]]
|
781
|
-
|
782
|
-
|
783
|
-
back_populates="slack_users", lazy="joined"
|
784
|
-
)
|
785
|
-
user: Mapped["User"] = relationship(back_populates="slack_users", lazy="joined")
|
688
|
+
created: Mapped[dt_create]
|
689
|
+
updated: Mapped[dt_update]
|
786
690
|
|
787
691
|
|
788
692
|
class Achievement(Base):
|
@@ -790,18 +694,24 @@ class Achievement(Base):
|
|
790
694
|
Model representing an achievement.
|
791
695
|
|
792
696
|
Attributes:
|
697
|
+
id (int): Primary Key of the model.
|
793
698
|
name (str): The name of the achievement.
|
794
699
|
description (Optional[str]): A description of the achievement.
|
795
700
|
verb (str): The verb associated with the achievement.
|
796
701
|
image_url (Optional[str]): The URL of the achievement's image.
|
702
|
+
created (datetime): The timestamp when the record was created.
|
703
|
+
updated (datetime): The timestamp when the record was last updated.
|
797
704
|
"""
|
798
705
|
|
799
706
|
__tablename__ = "achievements"
|
800
707
|
|
708
|
+
id: Mapped[intpk]
|
801
709
|
name: Mapped[str]
|
802
710
|
description: Mapped[Optional[str]]
|
803
711
|
verb: Mapped[str]
|
804
712
|
image_url: Mapped[Optional[str]]
|
713
|
+
created: Mapped[dt_create]
|
714
|
+
updated: Mapped[dt_update]
|
805
715
|
|
806
716
|
|
807
717
|
class Achievement_x_User(Base):
|
@@ -811,25 +721,17 @@ class Achievement_x_User(Base):
|
|
811
721
|
Attributes:
|
812
722
|
achievement_id (int): The ID of the associated achievement.
|
813
723
|
user_id (int): The ID of the associated user.
|
814
|
-
date_awarded (date): The date the achievement was awarded.
|
815
|
-
achievement (Achievement): The achievement associated with this relationship.
|
816
|
-
user (User): The user associated with this relationship.
|
724
|
+
date_awarded (date): The date the achievement was awarded. Default is the current date.
|
817
725
|
"""
|
818
726
|
|
819
727
|
__tablename__ = "achievements_x_users"
|
820
|
-
__table_args__ = (
|
821
|
-
UniqueConstraint("achievement_id", "user_id", name="_achievement_user_uc"),
|
822
|
-
)
|
823
728
|
|
824
|
-
achievement_id: Mapped[int] = mapped_column(
|
825
|
-
|
826
|
-
date_awarded: Mapped[date]
|
827
|
-
|
828
|
-
achievement: Mapped["Achievement"] = relationship(
|
829
|
-
back_populates="achievement_x_user", lazy="joined"
|
729
|
+
achievement_id: Mapped[int] = mapped_column(
|
730
|
+
ForeignKey("achievements.id"), primary_key=True
|
830
731
|
)
|
831
|
-
|
832
|
-
|
732
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
733
|
+
date_awarded: Mapped[date] = mapped_column(
|
734
|
+
DateTime, server_default=func.timezone("utc", func.now())
|
833
735
|
)
|
834
736
|
|
835
737
|
|
@@ -840,22 +742,14 @@ class Achievement_x_Org(Base):
|
|
840
742
|
Attributes:
|
841
743
|
achievement_id (int): The ID of the associated achievement.
|
842
744
|
org_id (int): The ID of the associated organization.
|
843
|
-
achievement (Achievement): The achievement associated with this relationship.
|
844
|
-
org (Org): The organization associated with this relationship.
|
845
745
|
"""
|
846
746
|
|
847
747
|
__tablename__ = "achievements_x_org"
|
848
|
-
__table_args__ = (
|
849
|
-
UniqueConstraint("achievement_id", "org_id", name="_achievement_org_uc"),
|
850
|
-
)
|
851
748
|
|
852
|
-
achievement_id: Mapped[int] = mapped_column(
|
853
|
-
|
854
|
-
|
855
|
-
achievement: Mapped["Achievement"] = relationship(
|
856
|
-
back_populates="achievement_x_org", lazy="joined"
|
749
|
+
achievement_id: Mapped[int] = mapped_column(
|
750
|
+
ForeignKey("achievements.id"), primary_key=True
|
857
751
|
)
|
858
|
-
|
752
|
+
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
|
859
753
|
|
860
754
|
|
861
755
|
class Position(Base):
|
@@ -871,10 +765,13 @@ class Position(Base):
|
|
871
765
|
|
872
766
|
__tablename__ = "positions"
|
873
767
|
|
768
|
+
id: Mapped[intpk]
|
874
769
|
name: Mapped[str]
|
875
770
|
description: Mapped[Optional[str]]
|
876
771
|
org_type_id: Mapped[Optional[int]] = mapped_column(ForeignKey("org_types.id"))
|
877
772
|
org_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
|
773
|
+
created: Mapped[dt_create]
|
774
|
+
updated: Mapped[dt_update]
|
878
775
|
|
879
776
|
|
880
777
|
class Position_x_Org_x_User(Base):
|
@@ -885,31 +782,15 @@ class Position_x_Org_x_User(Base):
|
|
885
782
|
position_id (int): The ID of the associated position.
|
886
783
|
org_id (int): The ID of the associated organization.
|
887
784
|
user_id (int): The ID of the associated user.
|
888
|
-
position (Position): The position associated with this relationship.
|
889
|
-
org (Org): The organization associated with this relationship.
|
890
|
-
user (User): The user associated with this relationship.
|
891
785
|
"""
|
892
786
|
|
893
787
|
__tablename__ = "positions_x_orgs_x_users"
|
894
|
-
__table_args__ = (
|
895
|
-
UniqueConstraint(
|
896
|
-
"position_id", "user_id", "org_id", name="_position_user_org_uc"
|
897
|
-
),
|
898
|
-
)
|
899
788
|
|
900
|
-
position_id: Mapped[int] = mapped_column(
|
901
|
-
|
902
|
-
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
903
|
-
|
904
|
-
position: Mapped["Position"] = relationship(
|
905
|
-
back_populates="position_x_org_x_user", lazy="joined"
|
906
|
-
)
|
907
|
-
org: Mapped["Org"] = relationship(
|
908
|
-
back_populates="position_x_org_x_user", lazy="joined"
|
909
|
-
)
|
910
|
-
user: Mapped["User"] = relationship(
|
911
|
-
back_populates="position_x_org_x_user", lazy="joined"
|
789
|
+
position_id: Mapped[int] = mapped_column(
|
790
|
+
ForeignKey("positions.id"), primary_key=True
|
912
791
|
)
|
792
|
+
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
|
793
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
913
794
|
|
914
795
|
|
915
796
|
class Expansion(Base):
|
@@ -917,22 +798,28 @@ class Expansion(Base):
|
|
917
798
|
Model representing an expansion.
|
918
799
|
|
919
800
|
Attributes:
|
801
|
+
id (int): Primary Key of the model.
|
920
802
|
area (str): The area of the expansion.
|
921
803
|
pinned_lat (float): The pinned latitude of the expansion.
|
922
804
|
pinned_lon (float): The pinned longitude of the expansion.
|
923
805
|
user_lat (float): The user's latitude.
|
924
806
|
user_lon (float): The user's longitude.
|
925
807
|
interested_in_organizing (bool): Whether the user is interested in organizing.
|
808
|
+
created (datetime): The timestamp when the record was created.
|
809
|
+
updated (datetime): The timestamp when the record was last updated.
|
926
810
|
"""
|
927
811
|
|
928
812
|
__tablename__ = "expansions"
|
929
813
|
|
814
|
+
id: Mapped[intpk]
|
930
815
|
area: Mapped[str]
|
931
816
|
pinned_lat: Mapped[float]
|
932
817
|
pinned_lon: Mapped[float]
|
933
818
|
user_lat: Mapped[float]
|
934
819
|
user_lon: Mapped[float]
|
935
820
|
interested_in_organizing: Mapped[bool]
|
821
|
+
created: Mapped[dt_create]
|
822
|
+
updated: Mapped[dt_update]
|
936
823
|
|
937
824
|
|
938
825
|
class Expansion_x_User(Base):
|
@@ -942,25 +829,65 @@ class Expansion_x_User(Base):
|
|
942
829
|
Attributes:
|
943
830
|
expansion_id (int): The ID of the associated expansion.
|
944
831
|
user_id (int): The ID of the associated user.
|
945
|
-
|
832
|
+
requst_date (date): The date of the request. Default is the current date.
|
946
833
|
notes (Optional[text]): Additional notes for the association.
|
947
|
-
expansion (Expansion): The expansion associated with this relationship.
|
948
|
-
user (User): The user associated with this relationship.
|
949
834
|
"""
|
950
835
|
|
951
836
|
__tablename__ = "expansions_x_users"
|
952
|
-
__table_args__ = (
|
953
|
-
UniqueConstraint("expansion_id", "user_id", name="_expansion_user_uc"),
|
954
|
-
)
|
955
|
-
|
956
|
-
expansion_id: Mapped[int] = mapped_column(ForeignKey("expansions.id"))
|
957
|
-
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
958
|
-
date: Mapped[date]
|
959
|
-
notes: Mapped[Optional[text]]
|
960
837
|
|
961
|
-
|
962
|
-
|
838
|
+
expansion_id: Mapped[int] = mapped_column(
|
839
|
+
ForeignKey("expansions.id"), primary_key=True
|
963
840
|
)
|
964
|
-
|
965
|
-
|
841
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
842
|
+
request_date: Mapped[date] = mapped_column(
|
843
|
+
DateTime, server_default=func.timezone("utc", func.now())
|
966
844
|
)
|
845
|
+
notes: Mapped[Optional[text]]
|
846
|
+
|
847
|
+
|
848
|
+
class MagicLinkAuthRecord(Base):
|
849
|
+
"""
|
850
|
+
Model representing a Magic Link Auth Record.
|
851
|
+
|
852
|
+
Attributes:
|
853
|
+
id (int): Primary Key of the model.
|
854
|
+
email (str): The email of the user.
|
855
|
+
otp_hash (bytes): The hash of the OTP.
|
856
|
+
created (datetime): The timestamp when the record was created.
|
857
|
+
expiration (datetime): The timestamp when the record expires.
|
858
|
+
client_ip (str): The client IP address.
|
859
|
+
recent_attempts (int): The number of recent attempts.
|
860
|
+
"""
|
861
|
+
|
862
|
+
__tablename__ = "magiclinkauthrecord"
|
863
|
+
|
864
|
+
id: Mapped[intpk]
|
865
|
+
email: Mapped[str]
|
866
|
+
otp_hash: Mapped[bytes]
|
867
|
+
created: Mapped[dt_create]
|
868
|
+
expiration: Mapped[dt_create]
|
869
|
+
client_ip: Mapped[str]
|
870
|
+
recent_attempts: Mapped[int]
|
871
|
+
|
872
|
+
|
873
|
+
class MagicLinkAuthSession(Base):
|
874
|
+
"""
|
875
|
+
Model representing a Magic Link Auth Session.
|
876
|
+
|
877
|
+
Attributes:
|
878
|
+
id (int): Primary Key of the model.
|
879
|
+
email (str): The email of the user.
|
880
|
+
persistent_id (str): The persistent ID.
|
881
|
+
session_token (str): The session token.
|
882
|
+
created (datetime): The timestamp when the record was created.
|
883
|
+
expiration (datetime): The timestamp when the record expires.
|
884
|
+
"""
|
885
|
+
|
886
|
+
__tablename__ = "magiclinkauthsession"
|
887
|
+
|
888
|
+
id: Mapped[intpk]
|
889
|
+
email: Mapped[str]
|
890
|
+
persistent_id: Mapped[str]
|
891
|
+
session_token: Mapped[str]
|
892
|
+
created: Mapped[dt_create]
|
893
|
+
expiration: Mapped[dt_create]
|
@@ -0,0 +1,6 @@
|
|
1
|
+
f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
f3_data_models/models.py,sha256=rS9xOfv2V5XNRJP8RDQUddSicF6pasf-lT1IHez2wXo,31940
|
3
|
+
f3_data_models/utils.py,sha256=oCxwNORr0-5l0ZugxMYLmKIbmcec-4HEdTSC1pRMoew,8002
|
4
|
+
f3_data_models-0.1.6.dist-info/METADATA,sha256=UN1Qgq5Z14VmK-fuYvETmOx1HG4UOK-SU1LiuXH5xdU,2361
|
5
|
+
f3_data_models-0.1.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
6
|
+
f3_data_models-0.1.6.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
f3_data_models/models.py,sha256=RV2qCarx2c3Mhun0Tmfb5u5pX7BU9SjqKvmfPmW7Mog,37057
|
3
|
-
f3_data_models/utils.py,sha256=oCxwNORr0-5l0ZugxMYLmKIbmcec-4HEdTSC1pRMoew,8002
|
4
|
-
f3_data_models-0.1.4.dist-info/METADATA,sha256=4JC5_JuICX2wdMM4W6Jp9qmUhJASzmvGhWrA0dQcPas,2361
|
5
|
-
f3_data_models-0.1.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
6
|
-
f3_data_models-0.1.4.dist-info/RECORD,,
|
File without changes
|