zou 0.20.72__py3-none-any.whl → 0.20.74__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.
@@ -1,3 +1,4 @@
1
+ from flask import abort
1
2
  from flask_restful import Resource
2
3
  from flask_jwt_extended import jwt_required
3
4
 
@@ -13,7 +14,10 @@ from zou.app.services import (
13
14
  user_service,
14
15
  )
15
16
  from zou.app.utils import permissions
16
- from zou.app.services.exception import WrongParameterException
17
+ from zou.app.services.exception import (
18
+ WrongParameterException,
19
+ WrongDateFormatException,
20
+ )
17
21
  from zou.app.models.metadata_descriptor import METADATA_DESCRIPTOR_TYPES
18
22
 
19
23
 
@@ -32,8 +36,23 @@ class OpenProjectsResource(Resource, ArgsMixin):
32
36
  - Projects
33
37
  description: Most of the time, past projects are not needed.
34
38
  responses:
35
- 200:
36
- description: All running projects
39
+ '200':
40
+ description: All running projects
41
+ content:
42
+ application/json:
43
+ schema:
44
+ type: array
45
+ items:
46
+ type: object
47
+ properties:
48
+ id:
49
+ type: string
50
+ format: uuid
51
+ name:
52
+ type: string
53
+ project_status_id:
54
+ type: string
55
+ format: uuid
37
56
  """
38
57
  name = self.get_text_parameter("name")
39
58
  if permissions.has_admin_permissions():
@@ -57,8 +76,23 @@ class AllProjectsResource(Resource, ArgsMixin):
57
76
  - Projects
58
77
  description: Ensure that user has at least the manager level before that.
59
78
  responses:
60
- 200:
61
- description: All projects listed in database
79
+ '200':
80
+ description: All projects listed in database
81
+ content:
82
+ application/json:
83
+ schema:
84
+ type: array
85
+ items:
86
+ type: object
87
+ properties:
88
+ id:
89
+ type: string
90
+ format: uuid
91
+ name:
92
+ type: string
93
+ project_status_id:
94
+ type: string
95
+ format: uuid
62
96
  """
63
97
  name = self.get_text_parameter("name")
64
98
  try:
@@ -91,12 +125,31 @@ class ProductionTeamResource(Resource, ArgsMixin):
91
125
  - in: path
92
126
  name: project_id
93
127
  required: true
94
- type: string
95
- format: uuid
128
+ schema:
129
+ type: string
130
+ format: uuid
96
131
  example: a24a6ea4-ce75-4665-a070-57453082c25
97
132
  responses:
98
- 200:
99
- description: People listed in a production team
133
+ '200':
134
+ description: People listed in a production team
135
+ content:
136
+ application/json:
137
+ schema:
138
+ type: array
139
+ items:
140
+ type: object
141
+ properties:
142
+ id:
143
+ type: string
144
+ format: uuid
145
+ first_name:
146
+ type: string
147
+ last_name:
148
+ type: string
149
+ email:
150
+ type: string
151
+ '404':
152
+ description: Project not found
100
153
  """
101
154
  user_service.check_project_access(project_id)
102
155
  project = projects_service.get_project_raw(project_id)
@@ -119,18 +172,40 @@ class ProductionTeamResource(Resource, ArgsMixin):
119
172
  - in: path
120
173
  name: project_id
121
174
  required: true
122
- type: string
123
- format: uuid
124
- example: a24a6ea4-ce75-4665-a070-57453082c25
125
- - in: formData
126
- name: person_id
127
- required: True
128
- type: string
129
- format: uuid
130
- example: a24a6ea4-ce75-4665-a070-57453082c25
175
+ schema:
176
+ type: string
177
+ format: uuid
178
+ example: a24a6ea4-ce75-4665-a070-57453082c25
179
+ requestBody:
180
+ required: true
181
+ content:
182
+ application/x-www-form-urlencoded:
183
+ schema:
184
+ type: object
185
+ required:
186
+ - person_id
187
+ properties:
188
+ person_id:
189
+ type: string
190
+ format: uuid
191
+ example: a24a6ea4-ce75-4665-a070-57453082c25
131
192
  responses:
132
- 201:
133
- description: Person added to the production team
193
+ '201':
194
+ description: Person added to the production team
195
+ content:
196
+ application/json:
197
+ schema:
198
+ type: object
199
+ properties:
200
+ id:
201
+ type: string
202
+ format: uuid
203
+ name:
204
+ type: string
205
+ '400':
206
+ description: Invalid parameters
207
+ '404':
208
+ description: Project or person not found
134
209
  """
