f3-data-models 0.5.14__py3-none-any.whl → 0.5.16__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
@@ -136,6 +136,38 @@ class Event_Cadence(enum.Enum):
136
136
  monthly = 2
137
137
 
138
138
 
139
+ class Achievement_Cadence(enum.Enum):
140
+ """
141
+ Enum representing the cadence of an achievement.
142
+
143
+ Attributes:
144
+ weekly
145
+ monthly
146
+ quarterly
147
+ yearly
148
+ lifetime
149
+ """
150
+
151
+ weekly = 1
152
+ monthly = 2
153
+ quarterly = 3
154
+ yearly = 4
155
+ lifetime = 5
156
+
157
+
158
+ class Achievement_Threshold_Type(enum.Enum):
159
+ """
160
+ Enum representing the type of threshold for an achievement.
161
+
162
+ Attributes:
163
+ posts
164
+ unique_aos
165
+ """
166
+
167
+ posts = 1
168
+ unique_aos = 2
169
+
170
+
139
171
  class Org_Type(enum.Enum):
140
172
  """
141
173
  Enum representing the type of organization.
@@ -957,7 +989,7 @@ class SlackUser(Base):
957
989
  strava_expires_at (Optional[datetime]): The expiration time of the Strava token.
958
990
  strava_athlete_id (Optional[int]): The Strava athlete ID of the user.
959
991
  meta (Optional[Dict[str, Any]]): Additional metadata for the Slack user.
960
- slack_updated (Optional[datetime]): The last update time of the Slack user.
992
+ slack_updated (Optional[int]): The last update time of the Slack user.
961
993
  created (datetime): The timestamp when the record was created.
962
994
  updated (datetime): The timestamp when the record was last updated.
963
995
  """ # noqa: E501
@@ -979,7 +1011,7 @@ class SlackUser(Base):
979
1011
  strava_expires_at: Mapped[Optional[datetime]]
980
1012
  strava_athlete_id: Mapped[Optional[int]]
981
1013
  meta: Mapped[Optional[Dict[str, Any]]]
982
- slack_updated: Mapped[Optional[datetime]]
1014
+ slack_updated: Mapped[Optional[int]]
983
1015
  created: Mapped[dt_create]
984
1016
  updated: Mapped[dt_update]
985
1017
 
@@ -1044,9 +1076,14 @@ class Achievement(Base):
1044
1076
  id (int): Primary Key of the model.
1045
1077
  name (str): The name of the achievement.
1046
1078
  description (Optional[str]): A description of the achievement.
1047
- verb (str): The verb associated with the achievement.
1048
1079
  image_url (Optional[str]): The URL of the achievement's image.
1049
1080
  specific_org_id (Optional[int]): The ID of the specific region if a custom achievement. If null, the achievement is available to all regions.
1081
+ is_active (bool): Whether the achievement is active. Default is True.
1082
+ auto_award (bool): Whether the achievement is automatically awarded or needs to be manually tagged. Default is False.
1083
+ auto_cadence (Optional[Achievement_Cadence]): The cadence for automatic awarding of the achievement.
1084
+ auto_threshold (Optional[int]): The threshold for automatic awarding of the achievement.
1085
+ auto_threshold_type (Optional[Achievement_Threshold_Type]): The type of threshold for automatic awarding of the achievement ('posts', 'unique_aos', etc.).
1086
+ auto_filters (Optional[Dict[str, Any]]): Event filters for automatic awarding of the achievement. Should be a format like {'include': [{'event_type_id': [1, 2]}, {'event_tag_id': [3]}], 'exclude': [{'event_category': ['third_f']}]}.
1050
1087
  created (datetime): The timestamp when the record was created.
1051
1088
  updated (datetime): The timestamp when the record was last updated.
1052
1089
  """ # noqa: E501
@@ -1056,9 +1093,15 @@ class Achievement(Base):
1056
1093
  id: Mapped[intpk]
1057
1094
  name: Mapped[str]
1058
1095
  description: Mapped[Optional[str]]
1059
- verb: Mapped[str]
1060
1096
  image_url: Mapped[Optional[str]]
1061
1097
  specific_org_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
1098
+ is_active: Mapped[bool] = mapped_column(Boolean, server_default="true", nullable=False)
1099
+ auto_award: Mapped[bool] = mapped_column(Boolean, server_default="false", nullable=False)
1100
+ auto_cadence: Mapped[Optional[Achievement_Cadence]]
1101
+ auto_threshold_type: Mapped[Optional[Achievement_Threshold_Type]]
1102
+ auto_threshold: Mapped[Optional[int]]
1103
+ auto_filters: Mapped[Optional[Dict[str, Any]]] = mapped_column(JSON, default=dict)
1104
+ meta: Mapped[Optional[Dict[str, Any]]] = mapped_column(JSON, default=dict)
1062
1105
  created: Mapped[dt_create]
1063
1106
  updated: Mapped[dt_update]
1064
1107
 
f3_data_models/utils.py CHANGED
@@ -194,13 +194,13 @@ class DbManager:
194
194
  for obj in objects:
195
195
  # Update simple fields
196
196
  for attr, value in fields.items():
197
- key = attr.key
197
+ key = attr if isinstance(attr, str) else attr.key
198
198
  if key in valid_attributes and not isinstance(value, InstrumentedList):
199
199
  setattr(obj, key, value)
200
200
 
201
201
  # Update relationships separately
202
202
  for attr, value in fields.items():
203
- key = attr.key
203
+ key = attr if isinstance(attr, str) else attr.key
204
204
  if key in valid_relationships:
205
205
  # Handle relationships separately
206
206
  relationship = inspect(cls).mapper.relationships[key]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: f3-data-models
3
- Version: 0.5.14
3
+ Version: 0.5.16
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=CjGVbV6Y8XlO8ZqvsQcvKlWoWqzB8VT6vg0IqmXqklo,54659
3
+ f3_data_models/testing.py,sha256=uHHgrfMOpUvu6-yOyuMsGadyeN-zuAFRYuGQNpXX4Lk,598
4
+ f3_data_models/utils.py,sha256=5ijpywxWMZZ5TZr7L7rLjs3QVsAHFvTQLtsrzIcnm04,12153
5
+ f3_data_models-0.5.16.dist-info/METADATA,sha256=qT3g2ypSghP5ihJVzN7V_0kwPwLpRs3mpGatyoEMjWI,3675
6
+ f3_data_models-0.5.16.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
+ f3_data_models-0.5.16.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=b_hKsW-5aFbFXsUohdiaVa5rN8xfb0EQ6NvXfTNSoAo,52919
3
- f3_data_models/testing.py,sha256=uHHgrfMOpUvu6-yOyuMsGadyeN-zuAFRYuGQNpXX4Lk,598
4
- f3_data_models/utils.py,sha256=LBNy7BXwRY0tqNKGUBoYi6-1Ch9dSLjGysLoes1Jfys,12083
5
- f3_data_models-0.5.14.dist-info/METADATA,sha256=idfSh-vccUa3BVQbtN-Du6RSSIUAULLz32wh4qzXJy8,3675
6
- f3_data_models-0.5.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
- f3_data_models-0.5.14.dist-info/RECORD,,