f3-data-models 0.3.0__py3-none-any.whl → 0.3.3__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
@@ -45,30 +45,59 @@ dt_update = Annotated[
45
45
  ]
46
46
 
47
47
 
48
- class UserStatus(enum.Enum):
48
+ class User_Status(enum.Enum):
49
49
  active = 1
50
50
  inactive = 2
51
51
  deleted = 3
52
52
 
53
53
 
54
- class RegionRole(enum.Enum):
54
+ class Region_Role(enum.Enum):
55
55
  user = 1
56
56
  editor = 2
57
57
  admin = 3
58
58
 
59
59
 
60
- class UserRole(enum.Enum):
60
+ class User_Role(enum.Enum):
61
61
  user = 1
62
62
  editor = 2
63
63
  admin = 3
64
64
 
65
65
 
66
- class UpdateRequestStatus(enum.Enum):
66
+ class Update_Request_Status(enum.Enum):
67
67
  pending = 1
68
68
  approved = 2
69
69
  rejected = 3
70
70
 
71
71
 
72
+ class Day_Of_Week(enum.Enum):
73
+ monday = 0
74
+ tuesday = 1
75
+ wednesday = 2
76
+ thursday = 3
77
+ friday = 4
78
+ saturday = 5
79
+ sunday = 6
80
+
81
+
82
+ class Event_Cadence(enum.Enum):
83
+ Weekly = 1
84
+ Monthly = 2
85
+
86
+
87
+ class Org_Type(enum.Enum):
88
+ ao = 1
89
+ region = 2
90
+ area = 3
91
+ sector = 4
92
+ nation = 5
93
+
94
+
95
+ class Event_Category(enum.Enum):
96
+ first_f = 1
97
+ second_f = 2
98
+ third_f = 3
99
+
100
+
72
101
  class Base(DeclarativeBase):
73
102
  """
74
103
  Base class for all models, providing common methods.
@@ -171,55 +200,13 @@ class SlackSpace(Base):
171
200
  updated: Mapped[dt_update]
172
201
 
173
202
 
174
- class OrgType(Base):
175
- """
176
- Model representing an organization type / level. 1=AO, 2=Region, 3=Area, 4=Sector
177
-
178
- Attributes:
179
- id (int): Primary Key of the model.
180
- name (str): The name of the organization type.
181
- description (Optional[text]): A description of the organization type.
182
- created (datetime): The timestamp when the record was created.
183
- updated (datetime): The timestamp when the record was last updated.
184
- """
185
-
186
- __tablename__ = "org_types"
187
-
188
- id: Mapped[intpk]
189
- name: Mapped[str]
190
- description: Mapped[Optional[text]]
191
- created: Mapped[dt_create]
192
- updated: Mapped[dt_update]
193
-
194
-
195
- class EventCategory(Base):
196
- """
197
- Model representing an event category. These are immutable cateogies that we will define at the Nation level.
198
-
199
- Attributes:
200
- id (int): Primary Key of the model.
201
- name (str): The name of the event category.
202
- description (Optional[text]): A description of the event category.
203
- created (datetime): The timestamp when the record was created.
204
- updated (datetime): The timestamp when the record was last updated.
205
- """
206
-
207
- __tablename__ = "event_categories"
208
-
209
- id: Mapped[intpk]
210
- name: Mapped[str]
211
- description: Mapped[Optional[text]]
212
- created: Mapped[dt_create]
213
- updated: Mapped[dt_update]
214
-
215
-
216
203
  class Role(Base):
217
204
  """
218
205
  Model representing a role. A role is a set of permissions that can be assigned to users.
219
206
 
220
207
  Attributes:
221
208
  id (int): Primary Key of the model.
222
- name (RegionRole): The name of the role.
209
+ name (Region_Role): The name of the role.
223
210
  description (Optional[text]): A description of the role.
224
211
  created (datetime): The timestamp when the record was created.
225
212
  updated (datetime): The timestamp when the record was last updated.
@@ -228,7 +215,7 @@ class Role(Base):
228
215
  __tablename__ = "roles"
229
216
 
230
217
  id: Mapped[intpk]
231
- name: Mapped[RegionRole]
218
+ name: Mapped[Region_Role]
232
219
  description: Mapped[Optional[text]]
233
220
  created: Mapped[dt_create]
234
221
  updated: Mapped[dt_update]
@@ -296,7 +283,7 @@ class Org(Base):
296
283
  Attributes:
297
284
  id (int): Primary Key of the model.
298
285
  parent_id (Optional[int]): The ID of the parent organization.
299
- org_type_id (int): The ID of the organization type.
286
+ org_type (Org_Type): The type of the organization.
300
287
  default_location_id (Optional[int]): The ID of the default location.
301
288
  name (str): The name of the organization.
302
289
  description (Optional[text]): A description of the organization.
@@ -324,7 +311,7 @@ class Org(Base):
324
311
 
325
312
  id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
326
313
  parent_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
327
- org_type_id: Mapped[int] = mapped_column(ForeignKey("org_types.id"))
314
+ org_type: Mapped[Org_Type]
328
315
  default_location_id: Mapped[Optional[int]]
329
316
  name: Mapped[str]
330
317
  description: Mapped[Optional[text]]
@@ -356,7 +343,9 @@ class Org(Base):
356
343
  viewonly=True,
357
344
  )
358
345
  achievements: Mapped[Optional[List["Achievement"]]] = relationship(
359
- "Achievement", secondary="achievements_x_org", cascade="expunge"
346
+ "Achievement",
347
+ cascade="expunge",
348
+ primaryjoin="or_(Achievement.specific_org_id == Org.id, Achievement.specific_org_id.is_(None))",
360
349
  )
361
350
  parent_org: Mapped[Optional["Org"]] = relationship(
362
351
  "Org", remote_side=[id], cascade="expunge"
@@ -375,7 +364,7 @@ class EventType(Base):
375
364
  name (str): The name of the event type.
376
365
  description (Optional[text]): A description of the event type.
377
366
  acronym (Optional[str]): Acronyms associated with the event type.
378
- category_id (int): The ID of the associated event category.
367
+ event_category (Event_Category): The category of the event type (first_f, second_f, third_f).
379
368
  specific_org_id (Optional[int]): The ID of the specific organization.
380
369
  created (datetime): The timestamp when the record was created.
381
370
  updated (datetime): The timestamp when the record was last updated.
@@ -387,7 +376,7 @@ class EventType(Base):
387
376
  name: Mapped[str]
388
377
  description: Mapped[Optional[text]]
389
378
  acronym: Mapped[Optional[str]]
390
- category_id: Mapped[int] = mapped_column(ForeignKey("event_categories.id"))
379
+ event_category: Mapped[Event_Category]
391
380
  specific_org_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
392
381
  created: Mapped[dt_create]
393
382
  updated: Mapped[dt_update]
@@ -546,8 +535,12 @@ class Location(Base):
546
535
  description: Mapped[Optional[text]]
547
536
  is_active: Mapped[bool]
548
537
  email: Mapped[Optional[str]]
549
- latitude: Mapped[Optional[float]]
550
- longitude: Mapped[Optional[float]]
538
+ latitude: Mapped[Optional[float]] = mapped_column(
539
+ Float(precision=8, decimal_return_scale=5)
540
+ )
541
+ longitude: Mapped[Optional[float]] = mapped_column(
542
+ Float(precision=8, decimal_return_scale=5)
543
+ )
551
544
  address_street: Mapped[Optional[str]]
552
545
  address_street2: Mapped[Optional[str]]
553
546
  address_city: Mapped[Optional[str]]
@@ -575,11 +568,11 @@ class Event(Base):
575
568
  end_date (Optional[date]): The end date of the event.
576
569
  start_time (Optional[time_with_tz]): The start time of the event.
577
570
  end_time (Optional[time_with_tz]): The end time of the event.
578
- day_of_week (Optional[int]): The day of the week of the event. (0=Monday, 6=Sunday)
571
+ day_of_week (Optional[Day_Of_Week]): The day of the week of the event.
579
572
  name (str): The name of the event.
580
573
  description (Optional[text]): A description of the event.
581
574
  email (Optional[str]): A contact email address associated with the event.
582
- recurrence_pattern (Optional[str]): The recurrence pattern of the event. Current options are 'weekly' or 'monthly'.
575
+ recurrence_pattern (Optional[Event_Cadence]): The recurrence pattern of the event. Current options are 'weekly' or 'monthly'.
583
576
  recurrence_interval (Optional[int]): The recurrence interval of the event (e.g. every 2 weeks).
584
577
  index_within_interval (Optional[int]): The index within the recurrence interval. (e.g. 2nd Tuesday of the month).
585
578
  pax_count (Optional[int]): The number of participants.
@@ -613,13 +606,13 @@ class Event(Base):
613
606
  highlight: Mapped[bool] = mapped_column(Boolean, default=False)
614
607
  start_date: Mapped[date]
615
608
  end_date: Mapped[Optional[date]]
616
- start_time: Mapped[Optional[time_with_tz]]
617
- end_time: Mapped[Optional[time_with_tz]]
618
- day_of_week: Mapped[Optional[int]]
609
+ start_time: Mapped[Optional[time_notz]]
610
+ end_time: Mapped[Optional[time_notz]]
611
+ day_of_week: Mapped[Optional[Day_Of_Week]]
619
612
  name: Mapped[str]
620
613
  description: Mapped[Optional[text]]
621
614
  email: Mapped[Optional[str]]
622
- recurrence_pattern: Mapped[Optional[str]]
615
+ recurrence_pattern: Mapped[Optional[Event_Cadence]]
623
616
  recurrence_interval: Mapped[Optional[int]]
624
617
  index_within_interval: Mapped[Optional[int]]
625
618
  pax_count: Mapped[Optional[int]]
@@ -733,10 +726,9 @@ class User(Base):
733
726
  avatar_url: Mapped[Optional[str]]
734
727
  meta: Mapped[Optional[Dict[str, Any]]]
735
728
  email_verified: Mapped[Optional[datetime]]
736
- status: Mapped[UserStatus] = mapped_column(
737
- Enum(UserStatus), default=UserStatus.active
729
+ status: Mapped[User_Status] = mapped_column(
730
+ Enum(User_Status), default=User_Status.active
738
731
  )
739
- role: Mapped[UserRole] = mapped_column(Enum(UserRole), default=UserRole.user)
740
732
  created: Mapped[dt_create]
741
733
  updated: Mapped[dt_update]
742
734
 
@@ -847,6 +839,7 @@ class Achievement(Base):
847
839
  description (Optional[str]): A description of the achievement.
848
840
  verb (str): The verb associated with the achievement.
849
841
  image_url (Optional[str]): The URL of the achievement's image.
842
+ specific_org_id (Optional[int]): The ID of the specific region if a custom achievement. If null, the achievement is available to all regions.
850
843
  created (datetime): The timestamp when the record was created.
851
844
  updated (datetime): The timestamp when the record was last updated.
852
845
  """
@@ -858,6 +851,7 @@ class Achievement(Base):
858
851
  description: Mapped[Optional[str]]
859
852
  verb: Mapped[str]
860
853
  image_url: Mapped[Optional[str]]
854
+ specific_org_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
861
855
  created: Mapped[dt_create]
862
856
  updated: Mapped[dt_update]
863
857
 
@@ -883,23 +877,6 @@ class Achievement_x_User(Base):
883
877
  )
884
878
 
885
879
 
886
- class Achievement_x_Org(Base):
887
- """
888
- Model representing the association between achievements and organizations.
889
-
890
- Attributes:
891
- achievement_id (int): The ID of the associated achievement.
892
- org_id (int): The ID of the associated organization.
893
- """
894
-
895
- __tablename__ = "achievements_x_org"
896
-
897
- achievement_id: Mapped[int] = mapped_column(
898
- ForeignKey("achievements.id"), primary_key=True
899
- )
900
- org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
901
-
902
-
903
880
  class Position(Base):
904
881
  """
905
882
  Model representing a position.
@@ -907,7 +884,7 @@ class Position(Base):
907
884
  Attributes:
908
885
  name (str): The name of the position.
909
886
  description (Optional[str]): A description of the position.
910
- org_type_id (Optional[int]): The ID of the associated organization type. This is used to limit the positions available to certain types of organizations. If null, the position is available to all organization types.
887
+ org_type (Optional[Org_Type]): The associated organization type. This is used to limit the positions available to certain types of organizations. If null, the position is available to all organization types.
911
888
  org_id (Optional[int]): The ID of the associated organization. This is used to limit the positions available to certain organizations. If null, the position is available to all organizations.
912
889
  """
913
890
 
@@ -916,7 +893,7 @@ class Position(Base):
916
893
  id: Mapped[intpk]
917
894
  name: Mapped[str]
918
895
  description: Mapped[Optional[str]]
919
- org_type_id: Mapped[Optional[int]] = mapped_column(ForeignKey("org_types.id"))
896
+ org_type: Mapped[Optional[Org_Type]]
920
897
  org_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
921
898
  created: Mapped[dt_create]
922
899
  updated: Mapped[dt_update]
@@ -1091,7 +1068,7 @@ class UpdateRequest(Base):
1091
1068
  event_end_date (Optional[date]): The end date of the event.
1092
1069
  event_start_time (Optional[time_notz]): The start time of the event.
1093
1070
  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.
1071
+ event_day_of_week (Optional[Day_Of_Week]): The day of the week of the event.
1095
1072
  event_name (str): The name of the event.
1096
1073
  event_description (Optional[text]): A description of the event.
1097
1074
  event_recurrence_pattern (Optional[str]): The recurrence pattern of the event.
@@ -1116,7 +1093,7 @@ class UpdateRequest(Base):
1116
1093
  submitter_validated (Optional[bool]): Whether the submitter has validated the request. Default is False.
1117
1094
  reviewed_by (Optional[str]): The user who reviewed the request.
1118
1095
  reviewed_at (Optional[datetime]): The timestamp when the request was reviewed.
1119
- status (UpdateRequestStatus): The status of the request. Default is 'pending'.
1096
+ status (Update_Request_Status): The status of the request. Default is 'pending'.
1120
1097
  meta (Optional[Dict[str, Any]]): Additional metadata for the request.
1121
1098
  created (datetime): The timestamp when the record was created.
1122
1099
  updated (datetime): The timestamp when the record was last updated.
@@ -1138,7 +1115,7 @@ class UpdateRequest(Base):
1138
1115
  event_end_date: Mapped[Optional[date]]
1139
1116
  event_start_time: Mapped[Optional[time_notz]]
1140
1117
  event_end_time: Mapped[Optional[time_notz]]
1141
- event_day_of_week: Mapped[Optional[str]] = mapped_column(VARCHAR(length=30))
1118
+ event_day_of_week: Mapped[Optional[Day_Of_Week]]
1142
1119
  event_name: Mapped[str]
1143
1120
  event_description: Mapped[Optional[text]]
1144
1121
  event_recurrence_pattern: Mapped[Optional[str]] = mapped_column(VARCHAR(length=30))
@@ -1170,8 +1147,8 @@ class UpdateRequest(Base):
1170
1147
  submitter_validated: Mapped[Optional[bool]] = mapped_column(Boolean, default=False)
1171
1148
  reviewed_by: Mapped[Optional[text]]
1172
1149
  reviewed_at: Mapped[Optional[datetime]]
1173
- status: Mapped[UpdateRequestStatus] = mapped_column(
1174
- Enum(UpdateRequestStatus), default=UpdateRequestStatus.pending
1150
+ status: Mapped[Update_Request_Status] = mapped_column(
1151
+ Enum(Update_Request_Status), default=Update_Request_Status.pending
1175
1152
  )
1176
1153
  meta: Mapped[Optional[Dict[str, Any]]]
1177
1154
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: f3-data-models
3
- Version: 0.3.0
3
+ Version: 0.3.3
4
4
  Summary: The data schema and models for F3 Nation applications.
5
5
  License: MIT
6
6
  Author: Evan Petzoldt
@@ -0,0 +1,6 @@
1
+ f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ f3_data_models/models.py,sha256=KIEvVQG7QCU2pEqIwlK78dObwthKWqUPt-OCFixyeFA,44155
3
+ f3_data_models/utils.py,sha256=1hdZ2tvMiNibNZvwt0dx4PhPCw_pJGg1mG2cCvwc6CI,8857
4
+ f3_data_models-0.3.3.dist-info/METADATA,sha256=_I5kS-5h6Cbn9HXzBD7HZhXZbMRuV2ZhKjzq6nWga4g,2716
5
+ f3_data_models-0.3.3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
+ f3_data_models-0.3.3.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=JEWblYieKPFUuUUC8plPN1Z01gZKdPHiXhdNfED8avE,45307
3
- f3_data_models/utils.py,sha256=1hdZ2tvMiNibNZvwt0dx4PhPCw_pJGg1mG2cCvwc6CI,8857
4
- f3_data_models-0.3.0.dist-info/METADATA,sha256=j5uPKteAP-X1P-RqurffTB3VovKp7G_0skB-1kNZa6s,2716
5
- f3_data_models-0.3.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
- f3_data_models-0.3.0.dist-info/RECORD,,