135
210
  args = self.get_args([("person_id", "", True)])
136
211
 
@@ -168,7 +243,9 @@ class ProductionTeamRemoveResource(Resource):
168
243
  example: a24a6ea4-ce75-4665-a070-57453082c25
169
244
  responses:
170
245
  204:
171
- description: Empty response
246
+ description: Person removed from production team
247
+ 404:
248
+ description: Project or person not found
172
249
  """
173
250
  user_service.check_manager_project_access(project_id)
174
251
  projects_service.remove_team_member(project_id, person_id)
@@ -191,18 +268,40 @@ class ProductionAssetTypeResource(Resource, ArgsMixin):
191
268
  - in: path
192
269
  name: project_id
193
270
  required: true
194
- type: string
195
- format: uuid
196
- example: a24a6ea4-ce75-4665-a070-57453082c25
197
- - in: formData
198
- name: asset_type_id
199
- required: True
200
- type: string
201
- format: uuid
202
- example: a24a6ea4-ce75-4665-a070-57453082c25
271
+ schema:
272
+ type: string
273
+ format: uuid
274
+ example: a24a6ea4-ce75-4665-a070-57453082c25
275
+ requestBody:
276
+ required: true
277
+ content:
278
+ application/x-www-form-urlencoded:
279
+ schema:
280
+ type: object
281
+ required:
282
+ - asset_type_id
283
+ properties:
284
+ asset_type_id:
285
+ type: string
286
+ format: uuid
287
+ example: a24a6ea4-ce75-4665-a070-57453082c25
203
288
  responses:
204
- 201:
205
- description: Asset type added to production
289
+ '201':
290
+ description: Asset type added to production
291
+ content:
292
+ application/json:
293
+ schema:
294
+ type: object
295
+ properties:
296
+ id:
297
+ type: string
298
+ format: uuid
299
+ name:
300
+ type: string
301
+ '400':
302
+ description: Invalid parameters
303
+ '404':
304
+ description: Project or asset type not found
206
305
  """
207
306
  args = self.get_args([("asset_type_id", "", True)])
208
307
 
@@ -290,23 +389,43 @@ class ProductionTaskTypeResource(Resource, ArgsMixin):
290
389
  - in: path
291
390
  name: project_id
292
391
  required: true
293
- type: string
294
- format: uuid
295
- example: a24a6ea4-ce75-4665-a070-57453082c25
296
- - in: formData
297
- name: task_type_id
298
- required: True
299
- type: string
300
- format: uuid
301
- example: a24a6ea4-ce75-4665-a070-57453082c25
302
- - in: formData
303
- name: priority
304
- required: False
305
- type: string
306
- default: "None"
392
+ schema:
393
+ type: string
394
+ format: uuid
395
+ example: a24a6ea4-ce75-4665-a070-57453082c25
396
+ requestBody:
397
+ required: true
398
+ content:
399
+ application/x-www-form-urlencoded:
400
+ schema:
401
+ type: object
402
+ required:
403
+ - task_type_id
404
+ properties:
405
+ task_type_id:
406
+ type: string
407
+ format: uuid
408
+ example: a24a6ea4-ce75-4665-a070-57453082c25
409
+ priority:
410
+ type: string
411
+ default: "None"
307
412
  responses:
