f3-data-models 0.2.5__tar.gz → 0.3.0__tar.gz
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-0.2.5 → f3_data_models-0.3.0}/PKG-INFO +4 -2
- {f3_data_models-0.2.5 → f3_data_models-0.3.0}/README.md +2 -1
- {f3_data_models-0.2.5 → f3_data_models-0.3.0}/f3_data_models/models.py +223 -37
- {f3_data_models-0.2.5 → f3_data_models-0.3.0}/pyproject.toml +2 -1
- {f3_data_models-0.2.5 → f3_data_models-0.3.0}/f3_data_models/__init__.py +0 -0
- {f3_data_models-0.2.5 → f3_data_models-0.3.0}/f3_data_models/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: f3-data-models
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: The data schema and models for F3 Nation applications.
|
5
5
|
License: MIT
|
6
6
|
Author: Evan Petzoldt
|
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
13
13
|
Requires-Dist: alembic (>=1.14.0,<2.0.0)
|
14
|
+
Requires-Dist: alembic-postgresql-enum (>=1.6.1,<2.0.0)
|
14
15
|
Requires-Dist: cloud-sql-python-connector (>=1.13.0,<2.0.0)
|
15
16
|
Requires-Dist: graphviz (>=0.20.3,<0.21.0)
|
16
17
|
Requires-Dist: pg8000 (>=1.31.2,<2.0.0)
|
@@ -68,7 +69,8 @@ poetry version patch[minor][major]
|
|
68
69
|
git tag <new_version> -a -m "Your message here"
|
69
70
|
git push origin --tags
|
70
71
|
```
|
71
|
-
> [!NOTE]
|
72
|
+
> [!NOTE]
|
73
|
+
> The github pages documentation will be updated when you push to `main`, but if you would like to preview locally, run:
|
72
74
|
|
73
75
|
```sh
|
74
76
|
poetry run sphinx-build -b html docs docs/_build/html
|
@@ -40,7 +40,8 @@ poetry version patch[minor][major]
|
|
40
40
|
git tag <new_version> -a -m "Your message here"
|
41
41
|
git push origin --tags
|
42
42
|
```
|
43
|
-
> [!NOTE]
|
43
|
+
> [!NOTE]
|
44
|
+
> The github pages documentation will be updated when you push to `main`, but if you would like to preview locally, run:
|
44
45
|
|
45
46
|
```sh
|
46
47
|
poetry run sphinx-build -b html docs docs/_build/html
|
@@ -1,16 +1,22 @@
|
|
1
1
|
from datetime import datetime, date, time
|
2
2
|
from typing import Any, Dict, List, Optional
|
3
|
+
import uuid
|
3
4
|
from sqlalchemy import (
|
5
|
+
ARRAY,
|
4
6
|
JSON,
|
5
7
|
TEXT,
|
6
8
|
TIME,
|
9
|
+
UUID,
|
7
10
|
VARCHAR,
|
8
11
|
Boolean,
|
9
12
|
DateTime,
|
13
|
+
Float,
|
10
14
|
ForeignKey,
|
11
15
|
Integer,
|
12
16
|
func,
|
13
17
|
UniqueConstraint,
|
18
|
+
Enum,
|
19
|
+
Uuid,
|
14
20
|
)
|
15
21
|
from typing_extensions import Annotated
|
16
22
|
from sqlalchemy.orm import (
|
@@ -19,9 +25,11 @@ from sqlalchemy.orm import (
|
|
19
25
|
Mapped,
|
20
26
|
relationship,
|
21
27
|
)
|
28
|
+
import enum
|
22
29
|
|
23
30
|
# Custom Annotations
|
24
|
-
time_notz = Annotated[time, TIME]
|
31
|
+
time_notz = Annotated[time, TIME(timezone=False)]
|
32
|
+
time_with_tz = Annotated[time, TIME(timezone=True)]
|
25
33
|
text = Annotated[str, TEXT]
|
26
34
|
intpk = Annotated[int, mapped_column(Integer, primary_key=True, autoincrement=True)]
|
27
35
|
dt_create = Annotated[
|
@@ -37,6 +45,30 @@ dt_update = Annotated[
|
|
37
45
|
]
|
38
46
|
|
39
47
|
|
48
|
+
class UserStatus(enum.Enum):
|
49
|
+
active = 1
|
50
|
+
inactive = 2
|
51
|
+
deleted = 3
|
52
|
+
|
53
|
+
|
54
|
+
class RegionRole(enum.Enum):
|
55
|
+
user = 1
|
56
|
+
editor = 2
|
57
|
+
admin = 3
|
58
|
+
|
59
|
+
|
60
|
+
class UserRole(enum.Enum):
|
61
|
+
user = 1
|
62
|
+
editor = 2
|
63
|
+
admin = 3
|
64
|
+
|
65
|
+
|
66
|
+
class UpdateRequestStatus(enum.Enum):
|
67
|
+
pending = 1
|
68
|
+
approved = 2
|
69
|
+
rejected = 3
|
70
|
+
|
71
|
+
|
40
72
|
class Base(DeclarativeBase):
|
41
73
|
"""
|
42
74
|
Base class for all models, providing common methods.
|
@@ -187,7 +219,7 @@ class Role(Base):
|
|
187
219
|
|
188
220
|
Attributes:
|
189
221
|
id (int): Primary Key of the model.
|
190
|
-
name (
|
222
|
+
name (RegionRole): The name of the role.
|
191
223
|
description (Optional[text]): A description of the role.
|
192
224
|
created (datetime): The timestamp when the record was created.
|
193
225
|
updated (datetime): The timestamp when the record was last updated.
|
@@ -196,7 +228,7 @@ class Role(Base):
|
|
196
228
|
__tablename__ = "roles"
|
197
229
|
|
198
230
|
id: Mapped[intpk]
|
199
|
-
name: Mapped[
|
231
|
+
name: Mapped[RegionRole]
|
200
232
|
description: Mapped[Optional[text]]
|
201
233
|
created: Mapped[dt_create]
|
202
234
|
updated: Mapped[dt_update]
|
@@ -541,8 +573,8 @@ class Event(Base):
|
|
541
573
|
highlight (bool): Whether the event is highlighted. Default is False.
|
542
574
|
start_date (date): The start date of the event.
|
543
575
|
end_date (Optional[date]): The end date of the event.
|
544
|
-
start_time (Optional[
|
545
|
-
end_time (Optional[
|
576
|
+
start_time (Optional[time_with_tz]): The start time of the event.
|
577
|
+
end_time (Optional[time_with_tz]): The end time of the event.
|
546
578
|
day_of_week (Optional[int]): The day of the week of the event. (0=Monday, 6=Sunday)
|
547
579
|
name (str): The name of the event.
|
548
580
|
description (Optional[text]): A description of the event.
|
@@ -581,8 +613,8 @@ class Event(Base):
|
|
581
613
|
highlight: Mapped[bool] = mapped_column(Boolean, default=False)
|
582
614
|
start_date: Mapped[date]
|
583
615
|
end_date: Mapped[Optional[date]]
|
584
|
-
start_time: Mapped[Optional[
|
585
|
-
end_time: Mapped[Optional[
|
616
|
+
start_time: Mapped[Optional[time_with_tz]]
|
617
|
+
end_time: Mapped[Optional[time_with_tz]]
|
586
618
|
day_of_week: Mapped[Optional[int]]
|
587
619
|
name: Mapped[str]
|
588
620
|
description: Mapped[Optional[text]]
|
@@ -680,7 +712,8 @@ class User(Base):
|
|
680
712
|
home_region_id (Optional[int]): The ID of the home region.
|
681
713
|
avatar_url (Optional[str]): The URL of the user's avatar.
|
682
714
|
meta (Optional[Dict[str, Any]]): Additional metadata for the user.
|
683
|
-
|
715
|
+
email_verified (Optional[datetime]): The timestamp when the user's email was verified.
|
716
|
+
status (UserStatus): The status of the user. Default is 'active'.
|
684
717
|
created (datetime): The timestamp when the record was created.
|
685
718
|
updated (datetime): The timestamp when the record was last updated.
|
686
719
|
"""
|
@@ -699,7 +732,11 @@ class User(Base):
|
|
699
732
|
home_region_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
|
700
733
|
avatar_url: Mapped[Optional[str]]
|
701
734
|
meta: Mapped[Optional[Dict[str, Any]]]
|
702
|
-
|
735
|
+
email_verified: Mapped[Optional[datetime]]
|
736
|
+
status: Mapped[UserStatus] = mapped_column(
|
737
|
+
Enum(UserStatus), default=UserStatus.active
|
738
|
+
)
|
739
|
+
role: Mapped[UserRole] = mapped_column(Enum(UserRole), default=UserRole.user)
|
703
740
|
created: Mapped[dt_create]
|
704
741
|
updated: Mapped[dt_update]
|
705
742
|
|
@@ -956,38 +993,187 @@ class Expansion_x_User(Base):
|
|
956
993
|
notes: Mapped[Optional[text]]
|
957
994
|
|
958
995
|
|
959
|
-
|
960
|
-
|
961
|
-
|
996
|
+
class NextAuthAccount(Base):
|
997
|
+
"""
|
998
|
+
Model representing an authentication account.
|
962
999
|
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
1000
|
+
Attributes:
|
1001
|
+
user_id (int): The ID of the associated user.
|
1002
|
+
type (text): The type of the account.
|
1003
|
+
provider (text): The provider of the account.
|
1004
|
+
provider_account_id (text): The provider account ID.
|
1005
|
+
refresh_token (Optional[text]): The refresh token.
|
1006
|
+
access_token (text): The access token.
|
1007
|
+
expires_at (Optional[datetime]): The expiration time of the token.
|
1008
|
+
token_type (Optional[text]): The token type.
|
1009
|
+
scope (Optional[text]): The scope of the token.
|
1010
|
+
id_token (Optional[text]): The ID token.
|
1011
|
+
session_state (Optional[text]): The session state.
|
1012
|
+
created (datetime): The timestamp when the record was created.
|
1013
|
+
updated (datetime): The timestamp when the record was last updated.
|
1014
|
+
"""
|
967
1015
|
|
968
|
-
|
1016
|
+
__tablename__ = "auth_accounts"
|
969
1017
|
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
1018
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
1019
|
+
type: Mapped[text] # need adapter account_type?
|
1020
|
+
provider: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
|
1021
|
+
provider_account_id: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
|
1022
|
+
refresh_token: Mapped[Optional[text]]
|
1023
|
+
access_token: Mapped[text]
|
1024
|
+
expires_at: Mapped[Optional[datetime]]
|
1025
|
+
token_type: Mapped[Optional[text]]
|
1026
|
+
scope: Mapped[Optional[text]]
|
1027
|
+
id_token: Mapped[Optional[text]]
|
1028
|
+
session_state: Mapped[Optional[text]]
|
1029
|
+
created: Mapped[dt_create]
|
1030
|
+
updated: Mapped[dt_update]
|
974
1031
|
|
975
|
-
# class SlackSpaceLog(Base):
|
976
|
-
# """
|
977
|
-
# Model representing a log of Slack space events.
|
978
1032
|
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
1033
|
+
class NextAuthSession(Base):
|
1034
|
+
"""
|
1035
|
+
Model representing an authentication session.
|
1036
|
+
|
1037
|
+
Attributes:
|
1038
|
+
session_token (text): The session token.
|
1039
|
+
user_id (int): The ID of the associated user.
|
1040
|
+
expires (date): The expiration time of the session.
|
1041
|
+
created (datetime): The timestamp when the record was created.
|
1042
|
+
updated (datetime): The timestamp when the record was last updated.
|
1043
|
+
"""
|
986
1044
|
|
987
|
-
|
1045
|
+
__tablename__ = "auth_sessions"
|
988
1046
|
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
1047
|
+
session_token: Mapped[text] = mapped_column(TEXT, primary_key=True)
|
1048
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
1049
|
+
expires: Mapped[date]
|
1050
|
+
created: Mapped[dt_create]
|
1051
|
+
updated: Mapped[dt_update]
|
1052
|
+
|
1053
|
+
|
1054
|
+
class NextAuthVerificationToken(Base):
|
1055
|
+
"""
|
1056
|
+
Model representing an authentication verification token.
|
1057
|
+
|
1058
|
+
Attributes:
|
1059
|
+
identifier (text): The identifier of the token.
|
1060
|
+
token (text): The token.
|
1061
|
+
expires (date): The expiration time of the token.
|
1062
|
+
created (datetime): The timestamp when the record was created.
|
1063
|
+
updated (datetime): The timestamp when the record was last updated.
|
1064
|
+
"""
|
1065
|
+
|
1066
|
+
__tablename__ = "auth_verification_tokens"
|
1067
|
+
|
1068
|
+
identifier: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
|
1069
|
+
token: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
|
1070
|
+
expires: Mapped[date]
|
1071
|
+
created: Mapped[dt_create]
|
1072
|
+
updated: Mapped[dt_update]
|
1073
|
+
|
1074
|
+
|
1075
|
+
class UpdateRequest(Base):
|
1076
|
+
"""
|
1077
|
+
Model representing an update request.
|
1078
|
+
|
1079
|
+
Attributes:
|
1080
|
+
id (UUID): The ID of the update request.
|
1081
|
+
token (UUID): The token of the update request.
|
1082
|
+
region_id (int): The ID of the associated region.
|
1083
|
+
event_id (Optional[int]): The ID of the associated event.
|
1084
|
+
event_type_ids (Optional[List[int]]): The associated event type IDs.
|
1085
|
+
event_tag (Optional[str]): The associated event tag.
|
1086
|
+
event_series_id (Optional[int]): The ID of the associated event series.
|
1087
|
+
event_is_series (Optional[bool]): Whether the event is a series.
|
1088
|
+
event_is_active (Optional[bool]): Whether the event is active.
|
1089
|
+
event_highlight (Optional[bool]): Whether the event is highlighted.
|
1090
|
+
event_start_date (Optional[date]): The start date of the event.
|
1091
|
+
event_end_date (Optional[date]): The end date of the event.
|
1092
|
+
event_start_time (Optional[time_notz]): The start time of the event.
|
1093
|
+
event_end_time (Optional[time_notz]): The end time of the event.
|
1094
|
+
event_day_of_week (Optional[int]): The day of the week of the event.
|
1095
|
+
event_name (str): The name of the event.
|
1096
|
+
event_description (Optional[text]): A description of the event.
|
1097
|
+
event_recurrence_pattern (Optional[str]): The recurrence pattern of the event.
|
1098
|
+
event_recurrence_interval (Optional[int]): The recurrence interval of the event.
|
1099
|
+
event_index_within_interval (Optional[int]): The index within the recurrence interval.
|
1100
|
+
event_meta (Optional[Dict[str, Any]]): Additional metadata for the event.
|
1101
|
+
event_contact_email (Optional[str]): The contact email of the event.
|
1102
|
+
location_name (Optional[text]): The name of the location.
|
1103
|
+
location_description (Optional[text]): A description of the location.
|
1104
|
+
location_address (Optional[text]): The address of the location.
|
1105
|
+
location_address2 (Optional[text]): The second address line of the location.
|
1106
|
+
location_city (Optional[text]): The city of the location.
|
1107
|
+
location_state (Optional[str]): The state of the location.
|
1108
|
+
location_zip (Optional[str]): The ZIP code of the location.
|
1109
|
+
location_country (Optional[str]): The country of the location.
|
1110
|
+
location_lat (Optional[float]): The latitude of the location.
|
1111
|
+
location_lng (Optional[float]): The longitude of the location.
|
1112
|
+
location_id (Optional[int]): The ID of the location.
|
1113
|
+
location_contact_email (Optional[str]): The contact email of the location.
|
1114
|
+
ao_logo (Optional[text]): The URL of the AO logo.
|
1115
|
+
submitted_by (str): The user who submitted the request.
|
1116
|
+
submitter_validated (Optional[bool]): Whether the submitter has validated the request. Default is False.
|
1117
|
+
reviewed_by (Optional[str]): The user who reviewed the request.
|
1118
|
+
reviewed_at (Optional[datetime]): The timestamp when the request was reviewed.
|
1119
|
+
status (UpdateRequestStatus): The status of the request. Default is 'pending'.
|
1120
|
+
meta (Optional[Dict[str, Any]]): Additional metadata for the request.
|
1121
|
+
created (datetime): The timestamp when the record was created.
|
1122
|
+
updated (datetime): The timestamp when the record was last updated.
|
1123
|
+
"""
|
1124
|
+
|
1125
|
+
__tablename__ = "update_requests"
|
1126
|
+
|
1127
|
+
id: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), primary_key=True)
|
1128
|
+
token: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), default=uuid.uuid4)
|
1129
|
+
region_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
1130
|
+
event_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"))
|
1131
|
+
event_type_ids: Mapped[Optional[List[int]]] = mapped_column(ARRAY(Integer))
|
1132
|
+
event_tag: Mapped[Optional[str]]
|
1133
|
+
event_series_id: Mapped[Optional[int]]
|
1134
|
+
event_is_series: Mapped[Optional[bool]]
|
1135
|
+
event_is_active: Mapped[Optional[bool]]
|
1136
|
+
event_highlight: Mapped[Optional[bool]]
|
1137
|
+
event_start_date: Mapped[Optional[date]]
|
1138
|
+
event_end_date: Mapped[Optional[date]]
|
1139
|
+
event_start_time: Mapped[Optional[time_notz]]
|
1140
|
+
event_end_time: Mapped[Optional[time_notz]]
|
1141
|
+
event_day_of_week: Mapped[Optional[str]] = mapped_column(VARCHAR(length=30))
|
1142
|
+
event_name: Mapped[str]
|
1143
|
+
event_description: Mapped[Optional[text]]
|
1144
|
+
event_recurrence_pattern: Mapped[Optional[str]] = mapped_column(VARCHAR(length=30))
|
1145
|
+
event_recurrence_interval: Mapped[Optional[int]]
|
1146
|
+
event_index_within_interval: Mapped[Optional[int]]
|
1147
|
+
event_meta: Mapped[Optional[Dict[str, Any]]]
|
1148
|
+
event_contact_email: Mapped[Optional[str]]
|
1149
|
+
|
1150
|
+
location_name: Mapped[Optional[text]]
|
1151
|
+
location_description: Mapped[Optional[text]]
|
1152
|
+
location_address: Mapped[Optional[text]]
|
1153
|
+
location_address2: Mapped[Optional[text]]
|
1154
|
+
location_city: Mapped[Optional[text]]
|
1155
|
+
location_state: Mapped[Optional[str]]
|
1156
|
+
location_zip: Mapped[Optional[str]]
|
1157
|
+
location_country: Mapped[Optional[str]]
|
1158
|
+
location_lat: Mapped[Optional[float]] = mapped_column(
|
1159
|
+
Float(precision=8, decimal_return_scale=5)
|
1160
|
+
)
|
1161
|
+
location_lng: Mapped[Optional[float]] = mapped_column(
|
1162
|
+
Float(precision=8, decimal_return_scale=5)
|
1163
|
+
)
|
1164
|
+
location_id: Mapped[Optional[int]] = mapped_column(ForeignKey("locations.id"))
|
1165
|
+
location_contact_email: Mapped[Optional[str]]
|
1166
|
+
|
1167
|
+
ao_logo: Mapped[Optional[text]]
|
1168
|
+
|
1169
|
+
submitted_by: Mapped[text]
|
1170
|
+
submitter_validated: Mapped[Optional[bool]] = mapped_column(Boolean, default=False)
|
1171
|
+
reviewed_by: Mapped[Optional[text]]
|
1172
|
+
reviewed_at: Mapped[Optional[datetime]]
|
1173
|
+
status: Mapped[UpdateRequestStatus] = mapped_column(
|
1174
|
+
Enum(UpdateRequestStatus), default=UpdateRequestStatus.pending
|
1175
|
+
)
|
1176
|
+
meta: Mapped[Optional[Dict[str, Any]]]
|
1177
|
+
|
1178
|
+
created: Mapped[dt_create]
|
1179
|
+
updated: Mapped[dt_update]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "f3-data-models"
|
3
|
-
version = "0.
|
3
|
+
version = "0.3.0"
|
4
4
|
description = "The data schema and models for F3 Nation applications."
|
5
5
|
authors = ["Evan Petzoldt <evan.petzoldt@protonmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -24,6 +24,7 @@ sphinx-rtd-theme = "^3.0.2"
|
|
24
24
|
sphinx-multiversion = "^0.2.4"
|
25
25
|
psycopg2-binary = "^2.9.10"
|
26
26
|
sqlmodel = "^0.0.22"
|
27
|
+
alembic-postgresql-enum = "^1.6.1"
|
27
28
|
|
28
29
|
|
29
30
|
[build-system]
|
File without changes
|
File without changes
|