zou 0.20.82__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/assets/resources.py +1060 -153
- zou/app/blueprints/auth/resources.py +368 -238
- zou/app/blueprints/breakdown/resources.py +584 -94
- zou/app/blueprints/chats/resources.py +176 -37
- zou/app/blueprints/comments/resources.py +409 -150
- zou/app/blueprints/concepts/resources.py +443 -63
- 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/departments/resources.py +302 -68
- zou/app/blueprints/edits/resources.py +651 -81
- zou/app/blueprints/entities/resources.py +104 -39
- zou/app/blueprints/events/resources.py +96 -8
- 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/index/resources.py +49 -42
- zou/app/blueprints/news/resources.py +47 -27
- 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/blueprints/user/resources.py +1808 -215
- 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/app/swagger.py +100 -27
- zou/migrations/versions/a1b2c3d4e5f6_add_position_to_metadata_descriptor.py +32 -0
- {zou-0.20.82.dist-info → zou-0.20.84.dist-info}/METADATA +18 -18
- {zou-0.20.82.dist-info → zou-0.20.84.dist-info}/RECORD +114 -113
- {zou-0.20.82.dist-info → zou-0.20.84.dist-info}/WHEEL +0 -0
- {zou-0.20.82.dist-info → zou-0.20.84.dist-info}/entry_points.txt +0 -0
- {zou-0.20.82.dist-info → zou-0.20.84.dist-info}/licenses/LICENSE +0 -0
- {zou-0.20.82.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.task_type import TaskType
|
|
2
4
|
from zou.app.services.exception import WrongParameterException
|
|
3
5
|
from zou.app.services import tasks_service
|
|
@@ -12,6 +14,138 @@ class TaskTypesResource(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 task types
|
|
21
|
+
---
|
|
22
|
+
tags:
|
|
23
|
+
- Crud
|
|
24
|
+
description: Retrieve all task types. Supports filtering via
|
|
25
|
+
query 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: Task types 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 task type
|
|
90
|
+
---
|
|
91
|
+
tags:
|
|
92
|
+
- Crud
|
|
93
|
+
description: Create a new task type with data provided in the
|
|
94
|
+
request body. JSON format is expected. Task type names must
|
|
95
|
+
be unique.
|
|
96
|
+
requestBody:
|
|
97
|
+
required: true
|
|
98
|
+
content:
|
|
99
|
+
application/json:
|
|
100
|
+
schema:
|
|
101
|
+
type: object
|
|
102
|
+
required:
|
|
103
|
+
- name
|
|
104
|
+
- for_entity
|
|
105
|
+
properties:
|
|
106
|
+
name:
|
|
107
|
+
type: string
|
|
108
|
+
example: Animation
|
|
109
|
+
for_entity:
|
|
110
|
+
type: string
|
|
111
|
+
example: Shot
|
|
112
|
+
color:
|
|
113
|
+
type: string
|
|
114
|
+
example: "#FF5733"
|
|
115
|
+
responses:
|
|
116
|
+
201:
|
|
117
|
+
description: Task type created successfully
|
|
118
|
+
content:
|
|
119
|
+
application/json:
|
|
120
|
+
schema:
|
|
121
|
+
type: object
|
|
122
|
+
properties:
|
|
123
|
+
id:
|
|
124
|
+
type: string
|
|
125
|
+
format: uuid
|
|
126
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
127
|
+
name:
|
|
128
|
+
type: string
|
|
129
|
+
example: Animation
|
|
130
|
+
for_entity:
|
|
131
|
+
type: string
|
|
132
|
+
example: Shot
|
|
133
|
+
color:
|
|
134
|
+
type: string
|
|
135
|
+
example: "#FF5733"
|
|
136
|
+
created_at:
|
|
137
|
+
type: string
|
|
138
|
+
format: date-time
|
|
139
|
+
example: "2024-01-15T10:30:00Z"
|
|
140
|
+
updated_at:
|
|
141
|
+
type: string
|
|
142
|
+
format: date-time
|
|
143
|
+
example: "2024-01-15T10:30:00Z"
|
|
144
|
+
400:
|
|
145
|
+
description: Invalid data format or task type name already exists
|
|
146
|
+
"""
|
|
147
|
+
return super().post()
|
|
148
|
+
|
|
15
149
|
def update_data(self, data):
|
|
16
150
|
data = super().update_data(data)
|
|
17
151
|
name = data.get("name", None)
|
|
@@ -34,6 +168,155 @@ class TaskTypeResource(BaseModelResource):
|
|
|
34
168
|
def check_read_permissions(self, instance):
|
|
35
169
|
return True
|
|
36
170
|
|
|
171
|
+
@jwt_required()
|
|
172
|
+
def get(self, instance_id):
|
|
173
|
+
"""
|
|
174
|
+
Get task type
|
|
175
|
+
---
|
|
176
|
+
tags:
|
|
177
|
+
- Crud
|
|
178
|
+
description: Retrieve a task type by its ID and return it as a
|
|
179
|
+
JSON object. Supports including relations.
|
|
180
|
+
parameters:
|
|
181
|
+
- in: path
|
|
182
|
+
name: instance_id
|
|
183
|
+
required: true
|
|
184
|
+
schema:
|
|
185
|
+
type: string
|
|
186
|
+
format: uuid
|
|
187
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
188
|
+
- in: query
|
|
189
|
+
name: relations
|
|
190
|
+
required: false
|
|
191
|
+
schema:
|
|
192
|
+
type: boolean
|
|
193
|
+
default: true
|
|
194
|
+
example: true
|
|
195
|
+
description: Whether to include relations
|
|
196
|
+
responses:
|
|
197
|
+
200:
|
|
198
|
+
description: Task type retrieved successfully
|
|
199
|
+
content:
|
|
200
|
+
application/json:
|
|
201
|
+
schema:
|
|
202
|
+
type: object
|
|
203
|
+
properties:
|
|
204
|
+
id:
|
|
205
|
+
type: string
|
|
206
|
+
format: uuid
|
|
207
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
208
|
+
name:
|
|
209
|
+
type: string
|
|
210
|
+
example: Animation
|
|
211
|
+
for_entity:
|
|
212
|
+
type: string
|
|
213
|
+
example: Shot
|
|
214
|
+
color:
|
|
215
|
+
type: string
|
|
216
|
+
example: "#FF5733"
|
|
217
|
+
created_at:
|
|
218
|
+
type: string
|
|
219
|
+
format: date-time
|
|
220
|
+
example: "2024-01-15T10:30:00Z"
|
|
221
|
+
updated_at:
|
|
222
|
+
type: string
|
|
223
|
+
format: date-time
|
|
224
|
+
example: "2024-01-15T10:30:00Z"
|
|
225
|
+
400:
|
|
226
|
+
description: Invalid ID format or query error
|
|
227
|
+
"""
|
|
228
|
+
return super().get(instance_id)
|
|
229
|
+
|
|
230
|
+
@jwt_required()
|
|
231
|
+
def put(self, instance_id):
|
|
232
|
+
"""
|
|
233
|
+
Update task type
|
|
234
|
+
---
|
|
235
|
+
tags:
|
|
236
|
+
- Crud
|
|
237
|
+
description: Update a task type with data provided in the
|
|
238
|
+
request body. JSON format is expected. Task type names must
|
|
239
|
+
be unique.
|
|
240
|
+
parameters:
|
|
241
|
+
- in: path
|
|
242
|
+
name: instance_id
|
|
243
|
+
required: true
|
|
244
|
+
schema:
|
|
245
|
+
type: string
|
|
246
|
+
format: uuid
|
|
247
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
248
|
+
requestBody:
|
|
249
|
+
required: true
|
|
250
|
+
content:
|
|
251
|
+
application/json:
|
|
252
|
+
schema:
|
|
253
|
+
type: object
|
|
254
|
+
properties:
|
|
255
|
+
name:
|
|
256
|
+
type: string
|
|
257
|
+
example: Updated Animation
|
|
258
|
+
color:
|
|
259
|
+
type: string
|
|
260
|
+
example: "#FF5734"
|
|
261
|
+
responses:
|
|
262
|
+
200:
|
|
263
|
+
description: Task type updated successfully
|
|
264
|
+
content:
|
|
265
|
+
application/json:
|
|
266
|
+
schema:
|
|
267
|
+
type: object
|
|
268
|
+
properties:
|
|
269
|
+
id:
|
|
270
|
+
type: string
|
|
271
|
+
format: uuid
|
|
272
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
273
|
+
name:
|
|
274
|
+
type: string
|
|
275
|
+
example: Updated Animation
|
|
276
|
+
for_entity:
|
|
277
|
+
type: string
|
|
278
|
+
example: Shot
|
|
279
|
+
color:
|
|
280
|
+
type: string
|
|
281
|
+
example: "#FF5734"
|
|
282
|
+
created_at:
|
|
283
|
+
type: string
|
|
284
|
+
format: date-time
|
|
285
|
+
example: "2024-01-15T10:30:00Z"
|
|
286
|
+
updated_at:
|
|
287
|
+
type: string
|
|
288
|
+
format: date-time
|
|
289
|
+
example: "2024-01-15T11:00:00Z"
|
|
290
|
+
400:
|
|
291
|
+
description: Invalid data format or task type name already exists
|
|
292
|
+
"""
|
|
293
|
+
return super().put(instance_id)
|
|
294
|
+
|
|
295
|
+
@jwt_required()
|
|
296
|
+
def delete(self, instance_id):
|
|
297
|
+
"""
|
|
298
|
+
Delete task type
|
|
299
|
+
---
|
|
300
|
+
tags:
|
|
301
|
+
- Crud
|
|
302
|
+
description: Delete a task type by its ID. Returns empty
|
|
303
|
+
response on success.
|
|
304
|
+
parameters:
|
|
305
|
+
- in: path
|
|
306
|
+
name: instance_id
|
|
307
|
+
required: true
|
|
308
|
+
schema:
|
|
309
|
+
type: string
|
|
310
|
+
format: uuid
|
|
311
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
312
|
+
responses:
|
|
313
|
+
204:
|
|
314
|
+
description: Task type deleted successfully
|
|
315
|
+
400:
|
|
316
|
+
description: Integrity error or cannot delete
|
|
317
|
+
"""
|
|
318
|
+
return super().delete(instance_id)
|
|
319
|
+
|
|
37
320
|
def update_data(self, data, instance_id):
|
|
38
321
|
data = super().update_data(data, instance_id)
|
|
39
322
|
name = data.get("name", None)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from flask import abort
|
|
2
|
+
from flask_jwt_extended import jwt_required
|
|
2
3
|
|
|
3
4
|
from sqlalchemy import func
|
|
4
5
|
|
|
@@ -15,6 +16,169 @@ class TimeSpentsResource(BaseModelsResource):
|
|
|
15
16
|
def __init__(self):
|
|
16
17
|
BaseModelsResource.__init__(self, TimeSpent)
|
|
17
18
|
|
|
19
|
+
@jwt_required()
|
|
20
|
+
def get(self):
|
|
21
|
+
"""
|
|
22
|
+
Get time spents
|
|
23
|
+
---
|
|
24
|
+
tags:
|
|
25
|
+
- Crud
|
|
26
|
+
description: Retrieve all time spent records. Supports filtering
|
|
27
|
+
via query parameters and pagination. Supports date range
|
|
28
|
+
filtering with start_date and end_date.
|
|
29
|
+
parameters:
|
|
30
|
+
- in: query
|
|
31
|
+
name: page
|
|
32
|
+
required: false
|
|
33
|
+
schema:
|
|
34
|
+
type: integer
|
|
35
|
+
example: 1
|
|
36
|
+
description: Page number for pagination
|
|
37
|
+
- in: query
|
|
38
|
+
name: limit
|
|
39
|
+
required: false
|
|
40
|
+
schema:
|
|
41
|
+
type: integer
|
|
42
|
+
example: 50
|
|
43
|
+
description: Number of results per page
|
|
44
|
+
- in: query
|
|
45
|
+
name: relations
|
|
46
|
+
required: false
|
|
47
|
+
schema:
|
|
48
|
+
type: boolean
|
|
49
|
+
default: false
|
|
50
|
+
example: false
|
|
51
|
+
description: Whether to include relations
|
|
52
|
+
- in: query
|
|
53
|
+
name: start_date
|
|
54
|
+
required: false
|
|
55
|
+
schema:
|
|
56
|
+
type: string
|
|
57
|
+
format: date
|
|
58
|
+
example: "2024-01-01"
|
|
59
|
+
description: Start date for date range filter
|
|
60
|
+
- in: query
|
|
61
|
+
name: end_date
|
|
62
|
+
required: false
|
|
63
|
+
schema:
|
|
64
|
+
type: string
|
|
65
|
+
format: date
|
|
66
|
+
example: "2024-01-31"
|
|
67
|
+
description: End date for date range filter
|
|
68
|
+
responses:
|
|
69
|
+
200:
|
|
70
|
+
description: Time spent records retrieved successfully
|
|
71
|
+
content:
|
|
72
|
+
application/json:
|
|
73
|
+
schema:
|
|
74
|
+
oneOf:
|
|
75
|
+
- type: array
|
|
76
|
+
items:
|
|
77
|
+
type: object
|
|
78
|
+
- type: object
|
|
79
|
+
properties:
|
|
80
|
+
data:
|
|
81
|
+
type: array
|
|
82
|
+
items:
|
|
83
|
+
type: object
|
|
84
|
+
example: []
|
|
85
|
+
total:
|
|
86
|
+
type: integer
|
|
87
|
+
example: 100
|
|
88
|
+
nb_pages:
|
|
89
|
+
type: integer
|
|
90
|
+
example: 2
|
|
91
|
+
limit:
|
|
92
|
+
type: integer
|
|
93
|
+
example: 50
|
|
94
|
+
offset:
|
|
95
|
+
type: integer
|
|
96
|
+
example: 0
|
|
97
|
+
page:
|
|
98
|
+
type: integer
|
|
99
|
+
example: 1
|
|
100
|
+
400:
|
|
101
|
+
description: Invalid filter format or query error
|
|
102
|
+
"""
|
|
103
|
+
return super().get()
|
|
104
|
+
|
|
105
|
+
@jwt_required()
|
|
106
|
+
def post(self):
|
|
107
|
+
"""
|
|
108
|
+
Create time spent
|
|
109
|
+
---
|
|
110
|
+
tags:
|
|
111
|
+
- Crud
|
|
112
|
+
description: Create a new time spent record with data provided
|
|
113
|
+
in the request body. JSON format is expected. Updates task
|
|
114
|
+
duration automatically.
|
|
115
|
+
requestBody:
|
|
116
|
+
required: true
|
|
117
|
+
content:
|
|
118
|
+
application/json:
|
|
119
|
+
schema:
|
|
120
|
+
type: object
|
|
121
|
+
required:
|
|
122
|
+
- task_id
|
|
123
|
+
- person_id
|
|
124
|
+
- date
|
|
125
|
+
- duration
|
|
126
|
+
properties:
|
|
127
|
+
task_id:
|
|
128
|
+
type: string
|
|
129
|
+
format: uuid
|
|
130
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
131
|
+
person_id:
|
|
132
|
+
type: string
|
|
133
|
+
format: uuid
|
|
134
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
135
|
+
date:
|
|
136
|
+
type: string
|
|
137
|
+
format: date
|
|
138
|
+
example: "2024-01-15"
|
|
139
|
+
duration:
|
|
140
|
+
type: number
|
|
141
|
+
example: 8.5
|
|
142
|
+
responses:
|
|
143
|
+
201:
|
|
144
|
+
description: Time spent record created successfully
|
|
145
|
+
content:
|
|
146
|
+
application/json:
|
|
147
|
+
schema:
|
|
148
|
+
type: object
|
|
149
|
+
properties:
|
|
150
|
+
id:
|
|
151
|
+
type: string
|
|
152
|
+
format: uuid
|
|
153
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
154
|
+
task_id:
|
|
155
|
+
type: string
|
|
156
|
+
format: uuid
|
|
157
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
158
|
+
person_id:
|
|
159
|
+
type: string
|
|
160
|
+
format: uuid
|
|
161
|
+
example: c24a6ea4-ce75-4665-a070-57453082c25
|
|
162
|
+
date:
|
|
163
|
+
type: string
|
|
164
|
+
format: date
|
|
165
|
+
example: "2024-01-15"
|
|
166
|
+
duration:
|
|
167
|
+
type: number
|
|
168
|
+
example: 8.5
|
|
169
|
+
created_at:
|
|
170
|
+
type: string
|
|
171
|
+
format: date-time
|
|
172
|
+
example: "2024-01-15T10:30:00Z"
|
|
173
|
+
updated_at:
|
|
174
|
+
type: string
|
|
175
|
+
format: date-time
|
|
176
|
+
example: "2024-01-15T10:30:00Z"
|
|
177
|
+
400:
|
|
178
|
+
description: Invalid data format or validation error
|
|
179
|
+
"""
|
|
180
|
+
return super().post()
|
|
181
|
+
|
|
18
182
|
def apply_filters(self, query, options):
|
|
19
183
|
query = super(TimeSpentsResource, self).apply_filters(query, options)
|
|
20
184
|
start_date = options.get("start_date", None)
|
|
@@ -62,6 +226,169 @@ class TimeSpentResource(BaseModelResource):
|
|
|
62
226
|
instance_dict["task_id"], instance_dict["person_id"]
|
|
63
227
|
)
|
|
64
228
|
|
|
229
|
+
@jwt_required()
|
|
230
|
+
def get(self, instance_id):
|
|
231
|
+
"""
|
|
232
|
+
Get time spent
|
|
233
|
+
---
|
|
234
|
+
tags:
|
|
235
|
+
- Crud
|
|
236
|
+
description: Retrieve a time spent record by its ID and return
|
|
237
|
+
it as a JSON object. Supports including relations.
|
|
238
|
+
parameters:
|
|
239
|
+
- in: path
|
|
240
|
+
name: instance_id
|
|
241
|
+
required: true
|
|
242
|
+
schema:
|
|
243
|
+
type: string
|
|
244
|
+
format: uuid
|
|
245
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
246
|
+
- in: query
|
|
247
|
+
name: relations
|
|
248
|
+
required: false
|
|
249
|
+
schema:
|
|
250
|
+
type: boolean
|
|
251
|
+
default: true
|
|
252
|
+
example: true
|
|
253
|
+
description: Whether to include relations
|
|
254
|
+
responses:
|
|
255
|
+
200:
|
|
256
|
+
description: Time spent record retrieved successfully
|
|
257
|
+
content:
|
|
258
|
+
application/json:
|
|
259
|
+
schema:
|
|
260
|
+
type: object
|
|
261
|
+
properties:
|
|
262
|
+
id:
|
|
263
|
+
type: string
|
|
264
|
+
format: uuid
|
|
265
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
266
|
+
task_id:
|
|
267
|
+
type: string
|
|
268
|
+
format: uuid
|
|
269
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
270
|
+
person_id:
|
|
271
|
+
type: string
|
|
272
|
+
format: uuid
|
|
273
|
+
example: c24a6ea4-ce75-4665-a070-57453082c25
|
|
274
|
+
date:
|
|
275
|
+
type: string
|
|
276
|
+
format: date
|
|
277
|
+
example: "2024-01-15"
|
|
278
|
+
duration:
|
|
279
|
+
type: number
|
|
280
|
+
example: 8.5
|
|
281
|
+
created_at:
|
|
282
|
+
type: string
|
|
283
|
+
format: date-time
|
|
284
|
+
example: "2024-01-15T10:30:00Z"
|
|
285
|
+
updated_at:
|
|
286
|
+
type: string
|
|
287
|
+
format: date-time
|
|
288
|
+
example: "2024-01-15T10:30:00Z"
|
|
289
|
+
400:
|
|
290
|
+
description: Invalid ID format or query error
|
|
291
|
+
"""
|
|
292
|
+
return super().get(instance_id)
|
|
293
|
+
|
|
294
|
+
@jwt_required()
|
|
295
|
+
def put(self, instance_id):
|
|
296
|
+
"""
|
|
297
|
+
Update time spent
|
|
298
|
+
---
|
|
299
|
+
tags:
|
|
300
|
+
- Crud
|
|
301
|
+
description: Update a time spent record with data provided in
|
|
302
|
+
the request body. JSON format is expected. Updates task
|
|
303
|
+
duration automatically.
|
|
304
|
+
parameters:
|
|
305
|
+
- in: path
|
|
306
|
+
name: instance_id
|
|
307
|
+
required: true
|
|
308
|
+
schema:
|
|
309
|
+
type: string
|
|
310
|
+
format: uuid
|
|
311
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
312
|
+
requestBody:
|
|
313
|
+
required: true
|
|
314
|
+
content:
|
|
315
|
+
application/json:
|
|
316
|
+
schema:
|
|
317
|
+
type: object
|
|
318
|
+
properties:
|
|
319
|
+
date:
|
|
320
|
+
type: string
|
|
321
|
+
format: date
|
|
322
|
+
example: "2024-01-16"
|
|
323
|
+
duration:
|
|
324
|
+
type: number
|
|
325
|
+
example: 7.5
|
|
326
|
+
responses:
|
|
327
|
+
200:
|
|
328
|
+
description: Time spent record updated successfully
|
|
329
|
+
content:
|
|
330
|
+
application/json:
|
|
331
|
+
schema:
|
|
332
|
+
type: object
|
|
333
|
+
properties:
|
|
334
|
+
id:
|
|
335
|
+
type: string
|
|
336
|
+
format: uuid
|
|
337
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
338
|
+
task_id:
|
|
339
|
+
type: string
|
|
340
|
+
format: uuid
|
|
341
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
342
|
+
person_id:
|
|
343
|
+
type: string
|
|
344
|
+
format: uuid
|
|
345
|
+
example: c24a6ea4-ce75-4665-a070-57453082c25
|
|
346
|
+
date:
|
|
347
|
+
type: string
|
|
348
|
+
format: date
|
|
349
|
+
example: "2024-01-16"
|
|
350
|
+
duration:
|
|
351
|
+
type: number
|
|
352
|
+
example: 7.5
|
|
353
|
+
created_at:
|
|
354
|
+
type: string
|
|
355
|
+
format: date-time
|
|
356
|
+
example: "2024-01-15T10:30:00Z"
|
|
357
|
+
updated_at:
|
|
358
|
+
type: string
|
|
359
|
+
format: date-time
|
|
360
|
+
example: "2024-01-15T11:00:00Z"
|
|
361
|
+
400:
|
|
362
|
+
description: Invalid data format or validation error
|
|
363
|
+
"""
|
|
364
|
+
return super().put(instance_id)
|
|
365
|
+
|
|
366
|
+
@jwt_required()
|
|
367
|
+
def delete(self, instance_id):
|
|
368
|
+
"""
|
|
369
|
+
Delete time spent
|
|
370
|
+
---
|
|
371
|
+
tags:
|
|
372
|
+
- Crud
|
|
373
|
+
description: Delete a time spent record by its ID. Returns
|
|
374
|
+
empty response on success. Updates task duration
|
|
375
|
+
automatically.
|
|
376
|
+
parameters:
|
|
377
|
+
- in: path
|
|
378
|
+
name: instance_id
|
|
379
|
+
required: true
|
|
380
|
+
schema:
|
|
381
|
+
type: string
|
|
382
|
+
format: uuid
|
|
383
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
384
|
+
responses:
|
|
385
|
+
204:
|
|
386
|
+
description: Time spent record deleted successfully
|
|
387
|
+
400:
|
|
388
|
+
description: Integrity error or cannot delete
|
|
389
|
+
"""
|
|
390
|
+
return super().delete(instance_id)
|
|
391
|
+
|
|
65
392
|
def post_update(self, instance_dict, data):
|
|
66
393
|
task = Task.get(instance_dict["task_id"])
|
|
67
394
|
task.duration = sum(
|