square-administration 1.2.0__tar.gz → 2.0.0__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.
Files changed (21) hide show
  1. {square_administration-1.2.0 → square_administration-2.0.0}/PKG-INFO +9 -1
  2. {square_administration-1.2.0 → square_administration-2.0.0}/README.md +8 -0
  3. {square_administration-1.2.0 → square_administration-2.0.0}/setup.py +1 -1
  4. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/routes/authentication.py +21 -2
  5. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/routes/core.py +3 -2
  6. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration.egg-info/PKG-INFO +9 -1
  7. {square_administration-1.2.0 → square_administration-2.0.0}/setup.cfg +0 -0
  8. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/__init__.py +0 -0
  9. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/configuration.py +0 -0
  10. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/data/config.ini +0 -0
  11. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/main.py +0 -0
  12. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/messages.py +0 -0
  13. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/pydantic_models/__init__.py +0 -0
  14. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/pydantic_models/authentication.py +0 -0
  15. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/pydantic_models/core.py +0 -0
  16. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/routes/__init__.py +0 -0
  17. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration/utils/__init__.py +0 -0
  18. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration.egg-info/SOURCES.txt +0 -0
  19. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration.egg-info/dependency_links.txt +0 -0
  20. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration.egg-info/requires.txt +0 -0
  21. {square_administration-1.2.0 → square_administration-2.0.0}/square_administration.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square_administration
3
- Version: 1.2.0
3
+ Version: 2.0.0
4
4
  Summary: common business layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_administration
6
6
  Author: thePmSquare
@@ -32,6 +32,14 @@ pip install square_administration
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v2.0.0
36
+
37
+ - remove refresh token from response body and send in cookies.
38
+
39
+ ### v1.2.1
40
+
41
+ - fix bug in core -> get_all_greetings_v0, now sending full response instead of only main.
42
+
35
43
  ### v1.2.0
36
44
 
37
45
  - set allow_credentials=True.
@@ -16,6 +16,14 @@ pip install square_administration
16
16
 
17
17
  ## changelog
18
18
 
19
+ ### v2.0.0
20
+
21
+ - remove refresh token from response body and send in cookies.
22
+
23
+ ### v1.2.1
24
+
25
+ - fix bug in core -> get_all_greetings_v0, now sending full response instead of only main.
26
+
19
27
  ### v1.2.0
20
28
 
21
29
  - set allow_credentials=True.
@@ -4,7 +4,7 @@ package_name = "square_administration"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="1.2.0",
7
+ version="2.0.0",
8
8
  packages=find_packages(),
9
9
  package_data={
10
10
  package_name: ["data/*"],
@@ -6,6 +6,7 @@ from fastapi import APIRouter, status, HTTPException, Header
6
6
  from fastapi.responses import JSONResponse
7
7
  from requests import HTTPError
8
8
  from square_commons import get_api_output_in_standard_format
9
+ from square_commons.api_utils import create_cookie
9
10
 
10
11
  from square_administration.configuration import (
11
12
  global_object_square_logger,
@@ -66,14 +67,23 @@ async def register_username_v0(
66
67
  """
67
68
  return value
68
69
  """
70
+ refresh_token = response["data"]["main"]["refresh_token"]
71
+ del response["data"]["main"]["refresh_token"]
69
72
  output_content = get_api_output_in_standard_format(
70
73
  message=messages["REGISTRATION_SUCCESSFUL"],
71
74
  data={"main": response["data"]["main"]},
72
75
  )
73
- return JSONResponse(
76
+ json_response = JSONResponse(
74
77
  status_code=status.HTTP_201_CREATED,
75
78
  content=output_content,
76
79
  )
80
+ json_response.set_cookie(
81
+ **create_cookie(
82
+ key="refresh_token|" + str(global_int_app_id),
83
+ value=refresh_token,
84
+ )
85
+ )
86
+ return json_response
77
87
  except HTTPError as http_error:
78
88
  global_object_square_logger.logger.error(http_error, exc_info=True)
79
89
  """
@@ -133,14 +143,23 @@ async def login_username_v0(
133
143
  """
134
144
  return value
135
145
  """
146
+ refresh_token = response["data"]["main"]["refresh_token"]
147
+ del response["data"]["main"]["refresh_token"]
136
148
  output_content = get_api_output_in_standard_format(
137
149
  message=messages["LOGIN_SUCCESSFUL"],
138
150
  data={"main": response["data"]["main"]},
139
151
  )
140
- return JSONResponse(
152
+ json_response = JSONResponse(
141
153
  status_code=status.HTTP_200_OK,
142
154
  content=output_content,
143
155
  )
156
+ json_response.set_cookie(
157
+ **create_cookie(
158
+ key="refresh_token|" + str(global_int_app_id),
159
+ value=refresh_token,
160
+ )
161
+ )
162
+ return json_response
144
163
  except HTTPError as http_error:
145
164
  global_object_square_logger.logger.error(http_error, exc_info=True)
146
165
  """
@@ -99,7 +99,8 @@ async def get_all_greetings_v0(
99
99
  ]
100
100
  for x in user_credentials_response
101
101
  }
102
- main = [
102
+ response_clone = response
103
+ response_clone["data"]["main"] = [
103
104
  {
104
105
  **greeting,
105
106
  UserCredential.user_credential_username.name: user_credentials_map.get(
@@ -114,7 +115,7 @@ async def get_all_greetings_v0(
114
115
  """
115
116
  output_content = get_api_output_in_standard_format(
116
117
  message=messages["GENERIC_READ_SUCCESSFUL"],
117
- data={"main": main},
118
+ data=response_clone["data"],
118
119
  )
119
120
  return JSONResponse(
120
121
  status_code=status.HTTP_200_OK,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square-administration
3
- Version: 1.2.0
3
+ Version: 2.0.0
4
4
  Summary: common business layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_administration
6
6
  Author: thePmSquare
@@ -32,6 +32,14 @@ pip install square_administration
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v2.0.0
36
+
37
+ - remove refresh token from response body and send in cookies.
38
+
39
+ ### v1.2.1
40
+
41
+ - fix bug in core -> get_all_greetings_v0, now sending full response instead of only main.
42
+
35
43
  ### v1.2.0
36
44
 
37
45
  - set allow_credentials=True.