zou 0.20.83__py3-none-any.whl → 0.20.84__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.
- zou/__init__.py +1 -1
- zou/app/blueprints/comments/resources.py +32 -35
- zou/app/blueprints/concepts/resources.py +23 -8
- zou/app/blueprints/crud/asset_instance.py +272 -0
- zou/app/blueprints/crud/attachment_file.py +263 -0
- zou/app/blueprints/crud/base.py +176 -69
- zou/app/blueprints/crud/budget.py +278 -0
- zou/app/blueprints/crud/budget_entry.py +269 -0
- zou/app/blueprints/crud/chat.py +282 -0
- zou/app/blueprints/crud/chat_message.py +286 -0
- zou/app/blueprints/crud/comments.py +312 -1
- zou/app/blueprints/crud/custom_action.py +268 -0
- zou/app/blueprints/crud/day_off.py +298 -0
- zou/app/blueprints/crud/department.py +268 -0
- zou/app/blueprints/crud/entity.py +297 -3
- zou/app/blueprints/crud/entity_link.py +303 -0
- zou/app/blueprints/crud/entity_type.py +269 -0
- zou/app/blueprints/crud/event.py +197 -0
- zou/app/blueprints/crud/file_status.py +268 -0
- zou/app/blueprints/crud/hardware_item.py +268 -0
- zou/app/blueprints/crud/metadata_descriptor.py +312 -0
- zou/app/blueprints/crud/milestone.py +302 -1
- zou/app/blueprints/crud/news.py +285 -0
- zou/app/blueprints/crud/notification.py +287 -0
- zou/app/blueprints/crud/organisation.py +269 -0
- zou/app/blueprints/crud/output_file.py +34 -10
- zou/app/blueprints/crud/output_type.py +30 -10
- zou/app/blueprints/crud/person.py +407 -2
- zou/app/blueprints/crud/playlist.py +322 -4
- zou/app/blueprints/crud/plugin.py +269 -0
- zou/app/blueprints/crud/preview_background_file.py +272 -0
- zou/app/blueprints/crud/preview_file.py +280 -9
- zou/app/blueprints/crud/production_schedule_version.py +569 -0
- zou/app/blueprints/crud/project.py +440 -0
- zou/app/blueprints/crud/project_status.py +268 -0
- zou/app/blueprints/crud/salary_scale.py +185 -5
- zou/app/blueprints/crud/schedule_item.py +305 -0
- zou/app/blueprints/crud/search_filter.py +302 -0
- zou/app/blueprints/crud/search_filter_group.py +270 -0
- zou/app/blueprints/crud/software.py +30 -10
- zou/app/blueprints/crud/status_automation.py +296 -2
- zou/app/blueprints/crud/studio.py +268 -0
- zou/app/blueprints/crud/subscription.py +279 -0
- zou/app/blueprints/crud/task.py +325 -5
- zou/app/blueprints/crud/task_status.py +301 -0
- zou/app/blueprints/crud/task_type.py +283 -0
- zou/app/blueprints/crud/time_spent.py +327 -0
- zou/app/blueprints/crud/working_file.py +273 -10
- zou/app/blueprints/export/csv/assets.py +15 -5
- zou/app/blueprints/export/csv/base.py +12 -3
- zou/app/blueprints/export/csv/casting.py +32 -5
- zou/app/blueprints/export/csv/edits.py +15 -5
- zou/app/blueprints/export/csv/persons.py +24 -0
- zou/app/blueprints/export/csv/playlists.py +16 -5
- zou/app/blueprints/export/csv/projects.py +23 -0
- zou/app/blueprints/export/csv/shots.py +15 -5
- zou/app/blueprints/export/csv/task_types.py +23 -0
- zou/app/blueprints/export/csv/tasks.py +24 -0
- zou/app/blueprints/export/csv/time_spents.py +24 -0
- zou/app/blueprints/files/resources.py +928 -377
- zou/app/blueprints/news/resources.py +7 -5
- zou/app/blueprints/persons/resources.py +644 -271
- zou/app/blueprints/playlists/resources.py +154 -72
- zou/app/blueprints/previews/resources.py +473 -228
- zou/app/blueprints/projects/__init__.py +5 -0
- zou/app/blueprints/projects/resources.py +987 -420
- zou/app/blueprints/search/resources.py +44 -32
- zou/app/blueprints/shots/resources.py +1338 -88
- zou/app/blueprints/source/csv/assets.py +44 -6
- zou/app/blueprints/source/csv/casting.py +43 -6
- zou/app/blueprints/source/csv/edits.py +47 -9
- zou/app/blueprints/source/csv/persons.py +43 -4
- zou/app/blueprints/source/csv/shots.py +47 -6
- zou/app/blueprints/source/csv/task_type_estimations.py +95 -35
- zou/app/blueprints/source/kitsu.py +433 -11
- zou/app/blueprints/source/otio.py +215 -20
- zou/app/blueprints/source/shotgun/assets.py +146 -0
- zou/app/blueprints/source/shotgun/base.py +85 -14
- zou/app/blueprints/source/shotgun/episode.py +124 -0
- zou/app/blueprints/source/shotgun/import_errors.py +105 -14
- zou/app/blueprints/source/shotgun/notes.py +132 -0
- zou/app/blueprints/source/shotgun/person.py +163 -0
- zou/app/blueprints/source/shotgun/project.py +120 -0
- zou/app/blueprints/source/shotgun/scene.py +120 -0
- zou/app/blueprints/source/shotgun/sequence.py +134 -0
- zou/app/blueprints/source/shotgun/shot.py +166 -0
- zou/app/blueprints/source/shotgun/status.py +129 -0
- zou/app/blueprints/source/shotgun/steps.py +138 -0
- zou/app/blueprints/source/shotgun/tasks.py +199 -0
- zou/app/blueprints/source/shotgun/team.py +132 -0
- zou/app/blueprints/source/shotgun/versions.py +155 -0
- zou/app/blueprints/tasks/resources.py +1197 -308
- zou/app/models/metadata_descriptor.py +1 -0
- zou/app/services/persons_service.py +1 -1
- zou/app/services/projects_service.py +45 -1
- zou/app/services/time_spents_service.py +1 -1
- zou/migrations/versions/a1b2c3d4e5f6_add_position_to_metadata_descriptor.py +32 -0
- {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/METADATA +18 -18
- {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/RECORD +103 -102
- {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/WHEEL +0 -0
- {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/entry_points.txt +0 -0
- {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/licenses/LICENSE +0 -0
- {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from flask_jwt_extended import jwt_required
|
|
2
|
+
|
|
1
3
|
from zou.app.models.day_off import DayOff
|
|
2
4
|
from zou.app.models.time_spent import TimeSpent
|
|
3
5
|
|
|
@@ -17,6 +19,145 @@ class DayOffsResource(BaseModelsResource):
|
|
|
17
19
|
def check_create_permissions(self, data):
|
|
18
20
|
return user_service.check_day_off_access(data)
|
|
19
21
|
|
|
22
|
+
@jwt_required()
|
|
23
|
+
def get(self):
|
|
24
|
+
"""
|
|
25
|
+
Get day offs
|
|
26
|
+
---
|
|
27
|
+
tags:
|
|
28
|
+
- Crud
|
|
29
|
+
description: Retrieve all day offs. Supports filtering via query
|
|
30
|
+
parameters and pagination.
|
|
31
|
+
parameters:
|
|
32
|
+
- in: query
|
|
33
|
+
name: page
|
|
34
|
+
required: false
|
|
35
|
+
schema:
|
|
36
|
+
type: integer
|
|
37
|
+
example: 1
|
|
38
|
+
description: Page number for pagination
|
|
39
|
+
- in: query
|
|
40
|
+
name: limit
|
|
41
|
+
required: false
|
|
42
|
+
schema:
|
|
43
|
+
type: integer
|
|
44
|
+
example: 50
|
|
45
|
+
description: Number of results per page
|
|
46
|
+
- in: query
|
|
47
|
+
name: relations
|
|
48
|
+
required: false
|
|
49
|
+
schema:
|
|
50
|
+
type: boolean
|
|
51
|
+
default: false
|
|
52
|
+
example: false
|
|
53
|
+
description: Whether to include relations
|
|
54
|
+
responses:
|
|
55
|
+
200:
|
|
56
|
+
description: Day offs retrieved successfully
|
|
57
|
+
content:
|
|
58
|
+
application/json:
|
|
59
|
+
schema:
|
|
60
|
+
oneOf:
|
|
61
|
+
- type: array
|
|
62
|
+
items:
|
|
63
|
+
type: object
|
|
64
|
+
- type: object
|
|
65
|
+
properties:
|
|
66
|
+
data:
|
|
67
|
+
type: array
|
|
68
|
+
items:
|
|
69
|
+
type: object
|
|
70
|
+
example: []
|
|
71
|
+
total:
|
|
72
|
+
type: integer
|
|
73
|
+
example: 100
|
|
74
|
+
nb_pages:
|
|
75
|
+
type: integer
|
|
76
|
+
example: 2
|
|
77
|
+
limit:
|
|
78
|
+
type: integer
|
|
79
|
+
example: 50
|
|
80
|
+
offset:
|
|
81
|
+
type: integer
|
|
82
|
+
example: 0
|
|
83
|
+
page:
|
|
84
|
+
type: integer
|
|
85
|
+
example: 1
|
|
86
|
+
400:
|
|
87
|
+
description: Invalid filter format or query error
|
|
88
|
+
"""
|
|
89
|
+
return super().get()
|
|
90
|
+
|
|
91
|
+
@jwt_required()
|
|
92
|
+
def post(self):
|
|
93
|
+
"""
|
|
94
|
+
Create day off
|
|
95
|
+
---
|
|
96
|
+
tags:
|
|
97
|
+
- Crud
|
|
98
|
+
description: Create a new day off with data provided in the
|
|
99
|
+
request body. JSON format is expected. Deletes overlapping
|
|
100
|
+
time spent entries.
|
|
101
|
+
requestBody:
|
|
102
|
+
required: true
|
|
103
|
+
content:
|
|
104
|
+
application/json:
|
|
105
|
+
schema:
|
|
106
|
+
type: object
|
|
107
|
+
required:
|
|
108
|
+
- date
|
|
109
|
+
- end_date
|
|
110
|
+
- person_id
|
|
111
|
+
properties:
|
|
112
|
+
date:
|
|
113
|
+
type: string
|
|
114
|
+
format: date
|
|
115
|
+
example: "2024-01-15"
|
|
116
|
+
end_date:
|
|
117
|
+
type: string
|
|
118
|
+
format: date
|
|
119
|
+
example: "2024-01-20"
|
|
120
|
+
person_id:
|
|
121
|
+
type: string
|
|
122
|
+
format: uuid
|
|
123
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
124
|
+
responses:
|
|
125
|
+
201:
|
|
126
|
+
description: Day off created successfully
|
|
127
|
+
content:
|
|
128
|
+
application/json:
|
|
129
|
+
schema:
|
|
130
|
+
type: object
|
|
131
|
+
properties:
|
|
132
|
+
id:
|
|
133
|
+
type: string
|
|
134
|
+
format: uuid
|
|
135
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
136
|
+
date:
|
|
137
|
+
type: string
|
|
138
|
+
format: date
|
|
139
|
+
example: "2024-01-15"
|
|
140
|
+
end_date:
|
|
141
|
+
type: string
|
|
142
|
+
format: date
|
|
143
|
+
example: "2024-01-20"
|
|
144
|
+
person_id:
|
|
145
|
+
type: string
|
|
146
|
+
format: uuid
|
|
147
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
148
|
+
created_at:
|
|
149
|
+
type: string
|
|
150
|
+
format: date-time
|
|
151
|
+
example: "2024-01-15T10:30:00Z"
|
|
152
|
+
updated_at:
|
|
153
|
+
type: string
|
|
154
|
+
format: date-time
|
|
155
|
+
example: "2024-01-15T10:30:00Z"
|
|
156
|
+
400:
|
|
157
|
+
description: Invalid data format or day off already exists
|
|
158
|
+
"""
|
|
159
|
+
return super().post()
|
|
160
|
+
|
|
20
161
|
def check_creation_integrity(self, data):
|
|
21
162
|
if time_spents_service.get_day_offs_between(
|
|
22
163
|
data["date"], data["end_date"], data["person_id"]
|
|
@@ -39,6 +180,163 @@ class DayOffResource(BaseModelResource):
|
|
|
39
180
|
def __init__(self):
|
|
40
181
|
BaseModelResource.__init__(self, DayOff)
|
|
41
182
|
|
|
183
|
+
@jwt_required()
|
|
184
|
+
def get(self, instance_id):
|
|
185
|
+
"""
|
|
186
|
+
Get day off
|
|
187
|
+
---
|
|
188
|
+
tags:
|
|
189
|
+
- Crud
|
|
190
|
+
description: Retrieve a day off by its ID and return it as a JSON
|
|
191
|
+
object. Supports including relations.
|
|
192
|
+
parameters:
|
|
193
|
+
- in: path
|
|
194
|
+
name: instance_id
|
|
195
|
+
required: true
|
|
196
|
+
schema:
|
|
197
|
+
type: string
|
|
198
|
+
format: uuid
|
|
199
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
200
|
+
- in: query
|
|
201
|
+
name: relations
|
|
202
|
+
required: false
|
|
203
|
+
schema:
|
|
204
|
+
type: boolean
|
|
205
|
+
default: true
|
|
206
|
+
example: true
|
|
207
|
+
description: Whether to include relations
|
|
208
|
+
responses:
|
|
209
|
+
200:
|
|
210
|
+
description: Day off retrieved successfully
|
|
211
|
+
content:
|
|
212
|
+
application/json:
|
|
213
|
+
schema:
|
|
214
|
+
type: object
|
|
215
|
+
properties:
|
|
216
|
+
id:
|
|
217
|
+
type: string
|
|
218
|
+
format: uuid
|
|
219
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
220
|
+
date:
|
|
221
|
+
type: string
|
|
222
|
+
format: date
|
|
223
|
+
example: "2024-01-15"
|
|
224
|
+
end_date:
|
|
225
|
+
type: string
|
|
226
|
+
format: date
|
|
227
|
+
example: "2024-01-20"
|
|
228
|
+
person_id:
|
|
229
|
+
type: string
|
|
230
|
+
format: uuid
|
|
231
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
232
|
+
created_at:
|
|
233
|
+
type: string
|
|
234
|
+
format: date-time
|
|
235
|
+
example: "2024-01-15T10:30:00Z"
|
|
236
|
+
updated_at:
|
|
237
|
+
type: string
|
|
238
|
+
format: date-time
|
|
239
|
+
example: "2024-01-15T10:30:00Z"
|
|
240
|
+
400:
|
|
241
|
+
description: Invalid ID format or query error
|
|
242
|
+
"""
|
|
243
|
+
return super().get(instance_id)
|
|
244
|
+
|
|
245
|
+
@jwt_required()
|
|
246
|
+
def put(self, instance_id):
|
|
247
|
+
"""
|
|
248
|
+
Update day off
|
|
249
|
+
---
|
|
250
|
+
tags:
|
|
251
|
+
- Crud
|
|
252
|
+
description: Update a day off with data provided in the request
|
|
253
|
+
body. JSON format is expected. Deletes overlapping time spent
|
|
254
|
+
entries.
|
|
255
|
+
parameters:
|
|
256
|
+
- in: path
|
|
257
|
+
name: instance_id
|
|
258
|
+
required: true
|
|
259
|
+
schema:
|
|
260
|
+
type: string
|
|
261
|
+
format: uuid
|
|
262
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
263
|
+
requestBody:
|
|
264
|
+
required: true
|
|
265
|
+
content:
|
|
266
|
+
application/json:
|
|
267
|
+
schema:
|
|
268
|
+
type: object
|
|
269
|
+
properties:
|
|
270
|
+
date:
|
|
271
|
+
type: string
|
|
272
|
+
format: date
|
|
273
|
+
example: "2024-01-16"
|
|
274
|
+
end_date:
|
|
275
|
+
type: string
|
|
276
|
+
format: date
|
|
277
|
+
example: "2024-01-21"
|
|
278
|
+
responses:
|
|
279
|
+
200:
|
|
280
|
+
description: Day off updated successfully
|
|
281
|
+
content:
|
|
282
|
+
application/json:
|
|
283
|
+
schema:
|
|
284
|
+
type: object
|
|
285
|
+
properties:
|
|
286
|
+
id:
|
|
287
|
+
type: string
|
|
288
|
+
format: uuid
|
|
289
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
290
|
+
date:
|
|
291
|
+
type: string
|
|
292
|
+
format: date
|
|
293
|
+
example: "2024-01-16"
|
|
294
|
+
end_date:
|
|
295
|
+
type: string
|
|
296
|
+
format: date
|
|
297
|
+
example: "2024-01-21"
|
|
298
|
+
person_id:
|
|
299
|
+
type: string
|
|
300
|
+
format: uuid
|
|
301
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
302
|
+
created_at:
|
|
303
|
+
type: string
|
|
304
|
+
format: date-time
|
|
305
|
+
example: "2024-01-15T10:30:00Z"
|
|
306
|
+
updated_at:
|
|
307
|
+
type: string
|
|
308
|
+
format: date-time
|
|
309
|
+
example: "2024-01-15T11:00:00Z"
|
|
310
|
+
400:
|
|
311
|
+
description: Invalid data format or day off already exists
|
|
312
|
+
"""
|
|
313
|
+
return super().put(instance_id)
|
|
314
|
+
|
|
315
|
+
@jwt_required()
|
|
316
|
+
def delete(self, instance_id):
|
|
317
|
+
"""
|
|
318
|
+
Delete day off
|
|
319
|
+
---
|
|
320
|
+
tags:
|
|
321
|
+
- Crud
|
|
322
|
+
description: Delete a day off by its ID. Returns empty response
|
|
323
|
+
on success.
|
|
324
|
+
parameters:
|
|
325
|
+
- in: path
|
|
326
|
+
name: instance_id
|
|
327
|
+
required: true
|
|
328
|
+
schema:
|
|
329
|
+
type: string
|
|
330
|
+
format: uuid
|
|
331
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
332
|
+
responses:
|
|
333
|
+
204:
|
|
334
|
+
description: Day off deleted successfully
|
|
335
|
+
400:
|
|
336
|
+
description: Integrity error or cannot delete
|
|
337
|
+
"""
|
|
338
|
+
return super().delete(instance_id)
|
|
339
|
+
|
|
42
340
|
def check_delete_permissions(self, instance_dict):
|
|
43
341
|
return user_service.check_day_off_access(instance_dict)
|
|
44
342
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from flask_jwt_extended import jwt_required
|
|
2
|
+
|
|
1
3
|
from zou.app.blueprints.crud.base import BaseModelResource, BaseModelsResource
|
|
2
4
|
|
|
3
5
|
from zou.app.models.department import Department
|
|
@@ -12,6 +14,130 @@ class DepartmentsResource(BaseModelsResource):
|
|
|
12
14
|
def check_read_permissions(self, options=None):
|
|
13
15
|
return True
|
|
14
16
|
|
|
17
|
+
@jwt_required()
|
|
18
|
+
def get(self):
|
|
19
|
+
"""
|
|
20
|
+
Get departments
|
|
21
|
+
---
|
|
22
|
+
tags:
|
|
23
|
+
- Crud
|
|
24
|
+
description: Retrieve all departments. Supports filtering via query
|
|
25
|
+
parameters and pagination.
|
|
26
|
+
parameters:
|
|
27
|
+
- in: query
|
|
28
|
+
name: page
|
|
29
|
+
required: false
|
|
30
|
+
schema:
|
|
31
|
+
type: integer
|
|
32
|
+
example: 1
|
|
33
|
+
description: Page number for pagination
|
|
34
|
+
- in: query
|
|
35
|
+
name: limit
|
|
36
|
+
required: false
|
|
37
|
+
schema:
|
|
38
|
+
type: integer
|
|
39
|
+
example: 50
|
|
40
|
+
description: Number of results per page
|
|
41
|
+
- in: query
|
|
42
|
+
name: relations
|
|
43
|
+
required: false
|
|
44
|
+
schema:
|
|
45
|
+
type: boolean
|
|
46
|
+
default: false
|
|
47
|
+
example: false
|
|
48
|
+
description: Whether to include relations
|
|
49
|
+
responses:
|
|
50
|
+
200:
|
|
51
|
+
description: Departments retrieved successfully
|
|
52
|
+
content:
|
|
53
|
+
application/json:
|
|
54
|
+
schema:
|
|
55
|
+
oneOf:
|
|
56
|
+
- type: array
|
|
57
|
+
items:
|
|
58
|
+
type: object
|
|
59
|
+
- type: object
|
|
60
|
+
properties:
|
|
61
|
+
data:
|
|
62
|
+
type: array
|
|
63
|
+
items:
|
|
64
|
+
type: object
|
|
65
|
+
example: []
|
|
66
|
+
total:
|
|
67
|
+
type: integer
|
|
68
|
+
example: 100
|
|
69
|
+
nb_pages:
|
|
70
|
+
type: integer
|
|
71
|
+
example: 2
|
|
72
|
+
limit:
|
|
73
|
+
type: integer
|
|
74
|
+
example: 50
|
|
75
|
+
offset:
|
|
76
|
+
type: integer
|
|
77
|
+
example: 0
|
|
78
|
+
page:
|
|
79
|
+
type: integer
|
|
80
|
+
example: 1
|
|
81
|
+
400:
|
|
82
|
+
description: Invalid filter format or query error
|
|
83
|
+
"""
|
|
84
|
+
return super().get()
|
|
85
|
+
|
|
86
|
+
@jwt_required()
|
|
87
|
+
def post(self):
|
|
88
|
+
"""
|
|
89
|
+
Create department
|
|
90
|
+
---
|
|
91
|
+
tags:
|
|
92
|
+
- Crud
|
|
93
|
+
description: Create a new department with data provided in the
|
|
94
|
+
request body. JSON format is expected.
|
|
95
|
+
requestBody:
|
|
96
|
+
required: true
|
|
97
|
+
content:
|
|
98
|
+
application/json:
|
|
99
|
+
schema:
|
|
100
|
+
type: object
|
|
101
|
+
required:
|
|
102
|
+
- name
|
|
103
|
+
properties:
|
|
104
|
+
name:
|
|
105
|
+
type: string
|
|
106
|
+
example: Animation
|
|
107
|
+
color:
|
|
108
|
+
type: string
|
|
109
|
+
example: "#FF5733"
|
|
110
|
+
responses:
|
|
111
|
+
201:
|
|
112
|
+
description: Department created successfully
|
|
113
|
+
content:
|
|
114
|
+
application/json:
|
|
115
|
+
schema:
|
|
116
|
+
type: object
|
|
117
|
+
properties:
|
|
118
|
+
id:
|
|
119
|
+
type: string
|
|
120
|
+
format: uuid
|
|
121
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
122
|
+
name:
|
|
123
|
+
type: string
|
|
124
|
+
example: Animation
|
|
125
|
+
color:
|
|
126
|
+
type: string
|
|
127
|
+
example: "#FF5733"
|
|
128
|
+
created_at:
|
|
129
|
+
type: string
|
|
130
|
+
format: date-time
|
|
131
|
+
example: "2024-01-15T10:30:00Z"
|
|
132
|
+
updated_at:
|
|
133
|
+
type: string
|
|
134
|
+
format: date-time
|
|
135
|
+
example: "2024-01-15T10:30:00Z"
|
|
136
|
+
400:
|
|
137
|
+
description: Invalid data format or validation error
|
|
138
|
+
"""
|
|
139
|
+
return super().post()
|
|
140
|
+
|
|
15
141
|
def post_creation(self, instance):
|
|
16
142
|
tasks_service.clear_department_cache(str(instance.id))
|
|
17
143
|
return instance.serialize()
|
|
@@ -24,6 +150,148 @@ class DepartmentResource(BaseModelResource):
|
|
|
24
150
|
def check_read_permissions(self, instance):
|
|
25
151
|
return True
|
|
26
152
|
|
|
153
|
+
@jwt_required()
|
|
154
|
+
def get(self, instance_id):
|
|
155
|
+
"""
|
|
156
|
+
Get department
|
|
157
|
+
---
|
|
158
|
+
tags:
|
|
159
|
+
- Crud
|
|
160
|
+
description: Retrieve a department by its ID and return it as a
|
|
161
|
+
JSON object. Supports including relations.
|
|
162
|
+
parameters:
|
|
163
|
+
- in: path
|
|
164
|
+
name: instance_id
|
|
165
|
+
required: true
|
|
166
|
+
schema:
|
|
167
|
+
type: string
|
|
168
|
+
format: uuid
|
|
169
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
170
|
+
- in: query
|
|
171
|
+
name: relations
|
|
172
|
+
required: false
|
|
173
|
+
schema:
|
|
174
|
+
type: boolean
|
|
175
|
+
default: true
|
|
176
|
+
example: true
|
|
177
|
+
description: Whether to include relations
|
|
178
|
+
responses:
|
|
179
|
+
200:
|
|
180
|
+
description: Department retrieved successfully
|
|
181
|
+
content:
|
|
182
|
+
application/json:
|
|
183
|
+
schema:
|
|
184
|
+
type: object
|
|
185
|
+
properties:
|
|
186
|
+
id:
|
|
187
|
+
type: string
|
|
188
|
+
format: uuid
|
|
189
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
190
|
+
name:
|
|
191
|
+
type: string
|
|
192
|
+
example: Animation
|
|
193
|
+
color:
|
|
194
|
+
type: string
|
|
195
|
+
example: "#FF5733"
|
|
196
|
+
created_at:
|
|
197
|
+
type: string
|
|
198
|
+
format: date-time
|
|
199
|
+
example: "2024-01-15T10:30:00Z"
|
|
200
|
+
updated_at:
|
|
201
|
+
type: string
|
|
202
|
+
format: date-time
|
|
203
|
+
example: "2024-01-15T10:30:00Z"
|
|
204
|
+
400:
|
|
205
|
+
description: Invalid ID format or query error
|
|
206
|
+
"""
|
|
207
|
+
return super().get(instance_id)
|
|
208
|
+
|
|
209
|
+
@jwt_required()
|
|
210
|
+
def put(self, instance_id):
|
|
211
|
+
"""
|
|
212
|
+
Update department
|
|
213
|
+
---
|
|
214
|
+
tags:
|
|
215
|
+
- Crud
|
|
216
|
+
description: Update a department with data provided in the request
|
|
217
|
+
body. JSON format is expected.
|
|
218
|
+
parameters:
|
|
219
|
+
- in: path
|
|
220
|
+
name: instance_id
|
|
221
|
+
required: true
|
|
222
|
+
schema:
|
|
223
|
+
type: string
|
|
224
|
+
format: uuid
|
|
225
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
226
|
+
requestBody:
|
|
227
|
+
required: true
|
|
228
|
+
content:
|
|
229
|
+
application/json:
|
|
230
|
+
schema:
|
|
231
|
+
type: object
|
|
232
|
+
properties:
|
|
233
|
+
name:
|
|
234
|
+
type: string
|
|
235
|
+
example: Updated Animation
|
|
236
|
+
color:
|
|
237
|
+
type: string
|
|
238
|
+
example: "#FF5734"
|
|
239
|
+
responses:
|
|
240
|
+
200:
|
|
241
|
+
description: Department updated successfully
|
|
242
|
+
content:
|
|
243
|
+
application/json:
|
|
244
|
+
schema:
|
|
245
|
+
type: object
|
|
246
|
+
properties:
|
|
247
|
+
id:
|
|
248
|
+
type: string
|
|
249
|
+
format: uuid
|
|
250
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
251
|
+
name:
|
|
252
|
+
type: string
|
|
253
|
+
example: Updated Animation
|
|
254
|
+
color:
|
|
255
|
+
type: string
|
|
256
|
+
example: "#FF5734"
|
|
257
|
+
created_at:
|
|
258
|
+
type: string
|
|
259
|
+
format: date-time
|
|
260
|
+
example: "2024-01-15T10:30:00Z"
|
|
261
|
+
updated_at:
|
|
262
|
+
type: string
|
|
263
|
+
format: date-time
|
|
264
|
+
example: "2024-01-15T11:00:00Z"
|
|
265
|
+
400:
|
|
266
|
+
description: Invalid data format or validation error
|
|
267
|
+
"""
|
|
268
|
+
return super().put(instance_id)
|
|
269
|
+
|
|
270
|
+
@jwt_required()
|
|
271
|
+
def delete(self, instance_id):
|
|
272
|
+
"""
|
|
273
|
+
Delete department
|
|
274
|
+
---
|
|
275
|
+
tags:
|
|
276
|
+
- Crud
|
|
277
|
+
description: Delete a department by its ID. Returns empty response
|
|
278
|
+
on success.
|
|
279
|
+
parameters:
|
|
280
|
+
- in: path
|
|
281
|
+
name: instance_id
|
|
282
|
+
required: true
|
|
283
|
+
schema:
|
|
284
|
+
type: string
|
|
285
|
+
format: uuid
|
|
286
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
287
|
+
responses:
|
|
288
|
+
204:
|
|
289
|
+
description: Department deleted successfully
|
|
290
|
+
400:
|
|
291
|
+
description: Integrity error or cannot delete
|
|
292
|
+
"""
|
|
293
|
+
return super().delete(instance_id)
|
|
294
|
+
|
|
27
295
|
def post_update(self, instance_dict, data):
|
|
28
296
|
tasks_service.clear_department_cache(instance_dict["id"])
|
|
29
297
|
return instance_dict
|