f3-data-models 0.3.8__py3-none-any.whl → 0.4.1__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,6 +1,5 @@
1
1
  from datetime import datetime, date, time
2
2
  from typing import Any, Dict, List, Optional
3
- import uuid
4
3
  from sqlalchemy import (
5
4
  ARRAY,
6
5
  JSON,
@@ -32,6 +31,7 @@ import enum
32
31
  # Custom Annotations
33
32
  time_notz = Annotated[time, TIME(timezone=False)]
34
33
  time_with_tz = Annotated[time, TIME(timezone=True)]
34
+ ts_notz = Annotated[datetime, DateTime(timezone=False)]
35
35
  text = Annotated[str, TEXT]
36
36
  intpk = Annotated[int, mapped_column(Integer, primary_key=True, autoincrement=True)]
37
37
  dt_create = Annotated[
@@ -100,6 +100,13 @@ class Event_Category(enum.Enum):
100
100
  third_f = 3
101
101
 
102
102
 
103
+ class Request_Type(enum.Enum):
104
+ create_location = 1
105
+ create_event = 2
106
+ edit = 3
107
+ delete_event = 4
108
+
109
+
103
110
  class Base(DeclarativeBase):
104
111
  """
105
112
  Base class for all models, providing common methods.
@@ -663,10 +670,13 @@ class Event(Base):
663
670
  secondary="event_tags_x_events", cascade="expunge", viewonly=True
664
671
  )
665
672
  event_x_event_types: Mapped[List[EventType_x_Event]] = relationship(
666
- back_populates="event"
673
+ back_populates="event", cascade="save-update, merge, delete"
667
674
  )
668
675
  event_x_event_tags: Mapped[Optional[List[EventTag_x_Event]]] = relationship(
669
- back_populates="event"
676
+ back_populates="event", cascade="save-update, merge, delete"
677
+ )
678
+ attendance: Mapped[List["Attendance"]] = relationship(
679
+ back_populates="event", cascade="expunge, delete"
670
680
  )
671
681
 
672
682
 
@@ -841,7 +851,7 @@ class Attendance(Base):
841
851
  innerjoin=False, cascade="expunge", secondary="users", viewonly=True
842
852
  )
843
853
  attendance_x_attendance_types: Mapped[List[Attendance_x_AttendanceType]] = (
844
- relationship(back_populates="attendance")
854
+ relationship(back_populates="attendance", cascade="save-update, merge, delete")
845
855
  )
846
856
  attendance_types: Mapped[List[AttendanceType]] = relationship(
847
857
  secondary="attendance_x_attendance_types",
@@ -1002,7 +1012,7 @@ class NextAuthAccount(Base):
1002
1012
  provider (text): The provider of the account.
1003
1013
  provider_account_id (text): The provider account ID.
1004
1014
  refresh_token (Optional[text]): The refresh token.
1005
- access_token (text): The access token.
1015
+ access_token (Optional[text]): The access token.
1006
1016
  expires_at (Optional[datetime]): The expiration time of the token.
1007
1017
  token_type (Optional[text]): The token type.
1008
1018
  scope (Optional[text]): The scope of the token.
@@ -1019,7 +1029,7 @@ class NextAuthAccount(Base):
1019
1029
  provider: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1020
1030
  provider_account_id: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1021
1031
  refresh_token: Mapped[Optional[text]]
1022
- access_token: Mapped[text]
1032
+ access_token: Mapped[Optional[text]]
1023
1033
  expires_at: Mapped[Optional[datetime]]
1024
1034
  token_type: Mapped[Optional[text]]
1025
1035
  scope: Mapped[Optional[text]]
@@ -1036,7 +1046,7 @@ class NextAuthSession(Base):
1036
1046
  Attributes:
1037
1047
  session_token (text): The session token.
1038
1048
  user_id (int): The ID of the associated user.
1039
- expires (date): The expiration time of the session.
1049
+ expires (ts_notz): The expiration time of the session.
1040
1050
  created (datetime): The timestamp when the record was created.
1041
1051
  updated (datetime): The timestamp when the record was last updated.
1042
1052
  """
@@ -1044,8 +1054,8 @@ class NextAuthSession(Base):
1044
1054
  __tablename__ = "auth_sessions"
1045
1055
 
1046
1056
  session_token: Mapped[text] = mapped_column(TEXT, primary_key=True)
1047
- user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
1048
- expires: Mapped[date]
1057
+ user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"))
1058
+ expires: Mapped[ts_notz]
1049
1059
  created: Mapped[dt_create]
1050
1060
  updated: Mapped[dt_update]
1051
1061
 
@@ -1057,7 +1067,7 @@ class NextAuthVerificationToken(Base):
1057
1067
  Attributes:
1058
1068
  identifier (text): The identifier of the token.
1059
1069
  token (text): The token.
1060
- expires (date): The expiration time of the token.
1070
+ expires (ts_notz): The expiration time of the token.
1061
1071
  created (datetime): The timestamp when the record was created.
1062
1072
  updated (datetime): The timestamp when the record was last updated.
1063
1073
  """
@@ -1066,7 +1076,7 @@ class NextAuthVerificationToken(Base):
1066
1076
 
1067
1077
  identifier: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1068
1078
  token: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1069
- expires: Mapped[date]
1079
+ expires: Mapped[ts_notz]
1070
1080
  created: Mapped[dt_create]
1071
1081
  updated: Mapped[dt_update]
1072
1082
 
@@ -1093,7 +1103,7 @@ class UpdateRequest(Base):
1093
1103
  event_day_of_week (Optional[Day_Of_Week]): The day of the week of the event.
1094
1104
  event_name (str): The name of the event.
1095
1105
  event_description (Optional[text]): A description of the event.
1096
- event_recurrence_pattern (Optional[str]): The recurrence pattern of the event.
1106
+ event_recurrence_pattern (Optional[Event_Cadence]): The recurrence pattern of the event.
1097
1107
  event_recurrence_interval (Optional[int]): The recurrence interval of the event.
1098
1108
  event_index_within_interval (Optional[int]): The index within the recurrence interval.
1099
1109
  event_meta (Optional[Dict[str, Any]]): Additional metadata for the event.
@@ -1117,14 +1127,19 @@ class UpdateRequest(Base):
1117
1127
  reviewed_at (Optional[datetime]): The timestamp when the request was reviewed.
1118
1128
  status (Update_Request_Status): The status of the request. Default is 'pending'.
1119
1129
  meta (Optional[Dict[str, Any]]): Additional metadata for the request.
1130
+ request_type (Request_Type): The type of the request.
1120
1131
  created (datetime): The timestamp when the record was created.
1121
1132
  updated (datetime): The timestamp when the record was last updated.
1122
1133
  """
1123
1134
 
1124
1135
  __tablename__ = "update_requests"
1125
1136
 
1126
- id: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), primary_key=True)
1127
- token: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), default=uuid.uuid4)
1137
+ id: Mapped[Uuid] = mapped_column(
1138
+ UUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid()
1139
+ )
1140
+ token: Mapped[Uuid] = mapped_column(
1141
+ UUID(as_uuid=True), server_default=func.gen_random_uuid()
1142
+ )
1128
1143
  region_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