308
- 201:
309
- description: Asset type added to production
413
+ '201':
414
+ description: Task type added to production
415
+ content:
416
+ application/json:
417
+ schema:
418
+ type: object
419
+ properties:
420
+ id:
421
+ type: string
422
+ format: uuid
423
+ name:
424
+ type: string
425
+ '400':
426
+ description: Invalid parameters
427
+ '404':
428
+ description: Project or task type not found
310
429
  """
311
430
  args = self.get_args(
312
431
  [("task_type_id", "", True), ("priority", None, False)]
@@ -382,7 +501,7 @@ class ProductionTaskStatusResource(Resource, ArgsMixin):
382
501
  @jwt_required()
383
502
  def post(self, project_id):
384
503
  """
385
- Add a task type linked to a production.
504
+ Add a task status linked to a production.
386
505
  ---
387
506
  tags:
388
507
  - Projects
@@ -390,18 +509,40 @@ class ProductionTaskStatusResource(Resource, ArgsMixin):
390
509
  - in: path
391
510
  name: project_id
392
511
  required: true
393
- type: string
394
- format: uuid
395
- example: a24a6ea4-ce75-4665-a070-57453082c25
396
- - in: formData
397
- name: task_status_id
398
- required: True
399
- type: string
400
- format: uuid
401
- example: a24a6ea4-ce75-4665-a070-57453082c25
512
+ schema:
513
+ type: string
514
+ format: uuid
515
+ example: a24a6ea4-ce75-4665-a070-57453082c25
516
+ requestBody:
517
+ required: true
518
+ content:
519
+ application/x-www-form-urlencoded:
520
+ schema:
521
+ type: object
522
+ required:
523
+ - task_status_id
524
+ properties:
525
+ task_status_id:
526
+ type: string
527
+ format: uuid
528
+ example: a24a6ea4-ce75-4665-a070-57453082c25
402
529
  responses:
403
- 201:
404
- description: Task type added to production
530
+ '201':
531
+ description: Task status added to production
532
+ content:
533
+ application/json:
534
+ schema:
535
+ type: object
536
+ properties:
537
+ id:
538
+ type: string
539
+ format: uuid
540
+ name:
541
+ type: string
542
+ '400':
543
+ description: Invalid parameters
544
+ '404':
545
+ description: Project or task status not found
405
546
  """
406
547
  args = self.get_args([("task_status_id", "", True)])
407
548
 
@@ -681,12 +822,63 @@ class ProductionMetadataDescriptorsResource(Resource, ArgsMixin):
681
822
  - in: path
682
823
  name: project_id
683
824
  required: true
684
- type: string
685
- format: uuid
686
- example: a24a6ea4-ce75-4665-a070-57453082c25
825
+ schema:
826
+ type: string
827
+ format: uuid
828
+ example: a24a6ea4-ce75-4665-a070-57453082c25
829
+ requestBody:
830
+ required: true
831
+ content:
832
+ application/x-www-form-urlencoded:
833
+ schema:
834
+ type: object
835
+ required:
836
+ - name
837
+ - data_type
838
+ properties:
839
+ entity_type:
840
+ type: string
841
+ default: "Asset"
842
+ enum: ["Asset", "Shot", "Edit", "Episode", "Sequence"]
843
+ name:
844
+ type: string
845
+ description: Name of the metadata descriptor
846
+ data_type:
847
+ type: string
848
+ description: Type of data (string, number, boolean, etc.)
849
+ for_client:
850
+ type: string
851
+ default: "False"
852
+ example: "True"
853
+ choices:
854
+ type: array
855
+ items:
856
+ type: string
857
+ example: ["option1", "option2"]
858
+ departments:
859
+ type: array
860
+ items:
861
+ type: string
862
+ example: ["department1", "department2"]
687
863
  responses:
688
- 201:
689
- description: Create a new metadata descriptor
864
+ '201':
865
+ description: Metadata descriptor created
866
+ content:
867
+ application/json:
868
+ schema:
869
+ type: object
870
+ properties:
871
+ id:
872
+ type: string
873
+ format: uuid
874
+ name:
875
+ type: string
876
+ data_type:
877
+ type: string
878
+ '400':
879
+ description: Invalid parameters
880
+ '404':
881
+ description: Project not found
690
882
  """
