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.asset_instance import AssetInstance
|
|
2
4
|
|
|
3
5
|
from zou.app.services import assets_service, user_service
|
|
@@ -10,12 +12,282 @@ class AssetInstancesResource(BaseModelsResource):
|
|
|
10
12
|
def __init__(self):
|
|
11
13
|
BaseModelsResource.__init__(self, AssetInstance)
|
|
12
14
|
|
|
15
|
+
@jwt_required()
|
|
16
|
+
def get(self):
|
|
17
|
+
"""
|
|
18
|
+
Get asset instances
|
|
19
|
+
---
|
|
20
|
+
tags:
|
|
21
|
+
- Crud
|
|
22
|
+
description: Retrieve all asset instances. Supports filtering via
|
|
23
|
+
query parameters and pagination.
|
|
24
|
+
parameters:
|
|
25
|
+
- in: query
|
|
26
|
+
name: page
|
|
27
|
+
required: false
|
|
28
|
+
schema:
|
|
29
|
+
type: integer
|
|
30
|
+
example: 1
|
|
31
|
+
description: Page number for pagination
|
|
32
|
+
- in: query
|
|
33
|
+
name: limit
|
|
34
|
+
required: false
|
|
35
|
+
schema:
|
|
36
|
+
type: integer
|
|
37
|
+
example: 50
|
|
38
|
+
description: Number of results per page
|
|
39
|
+
- in: query
|
|
40
|
+
name: relations
|
|
41
|
+
required: false
|
|
42
|
+
schema:
|
|
43
|
+
type: boolean
|
|
44
|
+
default: false
|
|
45
|
+
example: false
|
|
46
|
+
description: Whether to include relations
|
|
47
|
+
responses:
|
|
48
|
+
200:
|
|
49
|
+
description: Asset instances retrieved successfully
|
|
50
|
+
content:
|
|
51
|
+
application/json:
|
|
52
|
+
schema:
|
|
53
|
+
oneOf:
|
|
54
|
+
- type: array
|
|
55
|
+
items:
|
|
56
|
+
type: object
|
|
57
|
+
- type: object
|
|
58
|
+
properties:
|
|
59
|
+
data:
|
|
60
|
+
type: array
|
|
61
|
+
items:
|
|
62
|
+
type: object
|
|
63
|
+
example: []
|
|
64
|
+
total:
|
|
65
|
+
type: integer
|
|
66
|
+
example: 100
|
|
67
|
+
nb_pages:
|
|
68
|
+
type: integer
|
|
69
|
+
example: 2
|
|
70
|
+
limit:
|
|
71
|
+
type: integer
|
|
72
|
+
example: 50
|
|
73
|
+
offset:
|
|
74
|
+
type: integer
|
|
75
|
+
example: 0
|
|
76
|
+
page:
|
|
77
|
+
type: integer
|
|
78
|
+
example: 1
|
|
79
|
+
400:
|
|
80
|
+
description: Invalid filter format or query error
|
|
81
|
+
"""
|
|
82
|
+
return super().get()
|
|
83
|
+
|
|
84
|
+
@jwt_required()
|
|
85
|
+
def post(self):
|
|
86
|
+
"""
|
|
87
|
+
Create asset instance
|
|
88
|
+
---
|
|
89
|
+
tags:
|
|
90
|
+
- Crud
|
|
91
|
+
description: Create a new asset instance with data provided in the
|
|
92
|
+
request body. JSON format is expected.
|
|
93
|
+
requestBody:
|
|
94
|
+
required: true
|
|
95
|
+
content:
|
|
96
|
+
application/json:
|
|
97
|
+
schema:
|
|
98
|
+
type: object
|
|
99
|
+
required:
|
|
100
|
+
- asset_id
|
|
101
|
+
properties:
|
|
102
|
+
asset_id:
|
|
103
|
+
type: string
|
|
104
|
+
format: uuid
|
|
105
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
106
|
+
name:
|
|
107
|
+
type: string
|
|
108
|
+
example: Instance Name
|
|
109
|
+
responses:
|
|
110
|
+
201:
|
|
111
|
+
description: Asset instance created successfully
|
|
112
|
+
content:
|
|
113
|
+
application/json:
|
|
114
|
+
schema:
|
|
115
|
+
type: object
|
|
116
|
+
properties:
|
|
117
|
+
id:
|
|
118
|
+
type: string
|
|
119
|
+
format: uuid
|
|
120
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
121
|
+
asset_id:
|
|
122
|
+
type: string
|
|
123
|
+
format: uuid
|
|
124
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
125
|
+
name:
|
|
126
|
+
type: string
|
|
127
|
+
example: Instance Name
|
|
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
|
+
|
|
13
141
|
|
|
14
142
|
class AssetInstanceResource(BaseModelResource):
|
|
15
143
|
def __init__(self):
|
|
16
144
|
BaseModelResource.__init__(self, AssetInstance)
|
|
17
145
|
self.protected_fields.append("number")
|
|
18
146
|
|
|
147
|
+
@jwt_required()
|
|
148
|
+
def get(self, instance_id):
|
|
149
|
+
"""
|
|
150
|
+
Get asset instance
|
|
151
|
+
---
|
|
152
|
+
tags:
|
|
153
|
+
- Crud
|
|
154
|
+
description: Retrieve an asset instance by its ID and return it as a
|
|
155
|
+
JSON object. Supports including relations.
|
|
156
|
+
parameters:
|
|
157
|
+
- in: path
|
|
158
|
+
name: instance_id
|
|
159
|
+
required: true
|
|
160
|
+
schema:
|
|
161
|
+
type: string
|
|
162
|
+
format: uuid
|
|
163
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
164
|
+
- in: query
|
|
165
|
+
name: relations
|
|
166
|
+
required: false
|
|
167
|
+
schema:
|
|
168
|
+
type: boolean
|
|
169
|
+
default: true
|
|
170
|
+
example: true
|
|
171
|
+
description: Whether to include relations
|
|
172
|
+
responses:
|
|
173
|
+
200:
|
|
174
|
+
description: Asset instance retrieved successfully
|
|
175
|
+
content:
|
|
176
|
+
application/json:
|
|
177
|
+
schema:
|
|
178
|
+
type: object
|
|
179
|
+
properties:
|
|
180
|
+
id:
|
|
181
|
+
type: string
|
|
182
|
+
format: uuid
|
|
183
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
184
|
+
asset_id:
|
|
185
|
+
type: string
|
|
186
|
+
format: uuid
|
|
187
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
188
|
+
name:
|
|
189
|
+
type: string
|
|
190
|
+
example: Instance Name
|
|
191
|
+
number:
|
|
192
|
+
type: integer
|
|
193
|
+
example: 1
|
|
194
|
+
created_at:
|
|
195
|
+
type: string
|
|
196
|
+
format: date-time
|
|
197
|
+
example: "2024-01-15T10:30:00Z"
|
|
198
|
+
updated_at:
|
|
199
|
+
type: string
|
|
200
|
+
format: date-time
|
|
201
|
+
example: "2024-01-15T10:30:00Z"
|
|
202
|
+
400:
|
|
203
|
+
description: Invalid ID format or query error
|
|
204
|
+
"""
|
|
205
|
+
return super().get(instance_id)
|
|
206
|
+
|
|
207
|
+
@jwt_required()
|
|
208
|
+
def put(self, instance_id):
|
|
209
|
+
"""
|
|
210
|
+
Update asset instance
|
|
211
|
+
---
|
|
212
|
+
tags:
|
|
213
|
+
- Crud
|
|
214
|
+
description: Update an asset instance with data provided in the
|
|
215
|
+
request body. JSON format is expected.
|
|
216
|
+
parameters:
|
|
217
|
+
- in: path
|
|
218
|
+
name: instance_id
|
|
219
|
+
required: true
|
|
220
|
+
schema:
|
|
221
|
+
type: string
|
|
222
|
+
format: uuid
|
|
223
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
224
|
+
requestBody:
|
|
225
|
+
required: true
|
|
226
|
+
content:
|
|
227
|
+
application/json:
|
|
228
|
+
schema:
|
|
229
|
+
type: object
|
|
230
|
+
properties:
|
|
231
|
+
name:
|
|
232
|
+
type: string
|
|
233
|
+
example: Updated Instance Name
|
|
234
|
+
responses:
|
|
235
|
+
200:
|
|
236
|
+
description: Asset instance updated successfully
|
|
237
|
+
content:
|
|
238
|
+
application/json:
|
|
239
|
+
schema:
|
|
240
|
+
type: object
|
|
241
|
+
properties:
|
|
242
|
+
id:
|
|
243
|
+
type: string
|
|
244
|
+
format: uuid
|
|
245
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
246
|
+
asset_id:
|
|
247
|
+
type: string
|
|
248
|
+
format: uuid
|
|
249
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
250
|
+
name:
|
|
251
|
+
type: string
|
|
252
|
+
example: Updated Instance Name
|
|
253
|
+
created_at:
|
|
254
|
+
type: string
|
|
255
|
+
format: date-time
|
|
256
|
+
example: "2024-01-15T10:30:00Z"
|
|
257
|
+
updated_at:
|
|
258
|
+
type: string
|
|
259
|
+
format: date-time
|
|
260
|
+
example: "2024-01-15T11:00:00Z"
|
|
261
|
+
400:
|
|
262
|
+
description: Invalid data format or validation error
|
|
263
|
+
"""
|
|
264
|
+
return super().put(instance_id)
|
|
265
|
+
|
|
266
|
+
@jwt_required()
|
|
267
|
+
def delete(self, instance_id):
|
|
268
|
+
"""
|
|
269
|
+
Delete asset instance
|
|
270
|
+
---
|
|
271
|
+
tags:
|
|
272
|
+
- Crud
|
|
273
|
+
description: Delete an asset instance by its ID. Returns empty
|
|
274
|
+
response on success.
|
|
275
|
+
parameters:
|
|
276
|
+
- in: path
|
|
277
|
+
name: instance_id
|
|
278
|
+
required: true
|
|
279
|
+
schema:
|
|
280
|
+
type: string
|
|
281
|
+
format: uuid
|
|
282
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
283
|
+
responses:
|
|
284
|
+
204:
|
|
285
|
+
description: Asset instance deleted successfully
|
|
286
|
+
400:
|
|
287
|
+
description: Integrity error or cannot delete
|
|
288
|
+
"""
|
|
289
|
+
return super().delete(instance_id)
|
|
290
|
+
|
|
19
291
|
def check_read_permissions(self, instance):
|
|
20
292
|
if permissions.has_admin_permissions():
|
|
21
293
|
return True
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from flask_jwt_extended import jwt_required
|
|
2
|
+
|
|
1
3
|
from zou.app.models.attachment_file import AttachmentFile
|
|
2
4
|
|
|
3
5
|
from zou.app.blueprints.crud.base import BaseModelResource, BaseModelsResource
|
|
@@ -11,11 +13,272 @@ class AttachmentFilesResource(BaseModelsResource):
|
|
|
11
13
|
def __init__(self):
|
|
12
14
|
BaseModelsResource.__init__(self, AttachmentFile)
|
|
13
15
|
|
|
16
|
+
@jwt_required()
|
|
17
|
+
def get(self):
|
|
18
|
+
"""
|
|
19
|
+
Get attachment files
|
|
20
|
+
---
|
|
21
|
+
tags:
|
|
22
|
+
- Crud
|
|
23
|
+
description: Retrieve all attachment files. Supports filtering via
|
|
24
|
+
query parameters and pagination.
|
|
25
|
+
parameters:
|
|
26
|
+
- in: query
|
|
27
|
+
name: page
|
|
28
|
+
required: false
|
|
29
|
+
schema:
|
|
30
|
+
type: integer
|
|
31
|
+
example: 1
|
|
32
|
+
description: Page number for pagination
|
|
33
|
+
- in: query
|
|
34
|
+
name: limit
|
|
35
|
+
required: false
|
|
36
|
+
schema:
|
|
37
|
+
type: integer
|
|
38
|
+
example: 50
|
|
39
|
+
description: Number of results per page
|
|
40
|
+
- in: query
|
|
41
|
+
name: relations
|
|
42
|
+
required: false
|
|
43
|
+
schema:
|
|
44
|
+
type: boolean
|
|
45
|
+
default: false
|
|
46
|
+
example: false
|
|
47
|
+
description: Whether to include relations
|
|
48
|
+
responses:
|
|
49
|
+
200:
|
|
50
|
+
description: Attachment files retrieved successfully
|
|
51
|
+
content:
|
|
52
|
+
application/json:
|
|
53
|
+
schema:
|
|
54
|
+
oneOf:
|
|
55
|
+
- type: array
|
|
56
|
+
items:
|
|
57
|
+
type: object
|
|
58
|
+
- type: object
|
|
59
|
+
properties:
|
|
60
|
+
data:
|
|
61
|
+
type: array
|
|
62
|
+
items:
|
|
63
|
+
type: object
|
|
64
|
+
example: []
|
|
65
|
+
total:
|
|
66
|
+
type: integer
|
|
67
|
+
example: 100
|
|
68
|
+
nb_pages:
|
|
69
|
+
type: integer
|
|
70
|
+
example: 2
|
|
71
|
+
limit:
|
|
72
|
+
type: integer
|
|
73
|
+
example: 50
|
|
74
|
+
offset:
|
|
75
|
+
type: integer
|
|
76
|
+
example: 0
|
|
77
|
+
page:
|
|
78
|
+
type: integer
|
|
79
|
+
example: 1
|
|
80
|
+
400:
|
|
81
|
+
description: Invalid filter format or query error
|
|
82
|
+
"""
|
|
83
|
+
return super().get()
|
|
84
|
+
|
|
85
|
+
@jwt_required()
|
|
86
|
+
def post(self):
|
|
87
|
+
"""
|
|
88
|
+
Create attachment file
|
|
89
|
+
---
|
|
90
|
+
tags:
|
|
91
|
+
- Crud
|
|
92
|
+
description: Create a new attachment file with data provided in the
|
|
93
|
+
request body. JSON format is expected.
|
|
94
|
+
requestBody:
|
|
95
|
+
required: true
|
|
96
|
+
content:
|
|
97
|
+
application/json:
|
|
98
|
+
schema:
|
|
99
|
+
type: object
|
|
100
|
+
properties:
|
|
101
|
+
name:
|
|
102
|
+
type: string
|
|
103
|
+
example: attachment.pdf
|
|
104
|
+
comment_id:
|
|
105
|
+
type: string
|
|
106
|
+
format: uuid
|
|
107
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
108
|
+
responses:
|
|
109
|
+
201:
|
|
110
|
+
description: Attachment file created successfully
|
|
111
|
+
content:
|
|
112
|
+
application/json:
|
|
113
|
+
schema:
|
|
114
|
+
type: object
|
|
115
|
+
properties:
|
|
116
|
+
id:
|
|
117
|
+
type: string
|
|
118
|
+
format: uuid
|
|
119
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
120
|
+
name:
|
|
121
|
+
type: string
|
|
122
|
+
example: attachment.pdf
|
|
123
|
+
comment_id:
|
|
124
|
+
type: string
|
|
125
|
+
format: uuid
|
|
126
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
127
|
+
created_at:
|
|
128
|
+
type: string
|
|
129
|
+
format: date-time
|
|
130
|
+
example: "2024-01-15T10:30:00Z"
|
|
131
|
+
updated_at:
|
|
132
|
+
type: string
|
|
133
|
+
format: date-time
|
|
134
|
+
example: "2024-01-15T10:30:00Z"
|
|
135
|
+
400:
|
|
136
|
+
description: Invalid data format or validation error
|
|
137
|
+
"""
|
|
138
|
+
return super().post()
|
|
139
|
+
|
|
14
140
|
|
|
15
141
|
class AttachmentFileResource(BaseModelResource):
|
|
16
142
|
def __init__(self):
|
|
17
143
|
BaseModelResource.__init__(self, AttachmentFile)
|
|
18
144
|
|
|
145
|
+
@jwt_required()
|
|
146
|
+
def get(self, instance_id):
|
|
147
|
+
"""
|
|
148
|
+
Get attachment file
|
|
149
|
+
---
|
|
150
|
+
tags:
|
|
151
|
+
- Crud
|
|
152
|
+
description: Retrieve an attachment file by its ID and return it
|
|
153
|
+
as a JSON object. Supports including relations.
|
|
154
|
+
parameters:
|
|
155
|
+
- in: path
|
|
156
|
+
name: instance_id
|
|
157
|
+
required: true
|
|
158
|
+
schema:
|
|
159
|
+
type: string
|
|
160
|
+
format: uuid
|
|
161
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
162
|
+
- in: query
|
|
163
|
+
name: relations
|
|
164
|
+
required: false
|
|
165
|
+
schema:
|
|
166
|
+
type: boolean
|
|
167
|
+
default: true
|
|
168
|
+
example: true
|
|
169
|
+
description: Whether to include relations
|
|
170
|
+
responses:
|
|
171
|
+
200:
|
|
172
|
+
description: Attachment file retrieved successfully
|
|
173
|
+
content:
|
|
174
|
+
application/json:
|
|
175
|
+
schema:
|
|
176
|
+
type: object
|
|
177
|
+
properties:
|
|
178
|
+
id:
|
|
179
|
+
type: string
|
|
180
|
+
format: uuid
|
|
181
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
182
|
+
name:
|
|
183
|
+
type: string
|
|
184
|
+
example: attachment.pdf
|
|
185
|
+
comment_id:
|
|
186
|
+
type: string
|
|
187
|
+
format: uuid
|
|
188
|
+
example: b24a6ea4-ce75-4665-a070-57453082c25
|
|
189
|
+
created_at:
|
|
190
|
+
type: string
|
|
191
|
+
format: date-time
|
|
192
|
+
example: "2024-01-15T10:30:00Z"
|
|
193
|
+
updated_at:
|
|
194
|
+
type: string
|
|
195
|
+
format: date-time
|
|
196
|
+
example: "2024-01-15T10:30:00Z"
|
|
197
|
+
400:
|
|
198
|
+
description: Invalid ID format or query error
|
|
199
|
+
"""
|
|
200
|
+
return super().get(instance_id)
|
|
201
|
+
|
|
202
|
+
@jwt_required()
|
|
203
|
+
def put(self, instance_id):
|
|
204
|
+
"""
|
|
205
|
+
Update attachment file
|
|
206
|
+
---
|
|
207
|
+
tags:
|
|
208
|
+
- Crud
|
|
209
|
+
description: Update an attachment file with data provided in the
|
|
210
|
+
request body. JSON format is expected.
|
|
211
|
+
parameters:
|
|
212
|
+
- in: path
|
|
213
|
+
name: instance_id
|
|
214
|
+
required: true
|
|
215
|
+
schema:
|
|
216
|
+
type: string
|
|
217
|
+
format: uuid
|
|
218
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
219
|
+
requestBody:
|
|
220
|
+
required: true
|
|
221
|
+
content:
|
|
222
|
+
application/json:
|
|
223
|
+
schema:
|
|
224
|
+
type: object
|
|
225
|
+
properties:
|
|
226
|
+
name:
|
|
227
|
+
type: string
|
|
228
|
+
example: updated_attachment.pdf
|
|
229
|
+
responses:
|
|
230
|
+
200:
|
|
231
|
+
description: Attachment file updated successfully
|
|
232
|
+
content:
|
|
233
|
+
application/json:
|
|
234
|
+
schema:
|
|
235
|
+
type: object
|
|
236
|
+
properties:
|
|
237
|
+
id:
|
|
238
|
+
type: string
|
|
239
|
+
format: uuid
|
|
240
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
241
|
+
name:
|
|
242
|
+
type: string
|
|
243
|
+
example: updated_attachment.pdf
|
|
244
|
+
created_at:
|
|
245
|
+
type: string
|
|
246
|
+
format: date-time
|
|
247
|
+
example: "2024-01-15T10:30:00Z"
|
|
248
|
+
updated_at:
|
|
249
|
+
type: string
|
|
250
|
+
format: date-time
|
|
251
|
+
example: "2024-01-15T11:00:00Z"
|
|
252
|
+
400:
|
|
253
|
+
description: Invalid data format or validation error
|
|
254
|
+
"""
|
|
255
|
+
return super().put(instance_id)
|
|
256
|
+
|
|
257
|
+
@jwt_required()
|
|
258
|
+
def delete(self, instance_id):
|
|
259
|
+
"""
|
|
260
|
+
Delete attachment file
|
|
261
|
+
---
|
|
262
|
+
tags:
|
|
263
|
+
- Crud
|
|
264
|
+
description: Delete an attachment file by its ID. Returns empty
|
|
265
|
+
response on success.
|
|
266
|
+
parameters:
|
|
267
|
+
- in: path
|
|
268
|
+
name: instance_id
|
|
269
|
+
required: true
|
|
270
|
+
schema:
|
|
271
|
+
type: string
|
|
272
|
+
format: uuid
|
|
273
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
274
|
+
responses:
|
|
275
|
+
204:
|
|
276
|
+
description: Attachment file deleted successfully
|
|
277
|
+
400:
|
|
278
|
+
description: Integrity error or cannot delete
|
|
279
|
+
"""
|
|
280
|
+
return super().delete(instance_id)
|
|
281
|
+
|
|
19
282
|
def check_read_permissions(self, instance):
|
|
20
283
|
attachment_file = instance
|
|
21
284
|
if attachment_file["comment_id"] is not None:
|