1129
1144
  event_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"))
1130
1145
  event_type_ids: Mapped[Optional[List[int]]] = mapped_column(ARRAY(Integer))
@@ -1140,7 +1155,7 @@ class UpdateRequest(Base):
1140
1155
  event_day_of_week: Mapped[Optional[Day_Of_Week]]
1141
1156
  event_name: Mapped[str]
1142
1157
  event_description: Mapped[Optional[text]]
1143
- event_recurrence_pattern: Mapped[Optional[str]] = mapped_column(VARCHAR(length=30))
1158
+ event_recurrence_pattern: Mapped[Optional[Event_Cadence]]
1144
1159
  event_recurrence_interval: Mapped[Optional[int]]
1145
1160
  event_index_within_interval: Mapped[Optional[int]]
1146
1161
  event_meta: Mapped[Optional[Dict[str, Any]]]
@@ -1173,6 +1188,6 @@ class UpdateRequest(Base):
1173
1188
  Enum(Update_Request_Status), default=Update_Request_Status.pending
1174
1189
  )
1175
1190
  meta: Mapped[Optional[Dict[str, Any]]]
1176
-
1191
+ request_type: Mapped[Request_Type]
1177
1192
  created: Mapped[dt_create]
1178
1193
  updated: Mapped[dt_update]
f3_data_models/testing.py CHANGED
@@ -12,7 +12,7 @@ def test_update_event():
12
12
  highlight=True,
13
13
  start_date=datetime.date(2025, 2, 17),
14
14
  end_date=datetime.date(2026, 2, 17),
15
- start_time="0500",
15
+ start_time="0400",
16
16
  end_time="0600",
17
17
  event_x_event_types=[
18
18
  EventType_x_Event(event_type_id=3),
@@ -24,9 +24,10 @@ def test_update_event():
24
24
  name="Test Event",
25
25
  )
26
26
  update_dict = event.to_update_dict()
27
- DbManager.update_records(Event, [Event.id == 3], update_dict)
27
+ DbManager.update_record(Event, 3, update_dict)
28
28
 
29
- event = DbManager.get(Event, 3)
29
+ # event = DbManager.get(Event, 3)
30
+ DbManager.delete_records(Event, [Event.series_id == 3])
30
31
 
31
32
 
32
33
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: f3-data-models
3
- Version: 0.3.8
3
+ Version: 0.4.1
4
4
  Summary: The data schema and models for F3 Nation applications.
5
5
  License: MIT
6
6
  Author: Evan Petzoldt
@@ -0,0 +1,7 @@
1
+ f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ f3_data_models/models.py,sha256=GolkaBfXhiEjil6lHcJ7xjKp4uEj2AlgjmD9_B7JtBk,45724
3
+ f3_data_models/testing.py,sha256=KmTjMe345-NZCdHNaNnOyL33J8D5oVdqdIhYIKbM8XM,968
4
+ f3_data_models/utils.py,sha256=UpNx1E_kmt8_1vN4fdFSy55yPCoDA2algzof_5EAJ2k,13835
5
+ f3_data_models-0.4.1.dist-info/METADATA,sha256=9O544jx116V5N8qwqbNw0i4CPxciJprXv6LwpeSLfMw,2716
6
+ f3_data_models-0.4.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
7
+ f3_data_models-0.4.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- f3_data_models/models.py,sha256=jGxAG5Dmzhf2u4cLMUxY48yKENn5HC5N9_eUUSb31yc,45109
3
- f3_data_models/testing.py,sha256=Pd-TYvkeai2DuN9ubPPdqjo4xS_Zd3T1WGV7J_SXPdc,921
4
- f3_data_models/utils.py,sha256=UpNx1E_kmt8_1vN4fdFSy55yPCoDA2algzof_5EAJ2k,13835
5
- f3_data_models-0.3.8.dist-info/METADATA,sha256=Hza4-PUUC0sK4D-BJHGIx81WXrSjcS8PFYB98euxGhE,2716
6
- f3_data_models-0.3.8.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
7
- f3_data_models-0.3.8.dist-info/RECORD,,