f3-data-models 0.4.2__tar.gz → 0.4.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: f3-data-models
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: The data schema and models for F3 Nation applications.
5
5
  License: MIT
6
6
  Author: Evan Petzoldt
@@ -21,6 +21,7 @@ Requires-Dist: sphinx-autodoc-typehints (>=2.5.0,<3.0.0)
21
21
  Requires-Dist: sphinx-multiversion (>=0.2.4,<0.3.0)
22
22
  Requires-Dist: sphinx-rtd-theme (>=3.0.2,<4.0.0)
23
23
  Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0)
24
+ Requires-Dist: sqlalchemy-citext (>=1.8.0,<2.0.0)
24
25
  Requires-Dist: sqlalchemy-schemadisplay (>=2.0,<3.0)
25
26
  Requires-Dist: sqlmodel (>=0.0.22,<0.0.23)
26
27
  Project-URL: Documentation, https://github.io/F3-Nation/f3-data-models
@@ -1,5 +1,8 @@
1
- from datetime import datetime, date, time
1
+ import enum
2
+ from datetime import date, datetime, time
2
3
  from typing import Any, Dict, List, Optional
4
+
5
+ from citext import CIText
3
6
  from sqlalchemy import (
4
7
  ARRAY,
5
8
  JSON,
@@ -9,25 +12,24 @@ from sqlalchemy import (
9
12
  VARCHAR,
10
13
  Boolean,
11
14
  DateTime,
15
+ Enum,
12
16
  Float,
13
17
  ForeignKey,
14
18
  Index,
15
19
  Integer,
16
- func,
17
20
  UniqueConstraint,
18
- Enum,
19
21
  Uuid,
22
+ func,
20
23
  inspect,
21
24
  )
22
- from typing_extensions import Annotated
23
25
  from sqlalchemy.orm import (
24
26
  DeclarativeBase,
25
- mapped_column,
26
27
  Mapped,
28
+ mapped_column,
27
29
  relationship,
28
30
  )
29
31
  from sqlalchemy.orm.attributes import InstrumentedAttribute
30
- import enum
32
+ from typing_extensions import Annotated
31
33
 
32
34
  # Custom Annotations
33
35
  time_notz = Annotated[time, TIME(timezone=False)]
@@ -35,9 +37,7 @@ time_with_tz = Annotated[time, TIME(timezone=True)]
35
37
  ts_notz = Annotated[datetime, DateTime(timezone=False)]
36
38
  text = Annotated[str, TEXT]
37
39
  intpk = Annotated[int, mapped_column(Integer, primary_key=True, autoincrement=True)]
38
- dt_create = Annotated[
39
- datetime, mapped_column(DateTime, server_default=func.timezone("utc", func.now()))
40
- ]
40
+ dt_create = Annotated[datetime, mapped_column(DateTime, server_default=func.timezone("utc", func.now()))]
41
41
  dt_update = Annotated[
42
42
  datetime,
43
43
  mapped_column(
@@ -49,30 +49,70 @@ dt_update = Annotated[
49
49
 
50
50
 
51
51
  class User_Status(enum.Enum):
52
+ """
53
+ Enum representing the status of a user.
54
+
55
+ Attributes:
56
+ active
57
+ inactive
58
+ deleted
59
+ """
60
+
52
61
  active = 1
53
62
  inactive = 2
54
63
  deleted = 3
55
64
 
56
65
 
57
66
  class Region_Role(enum.Enum):
67
+ """
68
+ Enum representing the roles within a region.
69
+
70
+ Attributes:
71
+ user
72
+ editor
73
+ admin
74
+ """
75
+
58
76
  user = 1
59
77
  editor = 2
60
78
  admin = 3
61
79
 
62
80
 
63
81
  class User_Role(enum.Enum):
82
+ """
83
+ Enum representing the roles of a user.
84
+
85
+ Attributes:
86
+ user
87
+ editor
88
+ admin
89
+ """
90
+
64
91
  user = 1
65
92
  editor = 2
66
93
  admin = 3
67
94
 
68
95
 
69
96
  class Update_Request_Status(enum.Enum):
97
+ """
98
+ Enum representing the status of an update request.
99
+
100
+ Attributes:
101
+ pending
102
+ approved
103
+ rejected
104
+ """
105
+
70
106
  pending = 1
71
107
  approved = 2
72
108
  rejected = 3
73
109
 
74
110
 
75
111
  class Day_Of_Week(enum.Enum):
112
+ """
113
+ Enum representing the days of the week.
114
+ """
115
+
76
116
  monday = 0
77
117
  tuesday = 1
78
118
  wednesday = 2
@@ -83,11 +123,30 @@ class Day_Of_Week(enum.Enum):
83
123
 
84
124
 
85
125
  class Event_Cadence(enum.Enum):
126
+ """
127
+ Enum representing the cadence of an event.
128
+
129
+ Attributes:
130
+ weekly
131
+ monthly
132
+ """
133
+
86
134
  weekly = 1
87
135
  monthly = 2
88
136
 
89
137
 
90
138
  class Org_Type(enum.Enum):
139
+ """
140
+ Enum representing the type of organization.
141
+
142
+ Attributes:
143
+ ao
144
+ region
145
+ area
146
+ sector
147
+ nation
148
+ """
149
+
91
150
  ao = 1
92
151
  region = 2
93
152
  area = 3
@@ -96,12 +155,31 @@ class Org_Type(enum.Enum):
96
155
 
97
156
 
98
157
  class Event_Category(enum.Enum):
158
+ """
159
+ Enum representing the category of an event.
160
+
161
+ Attributes:
162
+ first_f
163
+ second_f
164
+ third_f
165
+ """
166
+
99
167
  first_f = 1
100
168
  second_f = 2
101
169
  third_f = 3
102
170
 
103
171
 
104
172
  class Request_Type(enum.Enum):
173
+ """
174
+ Enum representing the type of request.
175
+
176
+ Attributes:
177
+ create_location
178
+ create_event
179
+ edit
180
+ delete_event
181
+ """
182
+
105
183
  create_location = 1
106
184
  create_event = 2
107
185
  edit = 3
@@ -154,11 +232,7 @@ class Base(DeclarativeBase):
154
232
  Returns:
155
233
  dict: A dictionary representation of the model instance.
156
234
  """
157
- return {
158
- c.key: self.get(c.key)
159
- for c in self.__table__.columns
160
- if c.key not in ["created", "updated"]
161
- }
235
+ return {c.key: self.get(c.key) for c in self.__table__.columns if c.key not in ["created", "updated"]}
162
236
 
163
237
  def to_update_dict(self) -> Dict[InstrumentedAttribute, Any]:
164
238
  update_dict = {}
@@ -174,7 +248,7 @@ class Base(DeclarativeBase):
174
248
  related_value = getattr(self, rel.key)
175
249
  if related_value is not None:
176
250
  if rel.uselist:
177
- update_dict[rel] = [item for item in related_value]
251
+ update_dict[rel] = list(related_value)
178
252
  print(rel, update_dict[rel])
179
253
  else:
180
254
  update_dict[rel] = related_value
@@ -284,9 +358,7 @@ class Role_x_Permission(Base):
284
358
  __tablename__ = "roles_x_permissions"
285
359
 
286
360
  role_id: Mapped[int] = mapped_column(ForeignKey("roles.id"), primary_key=True)
287
- permission_id: Mapped[int] = mapped_column(
288
- ForeignKey("permissions.id"), primary_key=True
289
- )
361
+ permission_id: Mapped[int] = mapped_column(ForeignKey("permissions.id"), primary_key=True)
290
362
 
291
363
 
292
364
  class Role_x_User_x_Org(Base):
@@ -335,7 +407,7 @@ class Org(Base):
335
407
  achievements (Optional[List[Achievement]]): The achievements available within the organization.
336
408
  parent_org (Optional[Org]): The parent organization.
337
409
  slack_space (Optional[SlackSpace]): The associated Slack workspace.
338
- """
410
+ """ # noqa: E501
339
411
 
340
412
  __tablename__ = "orgs"
341
413
 
@@ -363,9 +435,7 @@ class Org(Base):
363
435
  Index("idx_orgs_is_active", "is_active"),
364
436
  )
365
437
 
366
- locations: Mapped[Optional[List["Location"]]] = relationship(
367
- "Location", cascade="expunge"
368
- )
438
+ locations: Mapped[Optional[List["Location"]]] = relationship("Location", cascade="expunge")
369
439
  event_types: Mapped[Optional[List["EventType"]]] = relationship(
370
440
  "EventType",
371
441
  primaryjoin="or_(EventType.specific_org_id == Org.id, EventType.specific_org_id.is_(None))",
@@ -383,9 +453,7 @@ class Org(Base):
383
453
  cascade="expunge",
384
454
  primaryjoin="or_(Achievement.specific_org_id == Org.id, Achievement.specific_org_id.is_(None))",
385
455
  )
386
- parent_org: Mapped[Optional["Org"]] = relationship(
387
- "Org", remote_side=[id], cascade="expunge"
388
- )
456
+ parent_org: Mapped[Optional["Org"]] = relationship("Org", remote_side=[id], cascade="expunge")
389
457
  slack_space: Mapped[Optional["SlackSpace"]] = relationship(
390
458
  "SlackSpace", secondary="orgs_x_slack_spaces", cascade="expunge"
391
459
  )
@@ -404,7 +472,7 @@ class EventType(Base):
404
472
  specific_org_id (Optional[int]): The ID of the specific organization.
405
473
  created (datetime): The timestamp when the record was created.
406
474
  updated (datetime): The timestamp when the record was last updated.
407
- """
475
+ """ # noqa: E501
408
476
 
409
477
  __tablename__ = "event_types"
410
478
 
@@ -427,14 +495,12 @@ class EventType_x_Event(Base):
427
495
  event_type_id (int): The ID of the associated event type.
428
496
 
429
497
  event (Event): The associated event.
430
- """
498
+ """ # noqa: E501
431
499
 
432
500
  __tablename__ = "events_x_event_types"
433
501
 
434
502
  event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
435
- event_type_id: Mapped[int] = mapped_column(
436
- ForeignKey("event_types.id"), primary_key=True
437
- )
503
+ event_type_id: Mapped[int] = mapped_column(ForeignKey("event_types.id"), primary_key=True)
438
504
  __table_args__ = (
439
505
  Index("idx_events_x_event_types_event_id", "event_id"),
440
506
  Index("idx_events_x_event_types_event_type_id", "event_type_id"),
@@ -443,25 +509,6 @@ class EventType_x_Event(Base):
443
509
  event: Mapped["Event"] = relationship(back_populates="event_x_event_types")
444
510
 
445
511
 
446
- # class EventType_x_Org(Base):
447
- # """
448
- # Model representing the association between event types and organizations. This controls which event types are available for selection at the region level, as well as default types for each AO.
449
-
450
- # Attributes:
451
- # event_type_id (int): The ID of the associated event type.
452
- # org_id (int): The ID of the associated organization.
453
- # is_default (bool): Whether this is the default event type for the organization. Default is False.
454
- # """
455
-
456
- # __tablename__ = "event_types_x_org"
457
-
458
- # event_type_id: Mapped[int] = mapped_column(
459
- # ForeignKey("event_types.id"), primary_key=True
460
- # )
461
- # org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
462
- # is_default: Mapped[bool] = mapped_column(Boolean, default=False)
463
-
464
-
465
512
  class EventTag(Base):
466
513
  """
467
514
  Model representing an event tag. These are used to mark special events, such as anniversaries or special workouts.
@@ -496,37 +543,16 @@ class EventTag_x_Event(Base):
496
543
  event_tag_id (int): The ID of the associated event tag.
497
544
 
498
545
  event (Event): The associated event.
499
- """
546
+ """ # noqa: E501
500
547
 
501
548
  __tablename__ = "event_tags_x_events"
502
549
 
503
550
  event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
504
- event_tag_id: Mapped[int] = mapped_column(
505
- ForeignKey("event_tags.id"), primary_key=True
506
- )
551
+ event_tag_id: Mapped[int] = mapped_column(ForeignKey("event_tags.id"), primary_key=True)
507
552
 
508
553
  event: Mapped["Event"] = relationship(back_populates="event_x_event_tags")
509
554
 
510
555
 
511
- # class EventTag_x_Org(Base):
512
- # """
513
- # Model representing the association between event tags and organizations. Controls which event tags are available for selection at the region level.
514
-
515
- # Attributes:
516
- # event_tag_id (int): The ID of the associated event tag.
517
- # org_id (int): The ID of the associated organization.
518
- # color_override (Optional[str]): The calendar color override for the event tag (if the region wants to use something other than the default).
519
- # """
520
-
521
- # __tablename__ = "event_tags_x_org"
522
-
523
- # event_tag_id: Mapped[int] = mapped_column(
524
- # ForeignKey("event_tags.id"), primary_key=True
525
- # )
526
- # org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
527
- # color_override: Mapped[Optional[str]]
528
-
529
-
530
556
  class Org_x_SlackSpace(Base):
531
557
  """
532
558
  Model representing the association between organizations and Slack workspaces. This is currently meant to be one to one, but theoretically could support multiple workspaces per organization.
@@ -534,14 +560,12 @@ class Org_x_SlackSpace(Base):
534
560
  Attributes:
535
561
  org_id (int): The ID of the associated organization.
536
562
  slack_space_id (str): The ID of the associated Slack workspace.
537
- """
563
+ """ # noqa: E501
538
564
 
539
565
  __tablename__ = "orgs_x_slack_spaces"
540
566
 
541
567
  org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
542
- slack_space_id: Mapped[int] = mapped_column(
543
- ForeignKey("slack_spaces.id"), primary_key=True
544
- )
568
+ slack_space_id: Mapped[int] = mapped_column(ForeignKey("slack_spaces.id"), primary_key=True)
545
569
 
546
570
 
547
571
  class Location(Base):
@@ -565,7 +589,7 @@ class Location(Base):
565
589
  meta (Optional[Dict[str, Any]]): Additional metadata for the location.
566
590
  created (datetime): The timestamp when the record was created.
567
591
  updated (datetime): The timestamp when the record was last updated.
568
- """
592
+ """ # noqa: E501
569
593
 
570
594
  __tablename__ = "locations"
571
595
 
@@ -575,12 +599,8 @@ class Location(Base):
575
599
  description: Mapped[Optional[text]]
576
600
  is_active: Mapped[bool]
577
601
  email: Mapped[Optional[str]]
578
- latitude: Mapped[Optional[float]] = mapped_column(
579
- Float(precision=8, decimal_return_scale=5)
580
- )
581
- longitude: Mapped[Optional[float]] = mapped_column(
582
- Float(precision=8, decimal_return_scale=5)
583
- )
602
+ latitude: Mapped[Optional[float]] = mapped_column(Float(precision=8, decimal_return_scale=5))
603
+ longitude: Mapped[Optional[float]] = mapped_column(Float(precision=8, decimal_return_scale=5))
584
604
  address_street: Mapped[Optional[str]]
585
605
  address_street2: Mapped[Optional[str]]
586
606
  address_city: Mapped[Optional[str]]
@@ -639,7 +659,7 @@ class Event(Base):
639
659
  event_tags (Optional[List[EventTag]]): The associated event tags.
640
660
  event_x_event_types (List[EventType_x_Event]): The association between the event and event types.
641
661
  event_x_event_tags (Optional[List[EventTag_x_Event]]): The association between the event and event tags.
642
- """
662
+ """ # noqa: E501
643
663
 
644
664
  __tablename__ = "events"
645
665
 
@@ -680,9 +700,7 @@ class Event(Base):
680
700
  )
681
701
 
682
702
  org: Mapped[Org] = relationship(innerjoin=True, cascade="expunge", viewonly=True)
683
- location: Mapped[Location] = relationship(
684
- innerjoin=True, cascade="expunge", viewonly=True
685
- )
703
+ location: Mapped[Location] = relationship(innerjoin=True, cascade="expunge", viewonly=True)
686
704
  event_types: Mapped[List[EventType]] = relationship(
687
705
  secondary="events_x_event_types",
688
706
  innerjoin=True,
@@ -698,9 +716,7 @@ class Event(Base):
698
716
  event_x_event_tags: Mapped[Optional[List[EventTag_x_Event]]] = relationship(
699
717
  back_populates="event", cascade="save-update, merge, delete"
700
718
  )
701
- attendance: Mapped[List["Attendance"]] = relationship(
702
- back_populates="event", cascade="expunge, delete"
703
- )
719
+ attendance: Mapped[List["Attendance"]] = relationship(back_populates="event", cascade="expunge, delete")
704
720
 
705
721
 
706
722
  class AttendanceType(Base):
@@ -710,7 +726,7 @@ class AttendanceType(Base):
710
726
  Attributes:
711
727
  type (str): The type of attendance.
712
728
  description (Optional[str]): A description of the attendance type.
713
- """
729
+ """ # noqa: E501
714
730
 
715
731
  __tablename__ = "attendance_types"
716
732
 
@@ -730,20 +746,14 @@ class Attendance_x_AttendanceType(Base):
730
746
  attendance_type_id (int): The ID of the associated attendance type.
731
747
 
732
748
  attendance (Attendance): The associated attendance.
733
- """
749
+ """ # noqa: E501
734
750
 
735
751
  __tablename__ = "attendance_x_attendance_types"
736
752
 
737
- attendance_id: Mapped[int] = mapped_column(
738
- ForeignKey("attendance.id"), primary_key=True
739
- )
740
- attendance_type_id: Mapped[int] = mapped_column(
741
- ForeignKey("attendance_types.id"), primary_key=True
742
- )
753
+ attendance_id: Mapped[int] = mapped_column(ForeignKey("attendance.id"), primary_key=True)
754
+ attendance_type_id: Mapped[int] = mapped_column(ForeignKey("attendance_types.id"), primary_key=True)
743
755
 
744
- attendance: Mapped["Attendance"] = relationship(
745
- back_populates="attendance_x_attendance_types"
746
- )
756
+ attendance: Mapped["Attendance"] = relationship(back_populates="attendance_x_attendance_types")
747
757
 
748
758
 
749
759
  class User(Base):
@@ -764,15 +774,16 @@ class User(Base):
764
774
  status (UserStatus): The status of the user. Default is 'active'.
765
775
  created (datetime): The timestamp when the record was created.
766
776
  updated (datetime): The timestamp when the record was last updated.
767
- """
777
+ """ # noqa: E501
768
778
 
769
779
  __tablename__ = "users"
780
+ __table_args__ = (Index("idx_users_email", func.lower("email"), unique=True),)
770
781
 
771
782
  id: Mapped[intpk]
772
783
  f3_name: Mapped[Optional[str]]
773
784
  first_name: Mapped[Optional[str]]
774
785
  last_name: Mapped[Optional[str]]
775
- email: Mapped[str] = mapped_column(VARCHAR, unique=True)
786
+ email: Mapped[str] = mapped_column(CIText)
776
787
  phone: Mapped[Optional[str]]
777
788
  emergency_contact: Mapped[Optional[str]]
778
789
  emergency_phone: Mapped[Optional[str]]
@@ -781,9 +792,7 @@ class User(Base):
781
792
  avatar_url: Mapped[Optional[str]]
782
793
  meta: Mapped[Optional[Dict[str, Any]]]
783
794
  email_verified: Mapped[Optional[datetime]]
784
- status: Mapped[User_Status] = mapped_column(
785
- Enum(User_Status), default=User_Status.active
786
- )
795
+ status: Mapped[User_Status] = mapped_column(Enum(User_Status), default=User_Status.active)
787
796
  created: Mapped[dt_create]
788
797
  updated: Mapped[dt_update]
789
798
 
@@ -811,7 +820,7 @@ class SlackUser(Base):
811
820
  slack_updated (Optional[datetime]): The last update time of the Slack user.
812
821
  created (datetime): The timestamp when the record was created.
813
822
  updated (datetime): The timestamp when the record was last updated.
814
- """
823
+ """ # noqa: E501
815
824
 
816
825
  __tablename__ = "slack_users"
817
826
 
@@ -853,7 +862,7 @@ class Attendance(Base):
853
862
  slack_user (Optional[SlackUser]): The associated Slack user.
854
863
  attendance_x_attendance_types (List[Attendance_x_AttendanceType]): The association between the attendance and attendance types.
855
864
  attendance_types (List[AttendanceType]): The associated attendance types.
856
- """
865
+ """ # noqa: E501
857
866
 
858
867
  __tablename__ = "attendance"
859
868
  __table_args__ = (UniqueConstraint("event_id", "user_id", "is_planned"),)
@@ -866,15 +875,13 @@ class Attendance(Base):
866
875
  created: Mapped[dt_create]
867
876
  updated: Mapped[dt_update]
868
877
 
869
- event: Mapped[Event] = relationship(
870
- innerjoin=True, cascade="expunge", viewonly=True
871
- )
878
+ event: Mapped[Event] = relationship(innerjoin=True, cascade="expunge", viewonly=True)
872
879
  user: Mapped[User] = relationship(innerjoin=True, cascade="expunge", viewonly=True)
873
880
  slack_user: Mapped[Optional[SlackUser]] = relationship(
874
881
  innerjoin=False, cascade="expunge", secondary="users", viewonly=True
875
882
  )
876
- attendance_x_attendance_types: Mapped[List[Attendance_x_AttendanceType]] = (
877
- relationship(back_populates="attendance", cascade="save-update, merge, delete")
883
+ attendance_x_attendance_types: Mapped[List[Attendance_x_AttendanceType]] = relationship(
884
+ back_populates="attendance", cascade="save-update, merge, delete"
878
885
  )
879
886
  attendance_types: Mapped[List[AttendanceType]] = relationship(
880
887
  secondary="attendance_x_attendance_types",
@@ -897,7 +904,7 @@ class Achievement(Base):
897
904
  specific_org_id (Optional[int]): The ID of the specific region if a custom achievement. If null, the achievement is available to all regions.
898
905
  created (datetime): The timestamp when the record was created.
899
906
  updated (datetime): The timestamp when the record was last updated.
900
- """
907
+ """ # noqa: E501
901
908
 
902
909
  __tablename__ = "achievements"
903
910
 
@@ -919,17 +926,13 @@ class Achievement_x_User(Base):
919
926
  achievement_id (int): The ID of the associated achievement.
920
927
  user_id (int): The ID of the associated user.
921
928
  date_awarded (date): The date the achievement was awarded. Default is the current date.
922
- """
929
+ """ # noqa: E501
923
930
 
924
931
  __tablename__ = "achievements_x_users"
925
932
 
926
- achievement_id: Mapped[int] = mapped_column(
927
- ForeignKey("achievements.id"), primary_key=True
928
- )
933
+ achievement_id: Mapped[int] = mapped_column(ForeignKey("achievements.id"), primary_key=True)
929
934
  user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
930
- date_awarded: Mapped[date] = mapped_column(
931
- DateTime, server_default=func.timezone("utc", func.now())
932
- )
935
+ date_awarded: Mapped[date] = mapped_column(DateTime, server_default=func.timezone("utc", func.now()))
933
936
 
934
937
 
935
938
  class Position(Base):
@@ -941,7 +944,7 @@ class Position(Base):
941
944
  description (Optional[str]): A description of the position.
942
945
  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.
943
946
  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.
944
- """
947
+ """ # noqa: E501
945
948
 
946
949
  __tablename__ = "positions"
947
950
 
@@ -962,13 +965,11 @@ class Position_x_Org_x_User(Base):
962
965
  position_id (int): The ID of the associated position.
963
966
  org_id (int): The ID of the associated organization.
964
967
  user_id (int): The ID of the associated user.
965
- """
968
+ """ # noqa: E501
966
969
 
967
970
  __tablename__ = "positions_x_orgs_x_users"
968
971
 
969
- position_id: Mapped[int] = mapped_column(
970
- ForeignKey("positions.id"), primary_key=True
971
- )
972
+ position_id: Mapped[int] = mapped_column(ForeignKey("positions.id"), primary_key=True)
972
973
  org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
973
974
  user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
974
975
 
@@ -987,7 +988,7 @@ class Expansion(Base):
987
988
  interested_in_organizing (bool): Whether the user is interested in organizing.
988
989
  created (datetime): The timestamp when the record was created.
989
990
  updated (datetime): The timestamp when the record was last updated.
990
- """
991
+ """ # noqa: E501
991
992
 
992
993
  __tablename__ = "expansions"
993
994
 
@@ -1011,17 +1012,13 @@ class Expansion_x_User(Base):
1011
1012
  user_id (int): The ID of the associated user.
1012
1013
  requst_date (date): The date of the request. Default is the current date.
1013
1014
  notes (Optional[text]): Additional notes for the association.
1014
- """
1015
+ """ # noqa: E501
1015
1016
 
1016
1017
  __tablename__ = "expansions_x_users"
1017
1018
 
1018
- expansion_id: Mapped[int] = mapped_column(
1019
- ForeignKey("expansions.id"), primary_key=True
1020
- )
1019
+ expansion_id: Mapped[int] = mapped_column(ForeignKey("expansions.id"), primary_key=True)
1021
1020
  user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
1022
- request_date: Mapped[date] = mapped_column(
1023
- DateTime, server_default=func.timezone("utc", func.now())
1024
- )
1021
+ request_date: Mapped[date] = mapped_column(DateTime, server_default=func.timezone("utc", func.now()))
1025
1022
  notes: Mapped[Optional[text]]
1026
1023
 
1027
1024
 
@@ -1043,7 +1040,7 @@ class NextAuthAccount(Base):
1043
1040
  session_state (Optional[text]): The session state.
1044
1041
  created (datetime): The timestamp when the record was created.
1045
1042
  updated (datetime): The timestamp when the record was last updated.
1046
- """
1043
+ """ # noqa: E501
1047
1044
 
1048
1045
  __tablename__ = "auth_accounts"
1049
1046
 
@@ -1072,7 +1069,7 @@ class NextAuthSession(Base):
1072
1069
  expires (ts_notz): The expiration time of the session.
1073
1070
  created (datetime): The timestamp when the record was created.
1074
1071
  updated (datetime): The timestamp when the record was last updated.
1075
- """
1072
+ """ # noqa: E501
1076
1073
 
1077
1074
  __tablename__ = "auth_sessions"
1078
1075
 
@@ -1093,7 +1090,7 @@ class NextAuthVerificationToken(Base):
1093
1090
  expires (ts_notz): The expiration time of the token.
1094
1091
  created (datetime): The timestamp when the record was created.
1095
1092
  updated (datetime): The timestamp when the record was last updated.
1096
- """
1093
+ """ # noqa: E501
1097
1094
 
1098
1095
  __tablename__ = "auth_verification_tokens"
1099
1096
 
@@ -1154,16 +1151,12 @@ class UpdateRequest(Base):
1154
1151
  request_type (Request_Type): The type of the request.
1155
1152
  created (datetime): The timestamp when the record was created.
1156
1153
  updated (datetime): The timestamp when the record was last updated.
1157
- """
1154
+ """ # noqa: E501
1158
1155
 
1159
1156
  __tablename__ = "update_requests"
1160
1157
 
1161
- id: Mapped[Uuid] = mapped_column(
1162
- UUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid()
1163
- )
1164
- token: Mapped[Uuid] = mapped_column(
1165
- UUID(as_uuid=True), server_default=func.gen_random_uuid()
1166
- )
1158
+ id: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid())
1159
+ token: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), server_default=func.gen_random_uuid())
1167
1160
  region_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
1168
1161
  event_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"))
1169
1162
  event_type_ids: Mapped[Optional[List[int]]] = mapped_column(ARRAY(Integer))
@@ -1193,12 +1186,8 @@ class UpdateRequest(Base):
1193
1186
  location_state: Mapped[Optional[str]]
1194
1187
  location_zip: Mapped[Optional[str]]
1195
1188
  location_country: Mapped[Optional[str]]
1196
- location_lat: Mapped[Optional[float]] = mapped_column(
1197
- Float(precision=8, decimal_return_scale=5)
1198
- )
1199
- location_lng: Mapped[Optional[float]] = mapped_column(
1200
- Float(precision=8, decimal_return_scale=5)
1201
- )
1189
+ location_lat: Mapped[Optional[float]] = mapped_column(Float(precision=8, decimal_return_scale=5))
1190
+ location_lng: Mapped[Optional[float]] = mapped_column(Float(precision=8, decimal_return_scale=5))
1202
1191
  location_id: Mapped[Optional[int]] = mapped_column(ForeignKey("locations.id"))
1203
1192
  location_contact_email: Mapped[Optional[str]]
1204
1193
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "f3-data-models"
3
- version = "0.4.2"
3
+ version = "0.4.3"
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"
@@ -10,6 +10,29 @@ license = "MIT"
10
10
  repository = "https://github.com/F3-Nation/f3-data-models"
11
11
  documentation = "https://github.io/F3-Nation/f3-data-models"
12
12
 
13
+ [tool.ruff]
14
+ line-length = 120
15
+
16
+ select = [
17
+ "E", # pycodestyle errors (settings from FastAPI, thanks, @tiangolo!)
18
+ "W", # pycodestyle warnings
19
+ "F", # pyflakes
20
+ "I", # isort
21
+ "C", # flake8-comprehensions
22
+ "B", # flake8-bugbear
23
+ ]
24
+ ignore = [
25
+ "C901", # too complex
26
+ ]
27
+
28
+ [tool.ruff.isort]
29
+ order-by-type = true
30
+ relative-imports-order = "closest-to-furthest"
31
+ extra-standard-library = ["typing"]
32
+ section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
33
+ known-first-party = []
34
+
35
+
13
36
  [tool.poetry.dependencies]
14
37
  python = "^3.12"
15
38
  sqlalchemy = "^2.0.36"
@@ -25,6 +48,7 @@ sphinx-multiversion = "^0.2.4"
25
48
  psycopg2-binary = "^2.9.10"
26
49
  sqlmodel = "^0.0.22"
27
50
  alembic-postgresql-enum = "^1.6.1"
51
+ sqlalchemy-citext = "^1.8.0"
28
52
 
29
53
 
30
54
  [build-system]
File without changes