zou 0.20.83__py3-none-any.whl → 0.20.84__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. zou/__init__.py +1 -1
  2. zou/app/blueprints/comments/resources.py +32 -35
  3. zou/app/blueprints/concepts/resources.py +23 -8
  4. zou/app/blueprints/crud/asset_instance.py +272 -0
  5. zou/app/blueprints/crud/attachment_file.py +263 -0
  6. zou/app/blueprints/crud/base.py +176 -69
  7. zou/app/blueprints/crud/budget.py +278 -0
  8. zou/app/blueprints/crud/budget_entry.py +269 -0
  9. zou/app/blueprints/crud/chat.py +282 -0
  10. zou/app/blueprints/crud/chat_message.py +286 -0
  11. zou/app/blueprints/crud/comments.py +312 -1
  12. zou/app/blueprints/crud/custom_action.py +268 -0
  13. zou/app/blueprints/crud/day_off.py +298 -0
  14. zou/app/blueprints/crud/department.py +268 -0
  15. zou/app/blueprints/crud/entity.py +297 -3
  16. zou/app/blueprints/crud/entity_link.py +303 -0
  17. zou/app/blueprints/crud/entity_type.py +269 -0
  18. zou/app/blueprints/crud/event.py +197 -0
  19. zou/app/blueprints/crud/file_status.py +268 -0
  20. zou/app/blueprints/crud/hardware_item.py +268 -0
  21. zou/app/blueprints/crud/metadata_descriptor.py +312 -0
  22. zou/app/blueprints/crud/milestone.py +302 -1
  23. zou/app/blueprints/crud/news.py +285 -0
  24. zou/app/blueprints/crud/notification.py +287 -0
  25. zou/app/blueprints/crud/organisation.py +269 -0
  26. zou/app/blueprints/crud/output_file.py +34 -10
  27. zou/app/blueprints/crud/output_type.py +30 -10
  28. zou/app/blueprints/crud/person.py +407 -2
  29. zou/app/blueprints/crud/playlist.py +322 -4
  30. zou/app/blueprints/crud/plugin.py +269 -0
  31. zou/app/blueprints/crud/preview_background_file.py +272 -0
  32. zou/app/blueprints/crud/preview_file.py +280 -9
  33. zou/app/blueprints/crud/production_schedule_version.py +569 -0
  34. zou/app/blueprints/crud/project.py +440 -0
  35. zou/app/blueprints/crud/project_status.py +268 -0
  36. zou/app/blueprints/crud/salary_scale.py +185 -5
  37. zou/app/blueprints/crud/schedule_item.py +305 -0
  38. zou/app/blueprints/crud/search_filter.py +302 -0
  39. zou/app/blueprints/crud/search_filter_group.py +270 -0
  40. zou/app/blueprints/crud/software.py +30 -10
  41. zou/app/blueprints/crud/status_automation.py +296 -2
  42. zou/app/blueprints/crud/studio.py +268 -0
  43. zou/app/blueprints/crud/subscription.py +279 -0
  44. zou/app/blueprints/crud/task.py +325 -5
  45. zou/app/blueprints/crud/task_status.py +301 -0
  46. zou/app/blueprints/crud/task_type.py +283 -0
  47. zou/app/blueprints/crud/time_spent.py +327 -0
  48. zou/app/blueprints/crud/working_file.py +273 -10
  49. zou/app/blueprints/export/csv/assets.py +15 -5
  50. zou/app/blueprints/export/csv/base.py +12 -3
  51. zou/app/blueprints/export/csv/casting.py +32 -5
  52. zou/app/blueprints/export/csv/edits.py +15 -5
  53. zou/app/blueprints/export/csv/persons.py +24 -0
  54. zou/app/blueprints/export/csv/playlists.py +16 -5
  55. zou/app/blueprints/export/csv/projects.py +23 -0
  56. zou/app/blueprints/export/csv/shots.py +15 -5
  57. zou/app/blueprints/export/csv/task_types.py +23 -0
  58. zou/app/blueprints/export/csv/tasks.py +24 -0
  59. zou/app/blueprints/export/csv/time_spents.py +24 -0
  60. zou/app/blueprints/files/resources.py +928 -377
  61. zou/app/blueprints/news/resources.py +7 -5
  62. zou/app/blueprints/persons/resources.py +644 -271
  63. zou/app/blueprints/playlists/resources.py +154 -72
  64. zou/app/blueprints/previews/resources.py +473 -228
  65. zou/app/blueprints/projects/__init__.py +5 -0
  66. zou/app/blueprints/projects/resources.py +987 -420
  67. zou/app/blueprints/search/resources.py +44 -32
  68. zou/app/blueprints/shots/resources.py +1338 -88
  69. zou/app/blueprints/source/csv/assets.py +44 -6
  70. zou/app/blueprints/source/csv/casting.py +43 -6
  71. zou/app/blueprints/source/csv/edits.py +47 -9
  72. zou/app/blueprints/source/csv/persons.py +43 -4
  73. zou/app/blueprints/source/csv/shots.py +47 -6
  74. zou/app/blueprints/source/csv/task_type_estimations.py +95 -35
  75. zou/app/blueprints/source/kitsu.py +433 -11
  76. zou/app/blueprints/source/otio.py +215 -20
  77. zou/app/blueprints/source/shotgun/assets.py +146 -0
  78. zou/app/blueprints/source/shotgun/base.py +85 -14
  79. zou/app/blueprints/source/shotgun/episode.py +124 -0
  80. zou/app/blueprints/source/shotgun/import_errors.py +105 -14
  81. zou/app/blueprints/source/shotgun/notes.py +132 -0
  82. zou/app/blueprints/source/shotgun/person.py +163 -0
  83. zou/app/blueprints/source/shotgun/project.py +120 -0
  84. zou/app/blueprints/source/shotgun/scene.py +120 -0
  85. zou/app/blueprints/source/shotgun/sequence.py +134 -0
  86. zou/app/blueprints/source/shotgun/shot.py +166 -0
  87. zou/app/blueprints/source/shotgun/status.py +129 -0
  88. zou/app/blueprints/source/shotgun/steps.py +138 -0
  89. zou/app/blueprints/source/shotgun/tasks.py +199 -0
  90. zou/app/blueprints/source/shotgun/team.py +132 -0
  91. zou/app/blueprints/source/shotgun/versions.py +155 -0
  92. zou/app/blueprints/tasks/resources.py +1197 -308
  93. zou/app/models/metadata_descriptor.py +1 -0
  94. zou/app/services/persons_service.py +1 -1
  95. zou/app/services/projects_service.py +45 -1
  96. zou/app/services/time_spents_service.py +1 -1
  97. zou/migrations/versions/a1b2c3d4e5f6_add_position_to_metadata_descriptor.py +32 -0
  98. {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/METADATA +18 -18
  99. {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/RECORD +103 -102
  100. {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/WHEEL +0 -0
  101. {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/entry_points.txt +0 -0
  102. {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/licenses/LICENSE +0 -0
  103. {zou-0.20.83.dist-info → zou-0.20.84.dist-info}/top_level.txt +0 -0
@@ -366,38 +366,55 @@ class BaseNewPreviewFilePicture:
366
366
  class CreatePreviewFilePictureResource(
367
367
  BaseNewPreviewFilePicture, Resource, ArgsMixin
368
368
  ):
369
- """
370
- Main resource to add a preview. It stores the preview file and generates
371
- three picture files matching preview when it's possible: a square thumbnail,
372
- a rectangle thumbnail and a midsize file.
373
- """
374
369
 
375
370
  @jwt_required()
376
371
  def post(self, instance_id):
377
372
  """
378
- Main resource to add a preview.
373
+ Create preview file
379
374
  ---
375
+ description: Main resource to add a preview. It stores the preview file
376
+ and generates three picture files (thumbnails) matching preview when
377
+ it's possible, a square thumbnail, a rectangle thumbnail and a
378
+ midsize file.
380
379
  tags:
381
380
  - Previews
382
- description: "It stores the preview file and generates three picture files matching preview when it's possible: a square thumbnail, a rectangle thumbnail and a midsize file."
383
- consumes:
384
- - multipart/form-data
385
- - image/png
386
- - application/pdf
387
381
  parameters:
388
382
  - in: path
389
383
  name: instance_id
390
- required: True
391
- type: string
392
- format: uuid
384
+ required: true
385
+ schema:
386
+ type: string
387
+ format: uuid
388
+ description: Preview file unique identifier
393
389
  example: a24a6ea4-ce75-4665-a070-57453082c25
394
390
  - in: formData
395
391
  name: file
396
- required: True
392
+ required: true
397
393
  type: file
394
+ description: Preview file to upload
398
395
  responses:
399
- 200:
400
- description: Preview added
396
+ 201:
397
+ description: Preview file added successfully
398
+ content:
399
+ application/json:
400
+ schema:
401
+ type: object
402
+ properties:
403
+ id:
404
+ type: string
405
+ format: uuid
406
+ description: Preview file unique identifier
407
+ example: a24a6ea4-ce75-4665-a070-57453082c25
408
+ extension:
409
+ type: string
410
+ description: File extension
411
+ example: "png"
412
+ file_size:
413
+ type: integer
414
+ description: File size in bytes
415
+ example: 1024000
416
+ 400:
417
+ description: Wrong file format or normalization failed
401
418
  """
402
419
  self.is_exist(instance_id)
403
420
  self.is_allowed(instance_id)
@@ -526,75 +543,86 @@ class BaseBatchComment(BaseNewPreviewFilePicture, ArgsMixin):
526
543
 
527
544
 
528
545
  class AddTaskBatchCommentResource(BaseBatchComment, Resource):
529
- """
530
- Creates new comments for given task. Each comments requires a text, a
531
- task_status and a person as arguments.
532
- """
533
546
 
534
547
  @jwt_required()
535
548
  def post(self, task_id):
536
549
  """
537
- Creates new comments for given task. Each comments requires a text, a
538
- task_status and a person as arguments.
550
+ Add task batch comments
539
551
  ---
552
+ description: Creates new comments for given task. Each comment requires
553
+ a text, a task_status and a person as arguments. Can include preview
554
+ files and attachments.
540
555
  tags:
541
- - Comments
542
- description: Creates new comments for given task. Each comments requires
543
- a text, a task_status and a person as arguments.
556
+ - Comments
544
557
  parameters:
545
558
  - in: path
546
559
  name: task_id
547
- required: True
548
- type: string
549
- format: uuid
550
- example: a24a6ea4-ce75-4665-a070-57453082c25
551
- - in: body
552
- name: Comment
553
- description: person ID, name, comment, revision and change status of task
560
+ required: true
554
561
  schema:
562
+ type: string
563
+ format: uuid
564
+ description: Task unique identifier
565
+ example: a24a6ea4-ce75-4665-a070-57453082c25
566
+ requestBody:
567
+ required: true
568
+ content:
569
+ multipart/form-data:
570
+ schema:
555
571
  type: object
556
572
  required:
557
- - comments
573
+ - comments
558
574
  properties:
559
- comments:
560
- type: string
575
+ comments:
576
+ type: string
577
+ description: JSON string containing array of comments
578
+ example: '[{"text": "Good work", "task_status_id": "uuid"}]'
561
579
  responses:
562
- 201:
563
- description: New comments created
580
+ 201:
581
+ description: New comments created
582
+ content:
583
+ application/json:
584
+ schema:
585
+ type: array
586
+ items:
587
+ type: object
564
588
  """
565
589
  return self.process_comments(task_id)
566
590
 
567
591
 
568
592
  class AddTasksBatchCommentResource(BaseBatchComment, Resource):
569
- """
570
- Creates new comments for given tasks. Each comments requires a task_id,
571
- text, a task_status and a person as arguments.
572
- """
573
593
 
574
594
  @jwt_required()
575
595
  def post(self):
576
596
  """
577
- Creates new comments for given task. Each comments requires a task_id,
578
- text, a task_status and a person as arguments.
597
+ Add tasks batch comments
579
598
  ---
599
+ description: Creates new comments for given tasks. Each comment requires
600
+ a task_id, text, a task_status and a person as arguments. Can include
601
+ preview files and attachments.
580
602
  tags:
581
- - Comments
582
- description: Creates new comments for given task. Each comments requires
583
- a task_id, a text, a task_status and a person as arguments.
584
- parameters:
585
- - in: body
586
- name: Comment
587
- description: person ID, name, comment, revision and change status of task
588
- schema:
603
+ - Comments
604
+ requestBody:
605
+ required: true
606
+ content:
607
+ multipart/form-data:
608
+ schema:
589
609
  type: object
590
610
  required:
591
- - comments
611
+ - comments
592
612
  properties:
593
- comments:
594
- type: string
613
+ comments:
614
+ type: string
615
+ description: JSON string containing array of comments
616
+ example: '[{"task_id": "uuid", "text": "Good work", "task_status_id": "uuid"}]'
595
617
  responses:
596
- 201:
597
- description: New comments created
618
+ 201:
619
+ description: New comments created
620
+ content:
621
+ application/json:
622
+ schema:
623
+ type: array
624
+ items:
625
+ type: object
598
626
  """
599
627
  return self.process_comments()
600
628
 
@@ -625,25 +653,28 @@ class PreviewFileMovieResource(BasePreviewFileResource):
625
653
  @jwt_required()
626
654
  def get(self, instance_id):
627
655
  """
628
- Download a movie preview.
656
+ Get preview movie
629
657
  ---
658
+ description: Download a movie preview file.
630
659
  tags:
631
660
  - Previews
632
- description: "It stores the preview file and generates three picture files matching preview when it's possible: a square thumbnail, a rectangle thumbnail and a midsize file."
633
661
  parameters:
634
662
  - in: path
635
663
  name: instance_id
636
- required: True
637
- type: string
638
- format: uuid
664
+ required: true
665
+ schema:
666
+ type: string
667
+ format: uuid
668
+ description: Preview file unique identifier
639
669
  example: a24a6ea4-ce75-4665-a070-57453082c25
640
670
  responses:
641
- 200:
642
- description: Movie preview downloaded
643
- 403:
644
- description: Instance not allowed
645
- 404:
646
- description: File not found
671
+ 200:
672
+ description: Movie preview downloaded
673
+ content:
674
+ video/mp4:
675
+ schema:
676
+ type: string
677
+ format: binary
647
678
  """
648
679
  self.is_allowed(instance_id)
649
680
 
@@ -667,24 +698,29 @@ class PreviewFileLowMovieResource(BasePreviewFileResource):
667
698
  @jwt_required()
668
699
  def get(self, instance_id):
669
700
  """
670
- Download a lowdef movie preview.
701
+ Get preview lowdef movie
671
702
  ---
703
+ description: Download a low definition movie preview file. Falls back to
704
+ full quality if lowdef version is not available.
672
705
  tags:
673
706
  - Previews
674
707
  parameters:
675
708
  - in: path
676
709
  name: instance_id
677
- required: True
678
- type: string
679
- format: uuid
710
+ required: true
711
+ schema:
712
+ type: string
713
+ format: uuid
714
+ description: Preview file unique identifier
680
715
  example: a24a6ea4-ce75-4665-a070-57453082c25
681
716
  responses:
682
- 200:
683
- description: Lowdef movie preview downloaded
684
- 403:
685
- description: Instance not allowed
686
- 404:
687
- description: File not found
717
+ 200:
718
+ description: Low definition movie preview downloaded
719
+ content:
720
+ video/mp4:
721
+ schema:
722
+ type: string
723
+ format: binary
688
724
  """
689
725
  self.is_allowed(instance_id)
690
726
 
@@ -713,24 +749,28 @@ class PreviewFileMovieDownloadResource(BasePreviewFileResource):
713
749
  @jwt_required()
714
750
  def get(self, instance_id):
715
751
  """
716
- Download a movie preview.
752
+ Download preview movie
717
753
  ---
754
+ description: Download a movie preview file as attachment.
718
755
  tags:
719
756
  - Previews
720
757
  parameters:
721
758
  - in: path
722
759
  name: instance_id
723
- required: True
724
- type: string
725
- format: uuid
760
+ required: true
761
+ schema:
762
+ type: string
763
+ format: uuid
764
+ description: Preview file unique identifier
726
765
  example: a24a6ea4-ce75-4665-a070-57453082c25
727
766
  responses:
728
- 200:
729
- description: Movie preview downloaded
730
- 403:
731
- description: Instance not allowed
732
- 404:
733
- description: File not found
767
+ 200:
768
+ description: Movie preview downloaded as attachment
769
+ content:
770
+ video/mp4:
771
+ schema:
772
+ type: string
773
+ format: binary
734
774
  """
735
775
  self.is_allowed(instance_id)
736
776
 
@@ -756,29 +796,35 @@ class PreviewFileResource(BasePreviewFileResource):
756
796
  @jwt_required()
757
797
  def get(self, instance_id, extension):
758
798
  """
759
- Download a generic file preview.
799
+ Get preview file
760
800
  ---
801
+ description: Download a generic file preview by extension.
761
802
  tags:
762
803
  - Previews
763
804
  parameters:
764
805
  - in: path
765
806
  name: instance_id
766
- required: True
767
- type: string
768
- format: uuid
807
+ required: true
808
+ schema:
809
+ type: string
810
+ format: uuid
811
+ description: Preview file unique identifier
769
812
  example: a24a6ea4-ce75-4665-a070-57453082c25
770
813
  - in: path
771
814
  name: extension
772
- required: True
773
- type: string
774
- example: png, pdf, jpg, jpeg, ...
815
+ required: true
816
+ schema:
817
+ type: string
818
+ description: File extension
819
+ example: png
775
820
  responses:
776
- 200:
777
- description: Generic file preview downloaded
778
- 403:
779
- description: Instance not allowed
780
- 404:
781
- description: Non-movie file not found
821
+ 200:
822
+ description: Generic file preview downloaded
823
+ content:
824
+ application/octet-stream:
825
+ schema:
826
+ type: string
827
+ format: binary
782
828
  """
783
829
  self.is_allowed(instance_id)
784
830
 
@@ -817,24 +863,28 @@ class PreviewFileDownloadResource(BasePreviewFileResource):
817
863
  @jwt_required()
818
864
  def get(self, instance_id):
819
865
  """
820
- Download a generic file preview as attachment.
866
+ Download preview file
821
867
  ---
868
+ description: Download a generic file preview as attachment.
822
869
  tags:
823
870
  - Previews
824
871
  parameters:
825
872
  - in: path
826
873
  name: instance_id
827
- required: True
828
- type: string
829
- format: uuid
874
+ required: true
875
+ schema:
876
+ type: string
877
+ format: uuid
878
+ description: Preview file unique identifier
830
879
  example: a24a6ea4-ce75-4665-a070-57453082c25
831
880
  responses:
832
- 200:
833
- description: Generic file preview downloaded as attachment
834
- 403:
835
- description: Instance not allowed
836
- 404:
837
- description: Standard file not found
881
+ 200:
882
+ description: Generic file preview downloaded as attachment
883
+ content:
884
+ application/octet-stream:
885
+ schema:
886
+ type: string
887
+ format: binary
838
888
  """
839
889
  self.is_allowed(instance_id)
840
890
 
@@ -909,24 +959,28 @@ class AttachmentThumbnailResource(Resource):
909
959
  @jwt_required()
910
960
  def get(self, attachment_file_id):
911
961
  """
912
- Download the thumbnail representing given attachment file.
962
+ Get attachment thumbnail
913
963
  ---
964
+ description: Download the thumbnail representing given attachment file.
914
965
  tags:
915
966
  - Previews
916
967
  parameters:
917
968
  - in: path
918
969
  name: attachment_file_id
919
- required: True
920
- type: string
921
- format: uuid
970
+ required: true
971
+ schema:
972
+ type: string
973
+ format: uuid
974
+ description: Attachment file unique identifier
922
975
  example: a24a6ea4-ce75-4665-a070-57453082c25
923
976
  responses:
924
- 200:
925
- description: Thumbnail downloaded
926
- 403:
927
- description: Instance not allowed
928
- 404:
929
- description: Picture file not found
977
+ 200:
978
+ description: Attachment thumbnail downloaded
979
+ content:
980
+ image/png:
981
+ schema:
982
+ type: string
983
+ format: binary
930
984
  """
931
985
  self.is_allowed(attachment_file_id)
932
986
 
@@ -959,24 +1013,28 @@ class BasePreviewPictureResource(BasePreviewFileResource):
959
1013
  @jwt_required()
960
1014
  def get(self, instance_id):
961
1015
  """
962
- Download a thumbnail.
1016
+ Get preview thumbnail
963
1017
  ---
1018
+ description: Download a thumbnail for a preview file.
964
1019
  tags:
965
1020
  - Previews
966
1021
  parameters:
967
1022
  - in: path
968
1023
  name: instance_id
969
- required: True
970
- type: string
971
- format: uuid
1024
+ required: true
1025
+ schema:
1026
+ type: string
1027
+ format: uuid
1028
+ description: Preview file unique identifier
972
1029
  example: a24a6ea4-ce75-4665-a070-57453082c25
973
1030
  responses:
974
- 200:
975
- description: Thumbnail downloaded
976
- 403:
977
- description: Instance not allowed
978
- 404:
979
- description: Picture file not found
1031
+ 200:
1032
+ description: Preview thumbnail downloaded
1033
+ content:
1034
+ image/png:
1035
+ schema:
1036
+ type: string
1037
+ format: binary
980
1038
  """
981
1039
  self.is_allowed(instance_id)
982
1040
 
@@ -1088,30 +1146,37 @@ class BaseThumbnailResource(Resource):
1088
1146
  @jwt_required()
1089
1147
  def post(self, instance_id):
1090
1148
  """
1091
- Create a thumbnail for given object instance.
1149
+ Create thumbnail
1092
1150
  ---
1151
+ description: Create a thumbnail for given object instance.
1093
1152
  tags:
1094
1153
  - Previews
1095
- consumes:
1096
- - multipart/form-data
1097
- - image/png
1098
- - application/pdf
1099
1154
  parameters:
1100
1155
  - in: path
1101
1156
  name: instance_id
1102
- required: True
1103
- type: string
1104
- format: uuid
1157
+ required: true
1158
+ schema:
1159
+ type: string
1160
+ format: uuid
1161
+ description: Object instance unique identifier
1105
1162
  example: a24a6ea4-ce75-4665-a070-57453082c25
1106
1163
  - in: formData
1107
1164
  name: file
1108
- required: True
1165
+ required: true
1109
1166
  type: file
1167
+ description: Image file to use as thumbnail
1110
1168
  responses:
1111
- 200:
1112
- description: Thumbnail created
1113
- 404:
1114
- description: Cannot found related object.
1169
+ 201:
1170
+ description: Thumbnail created successfully
1171
+ content:
1172
+ application/json:
1173
+ schema:
1174
+ type: object
1175
+ properties:
1176
+ thumbnail_path:
1177
+ type: string
1178
+ description: URL path to the thumbnail
1179
+ example: "/api/thumbnails/persons/uuid"
1115
1180
  """
1116
1181
  self.is_exist(instance_id)
1117
1182
  self.check_allowed_to_post(instance_id)
@@ -1141,24 +1206,28 @@ class BaseThumbnailResource(Resource):
1141
1206
  @jwt_required()
1142
1207
  def get(self, instance_id):
1143
1208
  """
1144
- Download the thumbnail linked to given object instance.
1209
+ Get thumbnail
1145
1210
  ---
1211
+ description: Download the thumbnail linked to given object instance.
1146
1212
  tags:
1147
1213
  - Previews
1148
1214
  parameters:
1149
1215
  - in: path
1150
1216
  name: instance_id
1151
- required: True
1152
- type: string
1153
- format: uuid
1217
+ required: true
1218
+ schema:
1219
+ type: string
1220
+ format: uuid
1221
+ description: Object instance unique identifier
1154
1222
  example: a24a6ea4-ce75-4665-a070-57453082c25
1155
1223
  responses:
1156
- 200:
1157
- description: Thumbnail downloaded
1158
- 403:
1159
- description: Access not allowed
1160
- 404:
1161
- description: Object instance not found
1224
+ 200:
1225
+ description: Thumbnail downloaded
1226
+ content:
1227
+ image/png:
1228
+ schema:
1229
+ type: string
1230
+ format: binary
1162
1231
  """
1163
1232
  self.is_exist(instance_id)
1164
1233
  self.check_allowed_to_get(instance_id)
@@ -1242,7 +1311,9 @@ class ProjectThumbnailResource(BaseThumbnailResource):
1242
1311
 
1243
1312
 
1244
1313
  class CreateProjectThumbnailResource(ProjectThumbnailResource):
1245
- pass
1314
+
1315
+ def check_allowed_to_post(self, instance_id):
1316
+ return user_service.check_manager_project_access(instance_id)
1246
1317
 
1247
1318
 
1248
1319
  class SetMainPreviewResource(Resource, ArgsMixin):
@@ -1254,21 +1325,48 @@ class SetMainPreviewResource(Resource, ArgsMixin):
1254
1325
  @jwt_required()
1255
1326
  def put(self, preview_file_id):
1256
1327
  """
1257
- Set given preview as main preview of the related entity.
1328
+ Set main preview
1258
1329
  ---
1330
+ description: Set given preview as main preview of the related entity.
1331
+ This preview will be used to illustrate the entity.
1259
1332
  tags:
1260
1333
  - Previews
1261
- description: This preview will be used to illustrate the entity.
1262
1334
  parameters:
1263
1335
  - in: path
1264
1336
  name: preview_file_id
1265
- required: True
1266
- type: string
1267
- format: uuid
1337
+ required: true
1338
+ schema:
1339
+ type: string
1340
+ format: uuid
1341
+ description: Preview file unique identifier
1268
1342
  example: a24a6ea4-ce75-4665-a070-57453082c25
1343
+ - in: query
1344
+ name: frame_number
1345
+ required: false
1346
+ schema:
1347
+ type: integer
1348
+ description: Frame number for movie previews
1349
+ example: 120
1269
1350
  responses:
1270
- 200:
1271
- description: Given preview set as main preview
1351
+ 200:
1352
+ description: Preview set as main preview
1353
+ content:
1354
+ application/json:
1355
+ schema:
1356
+ type: object
1357
+ properties:
1358
+ id:
1359
+ type: string
1360
+ format: uuid
1361
+ description: Entity unique identifier
1362
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1363
+ preview_file_id:
1364
+ type: string
1365
+ format: uuid
1366
+ description: Preview file unique identifier
1367
+ example: b35b7fb5-df86-5776-b181-68564193d36
1368
+ 400:
1369
+ description: Cannot use frame number on non-movie preview
1272
1370
  """
1273
1371
  args = self.get_args([("frame_number", None, False, int)])
1274
1372
  frame_number = args["frame_number"]
@@ -1299,21 +1397,48 @@ class UpdatePreviewPositionResource(Resource, ArgsMixin):
1299
1397
  @jwt_required()
1300
1398
  def put(self, preview_file_id):
1301
1399
  """
1302
- Allow to change orders of previews for a single revision.
1400
+ Update preview position
1303
1401
  ---
1402
+ description: Allow to change orders of previews for a single revision.
1304
1403
  tags:
1305
1404
  - Previews
1306
- description: This preview will be used to illustrate the entity.
1307
1405
  parameters:
1308
1406
  - in: path
1309
1407
  name: preview_file_id
1310
- required: True
1311
- type: string
1312
- format: uuid
1408
+ required: true
1409
+ schema:
1410
+ type: string
1411
+ format: uuid
1412
+ description: Preview file unique identifier
1313
1413
  example: a24a6ea4-ce75-4665-a070-57453082c25
1414
+ requestBody:
1415
+ required: false
1416
+ content:
1417
+ application/json:
1418
+ schema:
1419
+ type: object
1420
+ properties:
1421
+ position:
1422
+ type: integer
1423
+ description: New position for the preview
1424
+ example: 2
1314
1425
  responses:
1315
- 200:
1316
- description: Orders of previews changed for a single revision
1426
+ 200:
1427
+ description: Preview position updated
1428
+ content:
1429
+ application/json:
1430
+ schema:
1431
+ type: object
1432
+ properties:
1433
+ id:
1434
+ type: string
1435
+ format: uuid
1436
+ description: Preview file unique identifier
1437
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1438
+ position:
1439
+ type: integer
1440
+ description: Preview position
1441
+ example: 2
1317
1442
  """
1318
1443
  args = self.get_args([{"name": "position", "default": 0, "type": int}])
1319
1444
  preview_file = files_service.get_preview_file(preview_file_id)
@@ -1324,38 +1449,72 @@ class UpdatePreviewPositionResource(Resource, ArgsMixin):
1324
1449
 
1325
1450
 
1326
1451
  class UpdateAnnotationsResource(Resource, ArgsMixin):
1327
- """
1328
- Allow to modify the annotations stored at the preview level.
1329
- Modifications are applied via three fields:
1330
- * `annotation`s to give all the annotations that need to be added.
1331
- * `updates` that list annotations that needs to be modified.
1332
- * `deletions` to list the IDs of annotations that needs to be removed.
1333
- """
1334
1452
 
1335
1453
  @jwt_required()
1336
1454
  def put(self, preview_file_id):
1337
1455
  """
1338
- Allow to modify the annotations stored at the preview level.
1456
+ Update preview annotations
1339
1457
  ---
1458
+ description: Allow to modify the annotations stored at the preview level.
1459
+ Modifications are applied via three fields, additions to give all the
1460
+ annotations that need to be added, updates that list annotations that
1461
+ needs to be modified, and deletions to list the IDs of annotations that
1462
+ needs to be removed.
1340
1463
  tags:
1341
1464
  - Previews
1342
- description: |
1343
- Modifications are applied via three fields:
1344
- * `annotations` to give all the annotations that need to be added.
1345
-
1346
- * `updates` that list annotations that needs to be modified.
1347
-
1348
- * `deletions` to list the IDs of annotations that needs to be removed.
1349
1465
  parameters:
1350
1466
  - in: path
1351
1467
  name: preview_file_id
1352
- required: True
1353
- type: string
1354
- format: uuid
1468
+ required: true
1469
+ schema:
1470
+ type: string
1471
+ format: uuid
1472
+ description: Preview file unique identifier
1355
1473
  example: a24a6ea4-ce75-4665-a070-57453082c25
1474
+ requestBody:
1475
+ required: true
1476
+ content:
1477
+ application/json:
1478
+ schema:
1479
+ type: object
1480
+ properties:
1481
+ additions:
1482
+ type: array
1483
+ description: Annotations to add
1484
+ items:
1485
+ type: object
1486
+ example: [{"type": "drawing", "x": 100, "y": 200}]
1487
+ updates:
1488
+ type: array
1489
+ description: Annotations to update
1490
+ items:
1491
+ type: object
1492
+ example: [{"id": "uuid", "x": 150, "y": 250}]
1493
+ deletions:
1494
+ type: array
1495
+ description: Annotation IDs to remove
1496
+ items:
1497
+ type: string
1498
+ format: uuid
1499
+ example: ["a24a6ea4-ce75-4665-a070-57453082c25"]
1356
1500
  responses:
1357
- 200:
1358
- description: Orders of previews changed for a single revision
1501
+ 200:
1502
+ description: Preview annotations updated
1503
+ content:
1504
+ application/json:
1505
+ schema:
1506
+ type: object
1507
+ properties:
1508
+ id:
1509
+ type: string
1510
+ format: uuid
1511
+ description: Preview file unique identifier
1512
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1513
+ annotations:
1514
+ type: array
1515
+ description: Updated annotations
1516
+ items:
1517
+ type: object
1359
1518
  """
1360
1519
  preview_file = files_service.get_preview_file(preview_file_id)
1361
1520
  task = tasks_service.get_task(preview_file["task_id"])
@@ -1402,13 +1561,31 @@ class RunningPreviewFiles(Resource, ArgsMixin):
1402
1561
  @jwt_required()
1403
1562
  def get(self):
1404
1563
  """
1405
- Retrieve all preview files from open productions with states equals to processing or broken.
1564
+ Get running preview files
1406
1565
  ---
1566
+ description: Retrieve all preview files from open productions with
1567
+ states equal to processing or broken.
1407
1568
  tags:
1408
1569
  - Previews
1409
1570
  responses:
1410
- 200:
1411
- description: All preview files from open productions with states equals to processing or broken
1571
+ 200:
1572
+ description: All preview files from open productions with processing or broken states
1573
+ content:
1574
+ application/json:
1575
+ schema:
1576
+ type: array
1577
+ items:
1578
+ type: object
1579
+ properties:
1580
+ id:
1581
+ type: string
1582
+ format: uuid
1583
+ description: Preview file unique identifier
1584
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1585
+ status:
1586
+ type: string
1587
+ description: Preview file status
1588
+ example: "processing"
1412
1589
  """
1413
1590
  permissions.check_admin_permissions()
1414
1591
  return preview_files_service.get_running_preview_files()
@@ -1422,21 +1599,36 @@ class ExtractFrameFromPreview(Resource, ArgsMixin):
1422
1599
  @jwt_required()
1423
1600
  def get(self, preview_file_id):
1424
1601
  """
1425
- Extract a frame from a preview_file
1426
- ---
1427
- tags:
1428
- - Previews
1429
- description: Extract a frame from a preview_file
1430
- parameters:
1431
- - in: path
1432
- name: preview_file_id
1433
- required: True
1434
- type: string
1435
- format: uuid
1436
- example: a24a6ea4-ce75-4665-a070-57453082c25
1437
- responses:
1438
- 200:
1439
- description: Extracted frame
1602
+ Extract frame from preview
1603
+ ---
1604
+ description: Extract a frame from a preview file movie. Frame number can
1605
+ be specified as query parameter, defaults to 0.
1606
+ tags:
1607
+ - Previews
1608
+ parameters:
1609
+ - in: path
1610
+ name: preview_file_id
1611
+ required: true
1612
+ schema:
1613
+ type: string
1614
+ format: uuid
1615
+ description: Preview file unique identifier
1616
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1617
+ - in: query
1618
+ name: frame_number
1619
+ required: false
1620
+ schema:
1621
+ type: integer
1622
+ description: Frame number to extract
1623
+ example: 120
1624
+ responses:
1625
+ 200:
1626
+ description: Extracted frame as PNG image
1627
+ content:
1628
+ image/png:
1629
+ schema:
1630
+ type: string
1631
+ format: binary
1440
1632
  """
1441
1633
  args = self.get_args([("frame_number", 0, False, int)])
1442
1634
  preview_file = files_service.get_preview_file(preview_file_id)
@@ -1466,6 +1658,30 @@ class ExtractTileFromPreview(Resource):
1466
1658
 
1467
1659
  @jwt_required()
1468
1660
  def get(self, preview_file_id):
1661
+ """
1662
+ Extract tile from preview
1663
+ ---
1664
+ description: Extract a tile from a preview file movie.
1665
+ tags:
1666
+ - Previews
1667
+ parameters:
1668
+ - in: path
1669
+ name: preview_file_id
1670
+ required: true
1671
+ schema:
1672
+ type: string
1673
+ format: uuid
1674
+ description: Preview file unique identifier
1675
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1676
+ responses:
1677
+ 200:
1678
+ description: Extracted tile as PNG image
1679
+ content:
1680
+ image/png:
1681
+ schema:
1682
+ type: string
1683
+ format: binary
1684
+ """
1469
1685
  preview_file = files_service.get_preview_file(preview_file_id)
1470
1686
  user_service.check_task_access(preview_file["task_id"])
1471
1687
  extracted_tile_path = (
@@ -1493,27 +1709,49 @@ class CreatePreviewBackgroundFileResource(Resource):
1493
1709
  @jwt_required()
1494
1710
  def post(self, instance_id):
1495
1711
  """
1496
- Main resource to add a preview background file.
1712
+ Create preview background file
1497
1713
  ---
1714
+ description: Main resource to add a preview background file. It stores
1715
+ the preview background file and generates a rectangle thumbnail.
1498
1716
  tags:
1499
1717
  - Previews
1500
- consumes:
1501
- - multipart/form-data
1502
- - image/vnd.radiance
1503
1718
  parameters:
1504
1719
  - in: path
1505
1720
  name: instance_id
1506
- required: True
1507
- type: string
1508
- format: uuid
1721
+ required: true
1722
+ schema:
1723
+ type: string
1724
+ format: uuid
1725
+ description: Preview background file unique identifier
1509
1726
  example: a24a6ea4-ce75-4665-a070-57453082c25
1510
1727
  - in: formData
1511
1728
  name: file
1512
- required: True
1729
+ required: true
1513
1730
  type: file
1731
+ description: HDR file to upload
1514
1732
  responses:
1515
- 200:
1516
- description: Preview background file added
1733
+ 201:
1734
+ description: Preview background file added successfully
1735
+ content:
1736
+ application/json:
1737
+ schema:
1738
+ type: object
1739
+ properties:
1740
+ id:
1741
+ type: string
1742
+ format: uuid
1743
+ description: Preview background file unique identifier
1744
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1745
+ extension:
1746
+ type: string
1747
+ description: File extension
1748
+ example: "hdr"
1749
+ file_size:
1750
+ type: integer
1751
+ description: File size in bytes
1752
+ example: 2048000
1753
+ 400:
1754
+ description: Wrong file format or error saving file
1517
1755
  """
1518
1756
  self.check_permissions(instance_id)
1519
1757
 
@@ -1639,28 +1877,35 @@ class PreviewBackgroundFileResource(Resource):
1639
1877
  @jwt_required()
1640
1878
  def get(self, instance_id, extension):
1641
1879
  """
1642
- Download a preview background file.
1880
+ Get preview background file
1643
1881
  ---
1882
+ description: Download a preview background file.
1644
1883
  tags:
1645
1884
  - Previews
1646
1885
  parameters:
1647
1886
  - in: path
1648
1887
  name: instance_id
1649
- required: True
1650
- type: string
1651
- format: uuid
1888
+ required: true
1889
+ schema:
1890
+ type: string
1891
+ format: uuid
1892
+ description: Preview background file unique identifier
1652
1893
  example: a24a6ea4-ce75-4665-a070-57453082c25
1653
1894
  - in: path
1654
1895
  name: extension
1655
- required: True
1656
- type: string
1657
- format: extension
1896
+ required: true
1897
+ schema:
1898
+ type: string
1899
+ description: File extension
1658
1900
  example: hdr
1659
1901
  responses:
1660
- 200:
1661
- description: Preview background file downloaded
1662
- 404:
1663
- description: Preview background file not found
1902
+ 200:
1903
+ description: Preview background file downloaded
1904
+ content:
1905
+ image/vnd.radiance:
1906
+ schema:
1907
+ type: string
1908
+ format: binary
1664
1909
  """
1665
1910
  preview_background_file = files_service.get_preview_background_file(
1666
1911
  instance_id