square-authentication 6.0.0__py3-none-any.whl → 6.0.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.
@@ -74,7 +74,9 @@ async def update_profile_photo_v0(
74
74
  main process
75
75
  """
76
76
  # uploading to square file store
77
- destination_path = f"temp/{user_id}/profile_photo/{profile_photo.filename}"
77
+ destination_path = os.path.join(
78
+ "temp", user_id, "profile_photo", profile_photo.filename
79
+ )
78
80
  os.makedirs(os.path.dirname(destination_path), exist_ok=True)
79
81
  with open(destination_path, "wb") as out_file:
80
82
  content = await profile_photo.read()
@@ -89,6 +91,18 @@ async def update_profile_photo_v0(
89
91
  os.remove(destination_path)
90
92
 
91
93
  # adding file storage token to user profile
94
+ old_profile_photo_response = global_object_square_database_helper.get_rows_v0(
95
+ database_name=global_string_database_name,
96
+ schema_name=global_string_schema_name,
97
+ table_name=UserProfile.__tablename__,
98
+ filters=FiltersV0(
99
+ root={UserProfile.user_id.name: FilterConditionsV0(eq=user_id)}
100
+ ),
101
+ apply_filters=True,
102
+ )
103
+ old_profile_photo_token = old_profile_photo_response["data"]["main"][0][
104
+ "user_profile_photo_storage_token"
105
+ ]
92
106
  profile_update_response = global_object_square_database_helper.edit_rows_v0(
93
107
  data={
94
108
  UserProfile.user_profile_photo_storage_token.name: file_upload_response[
@@ -96,13 +110,17 @@ async def update_profile_photo_v0(
96
110
  ]["main"]
97
111
  },
98
112
  filters=FiltersV0(
99
- {UserProfile.user_id.name: FilterConditionsV0(eq=user_id)}
113
+ root={UserProfile.user_id.name: FilterConditionsV0(eq=user_id)}
100
114
  ),
101
115
  database_name=global_string_database_name,
102
116
  schema_name=global_string_schema_name,
103
117
  table_name=UserProfile.__tablename__,
104
118
  apply_filters=True,
105
119
  )
120
+ if old_profile_photo_token:
121
+ global_object_square_file_store_helper.delete_file_v0(
122
+ [old_profile_photo_token]
123
+ )
106
124
 
107
125
  """
108
126
  return value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: square_authentication
3
- Version: 6.0.0
3
+ Version: 6.0.1
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -53,6 +53,10 @@ pip install square_authentication
53
53
 
54
54
  ## changelog
55
55
 
56
+ ### v6.0.1
57
+
58
+ - delete previous profile photo from file store after successfully updating profile photo.
59
+
56
60
  ### v6.0.0
57
61
 
58
62
  - add profile details in get_user_details_v0 instead of credentials keyword.
@@ -7,12 +7,12 @@ square_authentication/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
7
7
  square_authentication/pydantic_models/core.py,sha256=qeNETcJv7mnRKGhATOW2bg0NlHuyzvot1dZ1b1qqhwU,610
8
8
  square_authentication/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  square_authentication/routes/core.py,sha256=Ui2kJI3DHK1tsb4_cCle8iurZlU__O_nptk2-YLZ2vg,56778
10
- square_authentication/routes/profile.py,sha256=YkApDwsSL4KDKdT5uHDqdpSmTEhPgRkJ6bTQkf5sj9Q,4879
10
+ square_authentication/routes/profile.py,sha256=gOtqWuc5ET_dVTb8ZXpoaBQ4nPEsJZ9UD8HEhe6Q-rw,5628
11
11
  square_authentication/routes/utility.py,sha256=KDr8KdkT0jAGPjfP-b5XXYG7p49WU7J1FiK6oSIckQI,1779
12
12
  square_authentication/utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
13
  square_authentication/utils/encryption.py,sha256=WakaiEAgWpTJltxBzqOtv81_DCDKfzJqt60fWSPoNvo,2027
14
14
  square_authentication/utils/token.py,sha256=t-RPBY4cYyT1ro3lkLBTOy2BeRGBfluBVBivL5DLmDg,680
15
- square_authentication-6.0.0.dist-info/METADATA,sha256=diCuuGBkXdBe3l2ArU7R1M6dB-BwAox2bdzdDb-MC8o,4733
16
- square_authentication-6.0.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
17
- square_authentication-6.0.0.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
18
- square_authentication-6.0.0.dist-info/RECORD,,
15
+ square_authentication-6.0.1.dist-info/METADATA,sha256=D1DdWST7EHtu9G4rJH_JBAu3FQzJtcA3l4ujtmrm7-s,4837
16
+ square_authentication-6.0.1.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
17
+ square_authentication-6.0.1.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
18
+ square_authentication-6.0.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5