691
883
  args = self.get_args(
692
884
  [
@@ -799,19 +991,24 @@ class ProductionMetadataDescriptorResource(Resource, ArgsMixin):
799
991
  required: False
800
992
  - in: formData
801
993
  name: for_client
802
- required: True
803
- type: boolean
804
- default: False
805
- required: False
994
+ required: false
995
+ type: string
996
+ default: "False"
997
+ example: "True"
806
998
  - in: formData
807
999
  name: choices
808
- required: True
1000
+ required: false
809
1001
  type: array
810
- required: False
1002
+ items:
1003
+ type: string
1004
+ example: ["option1", "option2"]
811
1005
  - in: formData
812
1006
  name: departments
1007
+ required: false
813
1008
  type: array
814
- required: False
1009
+ items:
1010
+ type: string
1011
+ example: ["department1", "department2"]
815
1012
  responses:
816
1013
  200:
817
1014
  description: Metadata descriptor updated
@@ -1132,22 +1329,45 @@ class ProductionBudgetsResource(Resource, ArgsMixin):
1132
1329
  - in: path
1133
1330
  name: project_id
1134
1331
  required: true
1135
- type: string
1136
- format: uuid
1137
- example: a24a6ea4-ce75-4665-a070-57453082c25
1138
- - in: formData
1139
- name: name
1140
- required: true
1141
- type: string
1142
- example: "New Budget"
1143
- - in: formData
1144
- name: currency
1145
- required: false
1146
- type: string
1147
- example: "USD"
1332
+ schema:
1333
+ type: string
1334
+ format: uuid
1335
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1336
+ requestBody:
1337
+ required: true
1338
+ content:
1339
+ application/x-www-form-urlencoded:
1340
+ schema:
1341
+ type: object
1342
+ required:
1343
+ - name
1344
+ properties:
1345
+ name:
1346
+ type: string
1347
+ example: "New Budget"
1348
+ currency:
1349
+ type: string
1350
+ default: "USD"
1351
+ example: "USD"
1148
1352
  responses:
1149
- 201:
1150
- description: Budget created
1353
+ '201':
1354
+ description: Budget created
1355
+ content:
1356
+ application/json:
1357
+ schema:
1358
+ type: object
1359
+ properties:
1360
+ id:
1361
+ type: string
1362
+ format: uuid
1363
+ name:
1364
+ type: string
1365
+ currency:
1366
+ type: string
1367
+ '400':
1368
+ description: Invalid parameters
1369
+ '404':
1370
+ description: Project not found
1151
1371
  """
1152
1372
  self.check_id_parameter(project_id)
1153
1373
  user_service.check_manager_project_access(project_id)
@@ -1303,6 +1523,76 @@ class ProductionBudgetEntriesResource(Resource, ArgsMixin):
1303
1523
  def post(self, project_id, budget_id):
1304
1524
  """
1305
1525
  Create a budget entry for given production and budget
1526
+ ---
1527
+ tags:
1528
+ - Projects
1529
+ parameters:
1530
+ - in: path
1531
+ name: project_id
1532
+ required: true
1533
+ schema:
1534
+ type: string
1535
+ format: uuid
1536
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1537
+ - in: path
1538
+ name: budget_id
1539
+ required: true
1540
+ schema:
1541
+ type: string
1542
+ format: uuid
1543
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1544
+ requestBody:
1545
+ required: true
1546
+ content:
1547
+ application/x-www-form-urlencoded:
1548
+ schema:
1549
+ type: object
1550
+ required:
1551
+ - department_id
1552
+ properties:
1553
+ department_id:
1554
+ type: string
1555
+ format: uuid
1556
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1557
+ person_id:
1558
+ type: string
1559
+ format: uuid
1560
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1561
+ start_date:
1562
+ type: string
1563
+ format: date
1564
+ example: "2025-01-01"
1565
+ months_duration:
1566
+ type: integer
1567
+ example: 12
1568
+ daily_salary:
1569
+ type: number
1570
+ format: float
1571
+ example: 100.00
1572
+ position:
1573
+ type: string
1574
+ example: "Artist"
1575
+ seniority:
1576
+ type: string
1577
+ example: "Mid"
1578
+ responses:
1579
+ '201':
1580
+ description: Budget entry created
1581
+ content:
1582
+ application/json:
1583
+ schema:
1584
+ type: object
1585
+ properties:
1586
+ id:
1587
+ type: string
1588
+ format: uuid
1589
+ department_id:
1590
+ type: string
1591
+ format: uuid
1592
+ '400':
1593
+ description: Invalid parameters
1594
+ '404':
1595
+ description: Project or budget not found
1306
1596
  """
1307
1597
  self.check_id_parameter(project_id)
1308
1598
  self.check_id_parameter(budget_id)
@@ -1506,19 +1796,19 @@ class ProductionMonthTimeSpentsResource(Resource, ArgsMixin):
1506
1796
  Get aggregated time spents by month for given project.
1507
1797
  ---
1508
1798
  tags:
1509
- - Projects
1799
+ - Projects
1510
1800
  parameters:
1511
- - in: path
1512
- name: project_id
1513
- required: True
1514
- type: string
1515
- format: uuid
1516
- example: a24a6ea4-ce75-4665-a070-57453082c25
1801
+ - in: path
1802
+ name: project_id
1803
+ required: true
1804
+ type: string
1805
+ format: uuid
1806
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1517
1807
  responses:
1518
1808
  200:
1519
- description: Aggregated time spents for given person and month
1809
+ description: Aggregated time spents for given person and month
1520
1810
  400:
1521
- description: Wrong ID format
1811
+ description: Wrong ID format
1522
1812
  """
1523
1813
  permissions.check_admin_permissions()
1524
1814
  self.check_id_parameter(project_id)
@@ -1536,25 +1826,25 @@ class ProductionScheduleVersionTaskLinksResource(Resource, ArgsMixin):
1536
1826
  Get task links for given production schedule version.
1537
1827
  ---
1538
1828
  tags:
1539
- - Projects
1829
+ - Projects
1540
1830
  parameters:
1541
- - in: path
1542
- name: production_schedule_version_id
1543
- required: True
1544
- type: string
1545
- format: uuid
1546
- example: a24a6ea4-ce75-4665-a070-57453082c25
1547
- - in: query
1548
- name: task_type_id
1549
- required: false
1550
- type: string
1551
- format: uuid
1552
- example: a24a6ea4-ce75-4665-a070-57453082c25
1831
+ - in: path
1832
+ name: production_schedule_version_id
1833
+ required: true
1834
+ type: string
1835
+ format: uuid
1836
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1837
+ - in: query
1838
+ name: task_type_id
1839
+ required: false
1840
+ type: string
1841
+ format: uuid
1842
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1553
1843
  responses:
1554
- 200:
1555
- description: Task links for given production schedule version.
1556
- 400:
1557
- description: Wrong ID format
1844
+ 200:
1845
+ description: Task links for given production schedule version
1846
+ 400:
1847
+ description: Wrong ID format
1558
1848
  """
1559
1849
  production_schedule_version = (
1560
1850
  schedule_service.get_production_schedule_version(
@@ -1595,19 +1885,19 @@ class ProductionScheduleVersionSetTaskLinksFromTasksResource(
1595
1885
  Set task links for given production schedule version from tasks.
1596
1886
  ---
1597
1887
  tags:
1598
- - Projects
1888
+ - Projects
1599
1889
  parameters:
1600
- - in: path
1601
- name: production_schedule_version_id
1602
- required: True
1603
- type: string
1604
- format: uuid
1605
- example: a24a6ea4-ce75-4665-a070-57453082c25
1890
+ - in: path
1891
+ name: production_schedule_version_id
1892
+ required: true
1893
+ type: string
1894
+ format: uuid
1895
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1606
1896
  responses:
1607
- 200:
1608
- description: Task links created.
1609
- 400:
1610
- description: Wrong ID format
1897
+ 200:
1898
+ description: Task links created
1899
+ 400:
1900
+ description: Wrong ID format
1611
1901
  """
1612
1902
  production_schedule_version = (
1613
1903
  schedule_service.get_production_schedule_version(
@@ -1631,19 +1921,19 @@ class ProductionScheduleVersionApplyToProductionResource(Resource, ArgsMixin):
1631
1921
  Apply production schedule version to production.
1632
1922
  ---
1633
1923
  tags:
1634
- - Projects
1924
+ - Projects
1635
1925
  parameters:
1636
- - in: path
1637
- name: production_schedule_version_id
1638
- required: True
1639
- type: string
1640
- format: uuid
1641
- example: a24a6ea4-ce75-4665-a070-57453082c25
1926
+ - in: path
1927
+ name: production_schedule_version_id
1928
+ required: true
1929
+ type: string
1930
+ format: uuid
1931
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1642
1932
  responses:
1643
- 200:
1644
- description: Task links created.
1645
- 400:
1646
- description: Wrong ID format
1933
+ 200:
1934
+ description: Production schedule version applied
1935
+ 400:
1936
+ description: Wrong ID format
1647
1937
  """
1648
1938
  production_schedule_version = (
1649
1939
  schedule_service.get_production_schedule_version(
@@ -1671,25 +1961,25 @@ class ProductionScheduleVersionSetTaskLinksFromProductionScheduleVersionResource
1671
1961
  Set task links for given production schedule version from another production schedule version.
1672
1962
  ---
1673
1963
  tags:
1674
- - Projects
1964
+ - Projects
1675
1965
  parameters:
1676
- - in: path
1677
- name: production_schedule_version_id
1678
- required: True
1679
- type: string
1680
- format: uuid
1681
- example: a24a6ea4-ce75-4665-a070-57453082c25
1682
- - in: formData
1683
- name: production_schedule_version_id
1684
- required: True
1685
- type: string
1686
- format: uuid
1687
- example: a24a6ea4-ce75-4665-a070-57453082c25
1966
+ - in: path
1967
+ name: production_schedule_version_id
1968
+ required: true
1969
+ type: string
1970
+ format: uuid
1971
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1972
+ - in: formData
1973
+ name: production_schedule_version_id
1974
+ required: true
1975
+ type: string
1976
+ format: uuid
1977
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1688
1978
  responses:
1689
- 200:
1690
- description: Task links created.
1691
- 400:
1692
- description: Wrong ID format
1979
+ 200:
1980
+ description: Task links created
1981
+ 400:
1982
+ description: Wrong ID format
1693
1983
  """
1694
1984
  production_schedule_version = (
1695
1985
  schedule_service.get_production_schedule_version(
@@ -1726,3 +2016,158 @@ class ProductionScheduleVersionSetTaskLinksFromProductionScheduleVersionResource
1726
2016
  "id"
1727
2017
  ],
1728
2018
  )
2019
+
2020
+
2021
+ class ProductionTaskTypesTimeSpentsResource(Resource, ArgsMixin):
2022
+ """
2023
+ Retrieve time spents for a task type in the production
2024
+ """
2025
+
2026
+ @jwt_required()
2027
+ def get(self, project_id, task_type_id):
2028
+ """
2029
+ Retrieve time spents for a task type in the production
2030
+ ---
2031
+ tags:
2032
+ - Projects
2033
+ parameters:
2034
+ - in: path
2035
+ name: project_id
2036
+ required: true
2037
+ schema:
2038
+ type: string
2039
+ format: uuid
2040
+ example: a24a6ea4-ce75-4665-a070-57453082c25
2041
+ - in: path
2042
+ name: task_type_id
2043
+ required: true
2044
+ schema:
2045
+ type: string
2046
+ format: uuid
2047
+ example: a24a6ea4-ce75-4665-a070-57453082c25
2048
+ - in: query
2049
+ name: start_date
2050
+ required: false
2051
+ schema:
2052
+ type: string
2053
+ format: date
2054
+ example: "2022-07-01"
2055
+ - in: query
2056
+ name: end_date
2057
+ required: false
2058
+ schema:
2059
+ type: string
2060
+ format: date
2061
+ example: "2022-07-31"
2062
+ responses:
2063
+ '200':
2064
+ description: All time spents for given task type and project
2065
+ content:
2066
+ application/json:
2067
+ schema:
2068
+ type: dict
2069
+ items:
2070
+ type: object
2071
+ properties:
2072
+ id:
2073
+ type: string
2074
+ format: uuid
2075
+ person_id:
2076
+ type: string
2077
+ format: uuid
2078
+ duration:
2079
+ type: number
2080
+ format: float
2081
+ date:
2082
+ type: string
2083
+ format: date
2084
+ '400':
2085
+ description: Invalid date range parameters
2086
+ """
2087
+ user_service.check_manager_project_access(project_id)
2088
+ arguments = self.get_args(["start_date", "end_date"])
2089
+ start_date, end_date = arguments["start_date"], arguments["end_date"]
2090
+ try:
2091
+ return time_spents_service.get_project_task_type_time_spents(
2092
+ project_id, task_type_id, start_date, end_date
2093
+ )
2094
+ except WrongDateFormatException:
2095
+ abort(
2096
+ 400,
2097
+ f"Wrong date format for {start_date} and/or {end_date}",
2098
+ )
2099
+
2100
+
2101
+ class ProductionDayOffsResource(Resource, ArgsMixin):
2102
+ """
2103
+ Retrieve all day offs for a production
2104
+ """
2105
+
2106
+ @jwt_required()
2107
+ def get(self, project_id):
2108
+ """
2109
+ Retrieve all day offs for a production
2110
+ ---
2111
+ tags:
2112
+ - Projects
2113
+ parameters:
2114
+ - in: path
2115
+ name: project_id
2116
+ required: true
2117
+ schema:
2118
+ type: string
2119
+ format: uuid
2120
+ example: a24a6ea4-ce75-4665-a070-57453082c25
2121
+ - in: query
2122
+ name: start_date
2123
+ required: false
2124
+ schema:
2125
+ type: string
2126
+ format: date
2127
+ example: "2022-07-01"
2128
+ - in: query
2129
+ name: end_date
2130
+ required: false
2131
+ schema:
2132
+ type: string
2133
+ format: date
2134
+ example: "2022-07-31"
2135
+ responses:
2136
+ '200':
2137
+ description: All day offs for given project
2138
+ content:
2139
+ application/json:
2140
+ schema:
2141
+ type: dict
2142
+ items:
2143
+ type: object
2144
+ properties:
2145
+ id:
2146
+ type: string
2147
+ format: uuid
2148
+ person_id:
2149
+ type: string
2150
+ format: uuid
2151
+ description:
2152
+ type: string
2153
+ date:
2154
+ type: string
2155
+ format: date
2156
+ end_date:
2157
+ type: string
2158
+ format: date
2159
+ '400':
2160
+ description: Invalid date range parameters
2161
+ """
2162
+ user_service.check_manager_project_access(project_id)
2163
+ arguments = self.get_args(["start_date", "end_date"])
2164
+ start_date, end_date = arguments["start_date"], arguments["end_date"]
2165
+ try:
2166
+ return time_spents_service.get_day_offs_between_for_project(
2167
+ project_id, start_date, end_date
2168
+ )
2169
+ except WrongDateFormatException:
2170
+ abort(
2171
+ 400,
2172
+ f"Wrong date format for {start_date} and/or {end_date}",
2173
+ )