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,4 +1,5 @@
|
|
|
1
1
|
from flask import current_app
|
|
2
|
+
from flask_jwt_extended import jwt_required
|
|
2
3
|
|
|
3
4
|
from zou.app.models.project import Project
|
|
4
5
|
from zou.app.models.entity import Entity
|
|
@@ -13,6 +14,83 @@ from zou.app.blueprints.source.shotgun.exception import (
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class ImportShotgunEpisodesResource(BaseImportShotgunResource):
|
|
17
|
+
@jwt_required()
|
|
18
|
+
def post(self):
|
|
19
|
+
"""
|
|
20
|
+
Import shotgun episodes
|
|
21
|
+
---
|
|
22
|
+
description: Import Shotgun episodes. Send a list of Shotgun episode
|
|
23
|
+
entries in the JSON body. Returns created or updated episodes.
|
|
24
|
+
tags:
|
|
25
|
+
- Import
|
|
26
|
+
requestBody:
|
|
27
|
+
required: true
|
|
28
|
+
content:
|
|
29
|
+
application/json:
|
|
30
|
+
schema:
|
|
31
|
+
type: array
|
|
32
|
+
items:
|
|
33
|
+
type: object
|
|
34
|
+
properties:
|
|
35
|
+
id:
|
|
36
|
+
type: integer
|
|
37
|
+
description: Shotgun ID of the episode
|
|
38
|
+
example: 12345
|
|
39
|
+
code:
|
|
40
|
+
type: string
|
|
41
|
+
description: Episode code
|
|
42
|
+
example: "EP01"
|
|
43
|
+
description:
|
|
44
|
+
type: string
|
|
45
|
+
description: Episode description
|
|
46
|
+
example: "First episode"
|
|
47
|
+
project:
|
|
48
|
+
type: object
|
|
49
|
+
description: Project information
|
|
50
|
+
properties:
|
|
51
|
+
name:
|
|
52
|
+
type: string
|
|
53
|
+
example: "My Project"
|
|
54
|
+
example:
|
|
55
|
+
- id: 12345
|
|
56
|
+
code: "EP01"
|
|
57
|
+
description: "First episode"
|
|
58
|
+
project:
|
|
59
|
+
name: "My Project"
|
|
60
|
+
responses:
|
|
61
|
+
200:
|
|
62
|
+
description: Episodes imported successfully
|
|
63
|
+
content:
|
|
64
|
+
application/json:
|
|
65
|
+
schema:
|
|
66
|
+
type: array
|
|
67
|
+
items:
|
|
68
|
+
type: object
|
|
69
|
+
properties:
|
|
70
|
+
id:
|
|
71
|
+
type: string
|
|
72
|
+
format: uuid
|
|
73
|
+
description: Episode unique identifier
|
|
74
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
75
|
+
name:
|
|
76
|
+
type: string
|
|
77
|
+
description: Episode name
|
|
78
|
+
example: "EP01"
|
|
79
|
+
created_at:
|
|
80
|
+
type: string
|
|
81
|
+
format: date-time
|
|
82
|
+
description: Creation timestamp
|
|
83
|
+
example: "2024-01-15T10:30:00Z"
|
|
84
|
+
updated_at:
|
|
85
|
+
type: string
|
|
86
|
+
format: date-time
|
|
87
|
+
description: Update timestamp
|
|
88
|
+
example: "2024-01-15T11:00:00Z"
|
|
89
|
+
400:
|
|
90
|
+
description: Invalid request body or data format error
|
|
91
|
+
"""
|
|
92
|
+
return super().post()
|
|
93
|
+
|
|
16
94
|
def prepare_import(self):
|
|
17
95
|
self.episode_type = shots_service.get_episode_type()
|
|
18
96
|
self.project_map = Project.get_id_map(field="name")
|
|
@@ -61,3 +139,49 @@ class ImportRemoveShotgunEpisodeResource(ImportRemoveShotgunBaseResource):
|
|
|
61
139
|
ImportRemoveShotgunBaseResource.__init__(
|
|
62
140
|
self, Entity, entity_type_id=shots_service.get_episode_type()["id"]
|
|
63
141
|
)
|
|
142
|
+
|
|
143
|
+
@jwt_required()
|
|
144
|
+
def post(self):
|
|
145
|
+
"""
|
|
146
|
+
Remove shotgun episode
|
|
147
|
+
---
|
|
148
|
+
description: Remove a Shotgun episode from the database. Provide the
|
|
149
|
+
Shotgun entry ID in the JSON body.
|
|
150
|
+
tags:
|
|
151
|
+
- Import
|
|
152
|
+
requestBody:
|
|
153
|
+
required: true
|
|
154
|
+
content:
|
|
155
|
+
application/json:
|
|
156
|
+
schema:
|
|
157
|
+
type: object
|
|
158
|
+
required:
|
|
159
|
+
- id
|
|
160
|
+
properties:
|
|
161
|
+
id:
|
|
162
|
+
type: integer
|
|
163
|
+
description: Shotgun ID of the episode to remove
|
|
164
|
+
example: 12345
|
|
165
|
+
example:
|
|
166
|
+
id: 12345
|
|
167
|
+
responses:
|
|
168
|
+
200:
|
|
169
|
+
description: Removal result returned
|
|
170
|
+
content:
|
|
171
|
+
application/json:
|
|
172
|
+
schema:
|
|
173
|
+
type: object
|
|
174
|
+
properties:
|
|
175
|
+
success:
|
|
176
|
+
type: boolean
|
|
177
|
+
description: Whether the removal was successful
|
|
178
|
+
example: true
|
|
179
|
+
removed_instance_id:
|
|
180
|
+
type: string
|
|
181
|
+
format: uuid
|
|
182
|
+
description: ID of the removed episode, if found
|
|
183
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
184
|
+
400:
|
|
185
|
+
description: Invalid request body or instance not found
|
|
186
|
+
"""
|
|
187
|
+
return super().post()
|
|
@@ -8,19 +8,49 @@ from zou.app.models.data_import_error import DataImportError
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ShotgunImportErrorsResource(Resource):
|
|
11
|
+
|
|
11
12
|
def __init__(self):
|
|
12
13
|
Resource.__init__(self)
|
|
13
14
|
|
|
14
15
|
@jwt_required()
|
|
15
16
|
def get(self):
|
|
16
17
|
"""
|
|
17
|
-
|
|
18
|
+
Get shotgun import errors
|
|
18
19
|
---
|
|
20
|
+
description: Get all Shotgun import errors from the database.
|
|
21
|
+
Returns a list of data import errors with source "shotgun".
|
|
19
22
|
tags:
|
|
20
23
|
- Import
|
|
21
24
|
responses:
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
200:
|
|
26
|
+
description: List of import errors retrieved successfully
|
|
27
|
+
content:
|
|
28
|
+
application/json:
|
|
29
|
+
schema:
|
|
30
|
+
type: array
|
|
31
|
+
items:
|
|
32
|
+
type: object
|
|
33
|
+
properties:
|
|
34
|
+
id:
|
|
35
|
+
type: string
|
|
36
|
+
format: uuid
|
|
37
|
+
description: Import error unique identifier
|
|
38
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
39
|
+
source:
|
|
40
|
+
type: string
|
|
41
|
+
description: Source of the import error
|
|
42
|
+
example: "shotgun"
|
|
43
|
+
event_data:
|
|
44
|
+
type: object
|
|
45
|
+
description: Error event data
|
|
46
|
+
example: {"error": "Import failed"}
|
|
47
|
+
created_at:
|
|
48
|
+
type: string
|
|
49
|
+
format: date-time
|
|
50
|
+
description: Creation timestamp
|
|
51
|
+
example: "2024-01-15T10:30:00Z"
|
|
52
|
+
400:
|
|
53
|
+
description: Invalid request
|
|
24
54
|
"""
|
|
25
55
|
criterions = {"source": "shotgun"}
|
|
26
56
|
import_errors = DataImportError.query.filter_by(**criterions).all()
|
|
@@ -29,13 +59,61 @@ class ShotgunImportErrorsResource(Resource):
|
|
|
29
59
|
@jwt_required()
|
|
30
60
|
def post(self):
|
|
31
61
|
"""
|
|
32
|
-
|
|
62
|
+
Create shotgun import error
|
|
33
63
|
---
|
|
64
|
+
description: Create a new Shotgun import error record. The error
|
|
65
|
+
event data should be provided in the JSON body.
|
|
34
66
|
tags:
|
|
35
67
|
- Import
|
|
68
|
+
requestBody:
|
|
69
|
+
required: true
|
|
70
|
+
content:
|
|
71
|
+
application/json:
|
|
72
|
+
schema:
|
|
73
|
+
type: object
|
|
74
|
+
description: Error event data
|
|
75
|
+
properties:
|
|
76
|
+
error:
|
|
77
|
+
type: string
|
|
78
|
+
description: Error message
|
|
79
|
+
example: "Failed to import asset"
|
|
80
|
+
details:
|
|
81
|
+
type: object
|
|
82
|
+
description: Additional error details
|
|
83
|
+
example: {"shotgun_id": 12345, "reason": "Missing field"}
|
|
84
|
+
example:
|
|
85
|
+
error: "Failed to import asset"
|
|
86
|
+
details:
|
|
87
|
+
shotgun_id: 12345
|
|
88
|
+
reason: "Missing required field"
|
|
36
89
|
responses:
|
|
37
|
-
|
|
38
|
-
|
|
90
|
+
201:
|
|
91
|
+
description: Import error created successfully
|
|
92
|
+
content:
|
|
93
|
+
application/json:
|
|
94
|
+
schema:
|
|
95
|
+
type: object
|
|
96
|
+
properties:
|
|
97
|
+
id:
|
|
98
|
+
type: string
|
|
99
|
+
format: uuid
|
|
100
|
+
description: Import error unique identifier
|
|
101
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
102
|
+
source:
|
|
103
|
+
type: string
|
|
104
|
+
description: Source of the import error
|
|
105
|
+
example: "shotgun"
|
|
106
|
+
event_data:
|
|
107
|
+
type: object
|
|
108
|
+
description: Error event data
|
|
109
|
+
example: {"error": "Failed to import asset"}
|
|
110
|
+
created_at:
|
|
111
|
+
type: string
|
|
112
|
+
format: date-time
|
|
113
|
+
description: Creation timestamp
|
|
114
|
+
example: "2024-01-15T10:30:00Z"
|
|
115
|
+
400:
|
|
116
|
+
description: Invalid request body
|
|
39
117
|
"""
|
|
40
118
|
error = DataImportError(event_data=request.json, source="shotgun")
|
|
41
119
|
error.save()
|
|
@@ -49,22 +127,35 @@ class ShotgunImportErrorResource(Resource):
|
|
|
49
127
|
@jwt_required()
|
|
50
128
|
def delete(self, error_id):
|
|
51
129
|
"""
|
|
52
|
-
Delete error
|
|
130
|
+
Delete shotgun import error
|
|
53
131
|
---
|
|
132
|
+
description: Delete a Shotgun import error by its unique identifier.
|
|
133
|
+
Returns success confirmation when the error is deleted.
|
|
54
134
|
tags:
|
|
55
135
|
- Import
|
|
56
136
|
parameters:
|
|
57
137
|
- in: path
|
|
58
138
|
name: error_id
|
|
59
|
-
required:
|
|
60
|
-
|
|
61
|
-
|
|
139
|
+
required: true
|
|
140
|
+
schema:
|
|
141
|
+
type: string
|
|
142
|
+
format: uuid
|
|
143
|
+
description: Import error unique identifier
|
|
62
144
|
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
63
145
|
responses:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
146
|
+
204:
|
|
147
|
+
description: Import error deleted successfully
|
|
148
|
+
content:
|
|
149
|
+
application/json:
|
|
150
|
+
schema:
|
|
151
|
+
type: object
|
|
152
|
+
properties:
|
|
153
|
+
deletion_success:
|
|
154
|
+
type: boolean
|
|
155
|
+
description: Whether deletion was successful
|
|
156
|
+
example: true
|
|
157
|
+
400:
|
|
158
|
+
description: Invalid error ID format
|
|
68
159
|
"""
|
|
69
160
|
try:
|
|
70
161
|
error = DataImportError.get(error_id)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
|
|
3
3
|
from flask import current_app
|
|
4
|
+
from flask_jwt_extended import jwt_required
|
|
4
5
|
|
|
5
6
|
from zou.app.models.task import Task
|
|
6
7
|
from zou.app.models.comment import Comment
|
|
@@ -13,6 +14,91 @@ from zou.app.blueprints.source.shotgun.base import (
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class ImportShotgunNotesResource(BaseImportShotgunResource):
|
|
17
|
+
@jwt_required()
|
|
18
|
+
def post(self):
|
|
19
|
+
"""
|
|
20
|
+
Import shotgun notes
|
|
21
|
+
---
|
|
22
|
+
description: Import Shotgun notes (comments) linked to tasks. Send a
|
|
23
|
+
list of Shotgun note entries in the JSON body. Only notes linked to
|
|
24
|
+
tasks are imported. Returns created or updated comments.
|
|
25
|
+
tags:
|
|
26
|
+
- Import
|
|
27
|
+
requestBody:
|
|
28
|
+
required: true
|
|
29
|
+
content:
|
|
30
|
+
application/json:
|
|
31
|
+
schema:
|
|
32
|
+
type: array
|
|
33
|
+
items:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
id:
|
|
37
|
+
type: integer
|
|
38
|
+
description: Shotgun ID of the note
|
|
39
|
+
example: 12345
|
|
40
|
+
content:
|
|
41
|
+
type: string
|
|
42
|
+
description: Note content
|
|
43
|
+
example: "This is a comment"
|
|
44
|
+
tasks:
|
|
45
|
+
type: array
|
|
46
|
+
description: Linked tasks
|
|
47
|
+
items:
|
|
48
|
+
type: object
|
|
49
|
+
properties:
|
|
50
|
+
id:
|
|
51
|
+
type: integer
|
|
52
|
+
example: 67890
|
|
53
|
+
user:
|
|
54
|
+
type: object
|
|
55
|
+
description: User who created the note
|
|
56
|
+
properties:
|
|
57
|
+
id:
|
|
58
|
+
type: integer
|
|
59
|
+
example: 11111
|
|
60
|
+
created_at:
|
|
61
|
+
type: string
|
|
62
|
+
format: date-time
|
|
63
|
+
description: Creation timestamp
|
|
64
|
+
example: "2024-01-15T10:30:00Z"
|
|
65
|
+
example:
|
|
66
|
+
- id: 12345
|
|
67
|
+
content: "This is a comment"
|
|
68
|
+
tasks:
|
|
69
|
+
- id: 67890
|
|
70
|
+
user:
|
|
71
|
+
id: 11111
|
|
72
|
+
created_at: "2024-01-15T10:30:00Z"
|
|
73
|
+
responses:
|
|
74
|
+
200:
|
|
75
|
+
description: Notes imported successfully
|
|
76
|
+
content:
|
|
77
|
+
application/json:
|
|
78
|
+
schema:
|
|
79
|
+
type: array
|
|
80
|
+
items:
|
|
81
|
+
type: object
|
|
82
|
+
properties:
|
|
83
|
+
id:
|
|
84
|
+
type: string
|
|
85
|
+
format: uuid
|
|
86
|
+
description: Comment unique identifier
|
|
87
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
88
|
+
text:
|
|
89
|
+
type: string
|
|
90
|
+
description: Comment text
|
|
91
|
+
example: "This is a comment"
|
|
92
|
+
created_at:
|
|
93
|
+
type: string
|
|
94
|
+
format: date-time
|
|
95
|
+
description: Creation timestamp
|
|
96
|
+
example: "2024-01-15T10:30:00Z"
|
|
97
|
+
400:
|
|
98
|
+
description: Invalid request body or data format error
|
|
99
|
+
"""
|
|
100
|
+
return super().post()
|
|
101
|
+
|
|
16
102
|
def prepare_import(self):
|
|
17
103
|
self.person_ids = Person.get_id_map()
|
|
18
104
|
|
|
@@ -58,3 +144,49 @@ class ImportShotgunNotesResource(BaseImportShotgunResource):
|
|
|
58
144
|
class ImportRemoveShotgunNoteResource(ImportRemoveShotgunBaseResource):
|
|
59
145
|
def __init__(self):
|
|
60
146
|
ImportRemoveShotgunBaseResource.__init__(self, Comment)
|
|
147
|
+
|
|
148
|
+
@jwt_required()
|
|
149
|
+
def post(self):
|
|
150
|
+
"""
|
|
151
|
+
Remove shotgun note
|
|
152
|
+
---
|
|
153
|
+
description: Remove a Shotgun note (comment) from the database.
|
|
154
|
+
Provide the Shotgun entry ID in the JSON body.
|
|
155
|
+
tags:
|
|
156
|
+
- Import
|
|
157
|
+
requestBody:
|
|
158
|
+
required: true
|
|
159
|
+
content:
|
|
160
|
+
application/json:
|
|
161
|
+
schema:
|
|
162
|
+
type: object
|
|
163
|
+
required:
|
|
164
|
+
- id
|
|
165
|
+
properties:
|
|
166
|
+
id:
|
|
167
|
+
type: integer
|
|
168
|
+
description: Shotgun ID of the note to remove
|
|
169
|
+
example: 12345
|
|
170
|
+
example:
|
|
171
|
+
id: 12345
|
|
172
|
+
responses:
|
|
173
|
+
200:
|
|
174
|
+
description: Removal result returned
|
|
175
|
+
content:
|
|
176
|
+
application/json:
|
|
177
|
+
schema:
|
|
178
|
+
type: object
|
|
179
|
+
properties:
|
|
180
|
+
success:
|
|
181
|
+
type: boolean
|
|
182
|
+
description: Whether the removal was successful
|
|
183
|
+
example: true
|
|
184
|
+
removed_instance_id:
|
|
185
|
+
type: string
|
|
186
|
+
format: uuid
|
|
187
|
+
description: ID of the removed note, if found
|
|
188
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
189
|
+
400:
|
|
190
|
+
description: Invalid request body or instance not found
|
|
191
|
+
"""
|
|
192
|
+
return super().post()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from flask import current_app
|
|
2
|
+
from flask_jwt_extended import jwt_required
|
|
2
3
|
|
|
3
4
|
from zou.app import db
|
|
4
5
|
from zou.app.models.department import Department
|
|
@@ -17,6 +18,122 @@ class ImportShotgunPersonsResource(BaseImportShotgunResource):
|
|
|
17
18
|
def __init__(self):
|
|
18
19
|
BaseImportShotgunResource.__init__(self)
|
|
19
20
|
|
|
21
|
+
@jwt_required()
|
|
22
|
+
def post(self):
|
|
23
|
+
"""
|
|
24
|
+
Import shotgun persons
|
|
25
|
+
---
|
|
26
|
+
description: Import Shotgun persons (users). Send a list of Shotgun
|
|
27
|
+
person entries in the JSON body. Returns created or updated persons
|
|
28
|
+
with department associations.
|
|
29
|
+
tags:
|
|
30
|
+
- Import
|
|
31
|
+
requestBody:
|
|
32
|
+
required: true
|
|
33
|
+
content:
|
|
34
|
+
application/json:
|
|
35
|
+
schema:
|
|
36
|
+
type: array
|
|
37
|
+
items:
|
|
38
|
+
type: object
|
|
39
|
+
properties:
|
|
40
|
+
id:
|
|
41
|
+
type: integer
|
|
42
|
+
description: Shotgun ID of the person
|
|
43
|
+
example: 12345
|
|
44
|
+
firstname:
|
|
45
|
+
type: string
|
|
46
|
+
description: First name
|
|
47
|
+
example: "John"
|
|
48
|
+
lastname:
|
|
49
|
+
type: string
|
|
50
|
+
description: Last name
|
|
51
|
+
example: "Doe"
|
|
52
|
+
email:
|
|
53
|
+
type: string
|
|
54
|
+
format: email
|
|
55
|
+
description: Email address
|
|
56
|
+
example: "john.doe@example.com"
|
|
57
|
+
login:
|
|
58
|
+
type: string
|
|
59
|
+
description: Desktop login
|
|
60
|
+
example: "jdoe"
|
|
61
|
+
sg_status_list:
|
|
62
|
+
type: string
|
|
63
|
+
description: Status list
|
|
64
|
+
example: "act"
|
|
65
|
+
permission_rule_set:
|
|
66
|
+
type: object
|
|
67
|
+
description: Permission rule set
|
|
68
|
+
properties:
|
|
69
|
+
name:
|
|
70
|
+
type: string
|
|
71
|
+
example: "Manager"
|
|
72
|
+
department:
|
|
73
|
+
type: object
|
|
74
|
+
description: Department information
|
|
75
|
+
properties:
|
|
76
|
+
name:
|
|
77
|
+
type: string
|
|
78
|
+
example: "Animation"
|
|
79
|
+
example:
|
|
80
|
+
- id: 12345
|
|
81
|
+
firstname: "John"
|
|
82
|
+
lastname: "Doe"
|
|
83
|
+
email: "john.doe@example.com"
|
|
84
|
+
login: "jdoe"
|
|
85
|
+
sg_status_list: "act"
|
|
86
|
+
permission_rule_set:
|
|
87
|
+
name: "Manager"
|
|
88
|
+
department:
|
|
89
|
+
name: "Animation"
|
|
90
|
+
responses:
|
|
91
|
+
200:
|
|
92
|
+
description: Persons imported successfully
|
|
93
|
+
content:
|
|
94
|
+
application/json:
|
|
95
|
+
schema:
|
|
96
|
+
type: array
|
|
97
|
+
items:
|
|
98
|
+
type: object
|
|
99
|
+
properties:
|
|
100
|
+
id:
|
|
101
|
+
type: string
|
|
102
|
+
format: uuid
|
|
103
|
+
description: Person unique identifier
|
|
104
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
105
|
+
first_name:
|
|
106
|
+
type: string
|
|
107
|
+
description: First name
|
|
108
|
+
example: "John"
|
|
109
|
+
last_name:
|
|
110
|
+
type: string
|
|
111
|
+
description: Last name
|
|
112
|
+
example: "Doe"
|
|
113
|
+
email:
|
|
114
|
+
type: string
|
|
115
|
+
format: email
|
|
116
|
+
description: Email address
|
|
117
|
+
example: "john.doe@example.com"
|
|
118
|
+
role:
|
|
119
|
+
type: string
|
|
120
|
+
description: User role
|
|
121
|
+
example: "manager"
|
|
122
|
+
created_at:
|
|
123
|
+
type: string
|
|
124
|
+
format: date-time
|
|
125
|
+
description: Creation timestamp
|
|
126
|
+
example: "2024-01-15T10:30:00Z"
|
|
127
|
+
updated_at:
|
|
128
|
+
type: string
|
|
129
|
+
format: date-time
|
|
130
|
+
description: Update timestamp
|
|
131
|
+
example: "2024-01-15T11:00:00Z"
|
|
132
|
+
400:
|
|
133
|
+
description: Invalid request body or data format error
|
|
134
|
+
"""
|
|
135
|
+
return super().post()
|
|
136
|
+
|
|
20
137
|
def extract_data(self, sg_person):
|
|
21
138
|
is_active = sg_person.get("sg_status_list", "act") == "act"
|
|
22
139
|
role = "user"
|
|
@@ -97,3 +214,49 @@ class ImportShotgunPersonsResource(BaseImportShotgunResource):
|
|
|
97
214
|
class ImportRemoveShotgunPersonResource(ImportRemoveShotgunBaseResource):
|
|
98
215
|
def __init__(self):
|
|
99
216
|
ImportRemoveShotgunBaseResource.__init__(self, Person)
|
|
217
|
+
|
|
218
|
+
@jwt_required()
|
|
219
|
+
def post(self):
|
|
220
|
+
"""
|
|
221
|
+
Remove shotgun person
|
|
222
|
+
---
|
|
223
|
+
description: Remove a Shotgun person (user) from the database. Provide
|
|
224
|
+
the Shotgun entry ID in the JSON body.
|
|
225
|
+
tags:
|
|
226
|
+
- Import
|
|
227
|
+
requestBody:
|
|
228
|
+
required: true
|
|
229
|
+
content:
|
|
230
|
+
application/json:
|
|
231
|
+
schema:
|
|
232
|
+
type: object
|
|
233
|
+
required:
|
|
234
|
+
- id
|
|
235
|
+
properties:
|
|
236
|
+
id:
|
|
237
|
+
type: integer
|
|
238
|
+
description: Shotgun ID of the person to remove
|
|
239
|
+
example: 12345
|
|
240
|
+
example:
|
|
241
|
+
id: 12345
|
|
242
|
+
responses:
|
|
243
|
+
200:
|
|
244
|
+
description: Removal result returned
|
|
245
|
+
content:
|
|
246
|
+
application/json:
|
|
247
|
+
schema:
|
|
248
|
+
type: object
|
|
249
|
+
properties:
|
|
250
|
+
success:
|
|
251
|
+
type: boolean
|
|
252
|
+
description: Whether the removal was successful
|
|
253
|
+
example: true
|
|
254
|
+
removed_instance_id:
|
|
255
|
+
type: string
|
|
256
|
+
format: uuid
|
|
257
|
+
description: ID of the removed person, if found
|
|
258
|
+
example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
259
|
+
400:
|
|
260
|
+
description: Invalid request body or instance not found
|
|
261
|
+
"""
|
|
262
|
+
return super().post()
|