Skip to content

Commit 1897546

Browse files
committed
feature: TT-430 disable cors on development mode
1 parent 457ba25 commit 1897546

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

V2/local.settings.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
{"IsEncrypted":false,"Values":{"AzureWebJobsStorage":"UseDevelopmentStorage=true","FUNCTIONS_WORKER_RUNTIME":"python"}}
1+
{
2+
"IsEncrypted": false,
3+
"Values": {
4+
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
5+
"FUNCTIONS_WORKER_RUNTIME": "python"
6+
},
7+
"Host": {
8+
"CORS": "*"
9+
}
10+
}

V2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"offline": "serverless offline -a '--cors *'",
8+
"offline": "serverless offline",
99
"deploy": "serverless deploy"
1010
},
1111
"author": "",

V2/serverless.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ functions:
5151
- GET
5252
route: activities/{id:?}
5353
authLevel: anonymous
54-
cors: true
5554

5655
delete_activity:
5756
handler: time_tracker/activities/interface.delete_activity
@@ -62,7 +61,6 @@ functions:
6261
- DELETE
6362
route: activities/{id}
6463
authLevel: anonymous
65-
cors: true
6664

6765
update_activity:
6866
handler: time_tracker/activities/interface.update_activity
@@ -73,7 +71,6 @@ functions:
7371
- PUT
7472
route: activities/{id}
7573
authLevel: anonymous
76-
cors: true
7774

7875
create_activity:
7976
handler: time_tracker/activities/interface.create_activity
@@ -84,7 +81,6 @@ functions:
8481
- POST
8582
route: activities/
8683
authLevel: anonymous
87-
cors: true
8884

8985
#endregion End Functions Activities
9086

@@ -99,7 +95,6 @@ functions:
9995
- POST
10096
route: time-entries/
10197
authLevel: anonymous
102-
cors: true
10398

10499
get_time_entries:
105100
handler: time_tracker/time_entries/interface.get_time_entries
@@ -110,7 +105,6 @@ functions:
110105
- GET
111106
route: time-entries/{id:?}
112107
authLevel: anonymous
113-
cors: true
114108

115109
delete_time_entry:
116110
handler: time_tracker/time_entries/interface.delete_time_entry
@@ -121,7 +115,6 @@ functions:
121115
- DELETE
122116
route: time-entries/{id}
123117
authLevel: anonymous
124-
cors: true
125118

126119
update_time_entry:
127120
handler: time_tracker/time_entries/interface.update_time_entry
@@ -131,8 +124,7 @@ functions:
131124
methods:
132125
- PUT
133126
route: time-entries/{id}
134-
authLevel: anonymous
135-
cors: true
127+
authLevel: anonymous
136128

137129
get_latest_time_entry:
138130
handler: time_tracker/time_entries/interface.get_latest_entries
@@ -143,7 +135,6 @@ functions:
143135
- GET
144136
route: time-entries/latest/
145137
authLevel: anonymous
146-
cors: true
147138

148139
#endregion End Functions Time-Entries
149140

@@ -158,7 +149,6 @@ functions:
158149
- POST
159150
route: customers/
160151
authLevel: anonymous
161-
cors: true
162152

163153
get_customers:
164154
handler: time_tracker/customers/interface.get_customers
@@ -169,7 +159,6 @@ functions:
169159
- GET
170160
route: customers/{id:?}
171161
authLevel: anonymous
172-
cors: true
173162

174163
update_customer:
175164
handler: time_tracker/customers/interface.update_customer
@@ -180,7 +169,6 @@ functions:
180169
- PUT
181170
route: customers/{id}
182171
authLevel: anonymous
183-
cors: true
184172

185173
delete_customer:
186174
handler: time_tracker/customers/interface.delete_customer
@@ -191,7 +179,6 @@ functions:
191179
- DELETE
192180
route: customers/{id}
193181
authLevel: anonymous
194-
cors: true
195182

196183
#endregion End Functions Customers
197184

@@ -206,7 +193,6 @@ functions:
206193
- GET
207194
route: projects/{id:?}
208195
authLevel: anonymous
209-
cors: true
210196

211197
delete_project:
212198
handler: time_tracker/projects/interface.delete_project
@@ -217,7 +203,6 @@ functions:
217203
- DELETE
218204
route: projects/{id}
219205
authLevel: anonymous
220-
cors: true
221206

222207
update_project:
223208
handler: time_tracker/projects/interface.update_project
@@ -227,8 +212,7 @@ functions:
227212
methods:
228213
- PUT
229214
route: projects/{id}
230-
authLevel: anonymous
231-
cors: true
215+
authLevel: anonymous
232216

233217
create_project:
234218
handler: time_tracker/projects/interface.create_project
@@ -240,7 +224,6 @@ functions:
240224
route: projects/
241225

242226
authLevel: anonymous
243-
cors: true
244227

245228
get_latest_projects:
246229
handler: time_tracker/projects/interface.get_latest_projects
@@ -251,7 +234,6 @@ functions:
251234
- GET
252235
route: projects/latest
253236
authLevel: anonymous
254-
cors: true
255237

256238
#endregion End Functions Projects
257239

V2/time_tracker/activities/_application/_activities/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ def parse_status_to_string_for_ui(activity: dict) -> dict:
77

88

99
def parse_status_to_number(status: str) -> int:
10-
return StatusEnums[status].value
10+
if(isinstance(status, str)):
11+
return StatusEnums[status].value
12+
return status

0 commit comments

Comments
 (0)