zou 0.19.15__py3-none-any.whl → 0.20.11__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 (164) hide show
  1. zou/__init__.py +1 -1
  2. zou/app/__init__.py +10 -2
  3. zou/app/api.py +2 -0
  4. zou/app/blueprints/assets/__init__.py +22 -0
  5. zou/app/blueprints/assets/resources.py +241 -4
  6. zou/app/blueprints/auth/__init__.py +4 -0
  7. zou/app/blueprints/auth/resources.py +154 -22
  8. zou/app/blueprints/breakdown/resources.py +4 -4
  9. zou/app/blueprints/chats/__init__.py +22 -0
  10. zou/app/blueprints/chats/resources.py +199 -0
  11. zou/app/blueprints/comments/resources.py +36 -19
  12. zou/app/blueprints/crud/__init__.py +12 -0
  13. zou/app/blueprints/crud/attachment_file.py +14 -5
  14. zou/app/blueprints/crud/base.py +29 -28
  15. zou/app/blueprints/crud/chat.py +13 -0
  16. zou/app/blueprints/crud/chat_message.py +13 -0
  17. zou/app/blueprints/crud/comments.py +85 -29
  18. zou/app/blueprints/crud/custom_action.py +1 -1
  19. zou/app/blueprints/crud/day_off.py +47 -9
  20. zou/app/blueprints/crud/department.py +1 -25
  21. zou/app/blueprints/crud/entity.py +46 -5
  22. zou/app/blueprints/crud/entity_type.py +13 -1
  23. zou/app/blueprints/crud/event.py +1 -1
  24. zou/app/blueprints/crud/file_status.py +1 -1
  25. zou/app/blueprints/crud/metadata_descriptor.py +24 -10
  26. zou/app/blueprints/crud/organisation.py +22 -5
  27. zou/app/blueprints/crud/output_file.py +1 -1
  28. zou/app/blueprints/crud/output_type.py +1 -1
  29. zou/app/blueprints/crud/person.py +32 -24
  30. zou/app/blueprints/crud/playlist.py +1 -1
  31. zou/app/blueprints/crud/preview_background_file.py +6 -7
  32. zou/app/blueprints/crud/preview_file.py +1 -1
  33. zou/app/blueprints/crud/project.py +14 -6
  34. zou/app/blueprints/crud/project_status.py +1 -1
  35. zou/app/blueprints/crud/schedule_item.py +4 -2
  36. zou/app/blueprints/crud/software.py +1 -1
  37. zou/app/blueprints/crud/status_automation.py +1 -1
  38. zou/app/blueprints/crud/studio.py +33 -0
  39. zou/app/blueprints/crud/task.py +47 -3
  40. zou/app/blueprints/crud/task_status.py +1 -1
  41. zou/app/blueprints/crud/task_type.py +4 -4
  42. zou/app/blueprints/crud/working_file.py +4 -8
  43. zou/app/blueprints/events/resources.py +13 -12
  44. zou/app/blueprints/export/csv/assets.py +15 -6
  45. zou/app/blueprints/export/csv/edits.py +15 -5
  46. zou/app/blueprints/export/csv/playlists.py +1 -1
  47. zou/app/blueprints/export/csv/shots.py +15 -5
  48. zou/app/blueprints/export/csv/time_spents.py +1 -1
  49. zou/app/blueprints/files/resources.py +22 -23
  50. zou/app/blueprints/index/resources.py +38 -29
  51. zou/app/blueprints/news/resources.py +25 -11
  52. zou/app/blueprints/persons/__init__.py +5 -2
  53. zou/app/blueprints/persons/resources.py +126 -120
  54. zou/app/blueprints/previews/__init__.py +18 -8
  55. zou/app/blueprints/previews/resources.py +569 -328
  56. zou/app/blueprints/projects/resources.py +1 -1
  57. zou/app/blueprints/search/resources.py +18 -6
  58. zou/app/blueprints/shots/__init__.py +5 -0
  59. zou/app/blueprints/shots/resources.py +134 -4
  60. zou/app/blueprints/source/__init__.py +6 -6
  61. zou/app/blueprints/source/csv/assets.py +10 -3
  62. zou/app/blueprints/source/csv/base.py +1 -1
  63. zou/app/blueprints/source/csv/edits.py +10 -3
  64. zou/app/blueprints/source/csv/shots.py +10 -3
  65. zou/app/blueprints/source/{edl.py → otio.py} +82 -41
  66. zou/app/blueprints/tasks/__init__.py +3 -2
  67. zou/app/blueprints/tasks/resources.py +83 -52
  68. zou/app/blueprints/user/__init__.py +9 -0
  69. zou/app/blueprints/user/resources.py +170 -12
  70. zou/app/config.py +10 -0
  71. zou/app/mixin.py +6 -5
  72. zou/app/models/attachment_file.py +10 -4
  73. zou/app/models/base.py +18 -13
  74. zou/app/models/build_job.py +7 -4
  75. zou/app/models/chat.py +44 -0
  76. zou/app/models/chat_message.py +37 -0
  77. zou/app/models/comment.py +1 -0
  78. zou/app/models/day_off.py +3 -0
  79. zou/app/models/entity.py +4 -6
  80. zou/app/models/entity_type.py +2 -0
  81. zou/app/models/organisation.py +14 -15
  82. zou/app/models/person.py +6 -1
  83. zou/app/models/project.py +3 -0
  84. zou/app/models/search_filter.py +11 -0
  85. zou/app/models/search_filter_group.py +10 -0
  86. zou/app/models/serializer.py +17 -17
  87. zou/app/models/status_automation.py +2 -0
  88. zou/app/models/studio.py +13 -0
  89. zou/app/models/subscription.py +2 -2
  90. zou/app/models/task.py +6 -1
  91. zou/app/models/task_status.py +1 -0
  92. zou/app/models/task_type.py +1 -0
  93. zou/app/models/working_file.py +1 -1
  94. zou/app/services/assets_service.py +101 -14
  95. zou/app/services/auth_service.py +17 -44
  96. zou/app/services/breakdown_service.py +37 -5
  97. zou/app/services/chats_service.py +279 -0
  98. zou/app/services/comments_service.py +110 -65
  99. zou/app/services/concepts_service.py +4 -12
  100. zou/app/services/deletion_service.py +43 -30
  101. zou/app/services/edits_service.py +5 -11
  102. zou/app/services/emails_service.py +4 -4
  103. zou/app/services/entities_service.py +17 -2
  104. zou/app/services/events_service.py +12 -4
  105. zou/app/services/exception.py +5 -5
  106. zou/app/services/names_service.py +7 -2
  107. zou/app/services/news_service.py +17 -9
  108. zou/app/services/persons_service.py +38 -21
  109. zou/app/services/playlists_service.py +8 -7
  110. zou/app/services/preview_files_service.py +137 -10
  111. zou/app/services/projects_service.py +5 -14
  112. zou/app/services/shots_service.py +221 -49
  113. zou/app/services/sync_service.py +46 -42
  114. zou/app/services/tasks_service.py +185 -46
  115. zou/app/services/time_spents_service.py +67 -20
  116. zou/app/services/user_service.py +350 -107
  117. zou/app/stores/auth_tokens_store.py +2 -1
  118. zou/app/stores/file_store.py +18 -0
  119. zou/app/stores/publisher_store.py +7 -7
  120. zou/app/stores/queue_store.py +1 -0
  121. zou/app/swagger.py +36 -20
  122. zou/app/utils/cache.py +2 -0
  123. zou/app/utils/commands.py +104 -7
  124. zou/app/utils/csv_utils.py +1 -4
  125. zou/app/utils/date_helpers.py +33 -17
  126. zou/app/utils/dbhelpers.py +14 -1
  127. zou/app/utils/emails.py +2 -2
  128. zou/app/utils/fido.py +22 -0
  129. zou/app/utils/query.py +54 -6
  130. zou/app/utils/redis.py +11 -0
  131. zou/app/utils/saml.py +51 -0
  132. zou/app/utils/string.py +2 -0
  133. zou/app/utils/thumbnail.py +4 -2
  134. zou/cli.py +76 -18
  135. zou/debug.py +4 -2
  136. zou/event_stream.py +122 -165
  137. zou/job_settings.py +1 -0
  138. zou/migrations/env.py +0 -0
  139. zou/migrations/utils/base.py +6 -6
  140. zou/migrations/versions/1bb55759146f_add_table_studio.py +67 -0
  141. zou/migrations/versions/1fab8c420678_add_attachments_to_message_chats.py +56 -0
  142. zou/migrations/versions/23122f290ca2_add_entity_chat_models.py +149 -0
  143. zou/migrations/versions/32f134ff1201_add_is_shared_flag_to_filters.py +33 -0
  144. zou/migrations/versions/57222395f2be_add_statusautomation_import_last_revision.py +41 -0
  145. zou/migrations/versions/59a7445a966c_add_entity_is_shared.py +41 -0
  146. zou/migrations/versions/5b980f0dc365_add_comment_links.py +35 -0
  147. zou/migrations/versions/680c64565f9d_for_searchfiltergroup_is_shared.py +35 -0
  148. zou/migrations/versions/8e67c183bed7_add_preference_fields.py +71 -0
  149. zou/migrations/versions/92b40d79ad3f_allow_message_attachments.py +38 -0
  150. zou/migrations/versions/971dbf5a0faf_add_short_name_for_asset_type_entity_.py +33 -0
  151. zou/migrations/versions/9b85c14fa8a7_add_day_off_new_columns.py +68 -0
  152. zou/migrations/versions/9d3bb33c6fc6_add_department_keys_to_filter_models.py +73 -0
  153. zou/migrations/versions/a252a094e977_add_descriptions_for_entities_tasks_and_.py +40 -0
  154. zou/migrations/versions/be56dc0fb760_for_is_shared_disallow_nullable.py +102 -0
  155. zou/migrations/versions/ca28796a2a62_add_is_done_field_to_the_task_model.py +108 -0
  156. zou/migrations/versions/f344b867a911_for_description_of_entity_task_working_.py +75 -0
  157. zou/remote/config_payload.py +2 -1
  158. zou/utils/movie.py +14 -4
  159. {zou-0.19.15.dist-info → zou-0.20.11.dist-info}/METADATA +75 -69
  160. {zou-0.19.15.dist-info → zou-0.20.11.dist-info}/RECORD +163 -134
  161. {zou-0.19.15.dist-info → zou-0.20.11.dist-info}/WHEEL +1 -1
  162. {zou-0.19.15.dist-info → zou-0.20.11.dist-info}/LICENSE +0 -0
  163. {zou-0.19.15.dist-info → zou-0.20.11.dist-info}/entry_points.txt +0 -0
  164. {zou-0.19.15.dist-info → zou-0.20.11.dist-info}/top_level.txt +0 -0
@@ -13,6 +13,7 @@ from zou.app.models.task_type import TaskType
13
13
  from zou.app.models.time_spent import TimeSpent
14
14
  from zou.app.models.entity import Entity
15
15
  from zou.app.models.entity_type import EntityType
16
+ from zou.app.models.person import Person
16
17
 
17
18
  from zou.app.utils import fields, date_helpers
18
19
 
@@ -32,7 +33,9 @@ def get_time_spents_for_entity(entity_id):
32
33
  return TimeSpent.serialize_list(query.all())
33
34
 
34
35
 
35
- def get_year_table(person_id=None, project_id=None, department_ids=None):
36
+ def get_year_table(
37
+ person_id=None, project_id=None, department_ids=None, studio_id=None
38
+ ):
36
39
  """
37
40
  Return a table giving time spent by user and by month for given year.
38
41
  """
@@ -42,11 +45,12 @@ def get_year_table(person_id=None, project_id=None, department_ids=None):
42
45
  person_id=person_id,
43
46
  project_id=project_id,
44
47
  department_ids=department_ids,
48
+ studio_id=studio_id,
45
49
  )
46
50
 
47
51
 
48
52
  def get_month_table(
49
- year, person_id=None, project_id=None, department_ids=None
53
+ year, person_id=None, project_id=None, department_ids=None, studio_id=None
50
54
  ):
51
55
  """
52
56
  Return a table giving time spent by user and by month for given year.
@@ -56,10 +60,13 @@ def get_month_table(
56
60
  person_id=person_id,
57
61
  project_id=project_id,
58
62
  department_ids=department_ids,
63
+ studio_id=studio_id,
59
64
  )
60
65
 
61
66
 
62
- def get_week_table(year, person_id=None, project_id=None, department_ids=None):
67
+ def get_week_table(
68
+ year, person_id=None, project_id=None, department_ids=None, studio_id=None
69
+ ):
63
70
  """
64
71
  Return a table giving time spent by user and by week for given year.
65
72
  """
@@ -69,11 +76,17 @@ def get_week_table(year, person_id=None, project_id=None, department_ids=None):
69
76
  person_id=person_id,
70
77
  project_id=project_id,
71
78
  department_ids=department_ids,
79
+ studio_id=studio_id,
72
80
  )
73
81
 
74
82
 
75
83
  def get_day_table(
76
- year, month, person_id=None, project_id=None, department_ids=None
84
+ year,
85
+ month,
86
+ person_id=None,
87
+ project_id=None,
88
+ department_ids=None,
89
+ studio_id=None,
77
90
  ):
78
91
  """
79
92
  Return a table giving time spent by user and by day for given year and
@@ -85,6 +98,7 @@ def get_day_table(
85
98
  person_id=person_id,
86
99
  project_id=project_id,
87
100
  department_ids=department_ids,
101
+ studio_id=studio_id,
88
102
  )
89
103
  return get_table_from_time_spents(time_spents, "day")
90
104
 
@@ -95,6 +109,7 @@ def get_yearly_table(
95
109
  person_id=None,
96
110
  project_id=None,
97
111
  department_ids=None,
112
+ studio_id=None,
98
113
  ):
99
114
  """
100
115
  Return a table giving time spent by user and by week or month for given
@@ -106,12 +121,17 @@ def get_yearly_table(
106
121
  person_id=person_id,
107
122
  project_id=project_id,
108
123
  department_ids=department_ids,
124
+ studio_id=studio_id,
109
125
  )
110
126
  return get_table_from_time_spents(time_spents, detail_level)
111
127
 
112
128
 
113
129
  def get_time_spents_for_year(
114
- year=None, person_id=None, project_id=None, department_ids=None
130
+ year=None,
131
+ person_id=None,
132
+ project_id=None,
133
+ department_ids=None,
134
+ studio_id=None,
115
135
  ):
116
136
  """
117
137
  Return all time spents for given year.
@@ -138,16 +158,26 @@ def get_time_spents_for_year(
138
158
  else:
139
159
  query = query.filter(Task.project_id == project_id)
140
160
 
141
- if department_ids is not None:
161
+ if department_ids:
142
162
  query = query.join(TaskType).filter(
143
163
  TaskType.department_id.in_(department_ids)
144
164
  )
145
165
 
166
+ if studio_id is not None:
167
+ query = query.join(Person, Person.id == TimeSpent.person_id).filter(
168
+ Person.studio_id == studio_id
169
+ )
170
+
146
171
  return query.all()
147
172
 
148
173
 
149
174
  def get_time_spents_for_month(
150
- year, month, person_id=None, project_id=None, department_ids=None
175
+ year,
176
+ month,
177
+ person_id=None,
178
+ project_id=None,
179
+ department_ids=None,
180
+ studio_id=None,
151
181
  ):
152
182
  """
153
183
  Return all time spents for given month.
@@ -170,9 +200,15 @@ def get_time_spents_for_month(
170
200
  else:
171
201
  query = query.filter(Task.project_id == project_id)
172
202
 
173
- if department_ids is not None:
174
- query = query.join(TaskType)
175
- query = query.filter(TaskType.department_id.in_(department_ids))
203
+ if department_ids:
204
+ query = query.join(TaskType).filter(
205
+ TaskType.department_id.in_(department_ids)
206
+ )
207
+
208
+ if studio_id is not None:
209
+ query = query.join(Person, Person.id == TimeSpent.person_id).filter(
210
+ Person.studio_id == studio_id
211
+ )
176
212
 
177
213
  return query.all()
178
214
 
@@ -219,7 +255,7 @@ def get_time_spents(
219
255
  if project_ids is not None:
220
256
  query = query.filter(Task.project_id.in_(project_ids))
221
257
 
222
- if department_ids is not None:
258
+ if department_ids:
223
259
  query = query.join(TaskType)
224
260
  query = query.filter(TaskType.department_id.in_(department_ids))
225
261
  except DataError:
@@ -268,7 +304,10 @@ def get_day_off(person_id, date):
268
304
  """
269
305
  try:
270
306
  day_off = DayOff.get_by(
271
- person_id=person_id, date=func.cast(date, TimeSpent.date.type)
307
+ func.cast(date, DayOff.date.type).between(
308
+ DayOff.date, DayOff.end_date
309
+ ),
310
+ person_id=person_id,
272
311
  )
273
312
  except DataError:
274
313
  raise WrongDateFormatException
@@ -391,7 +430,7 @@ def get_person_time_spent_entries(
391
430
  else:
392
431
  query = query.filter(Task.project_id == project_id)
393
432
 
394
- if department_ids is not None:
433
+ if department_ids:
395
434
  query = query.join(TaskType, TaskType.id == Task.task_type_id).filter(
396
435
  TaskType.department_id.in_(department_ids)
397
436
  )
@@ -467,19 +506,27 @@ def get_person_day_offs_for_year(person_id, year):
467
506
  return get_day_offs_between(start, end, person_id=person_id)
468
507
 
469
508
 
470
- def get_day_offs_between(start, end, person_id=None):
509
+ def get_day_offs_between(
510
+ start=None, end=None, person_id=None, exclude_id=None
511
+ ):
471
512
  """
472
- Get all day off entries for given person, year.
513
+ Get all day off entries for given person, start and end date.
473
514
  """
474
515
  query = DayOff.query
475
516
  if person_id is not None:
476
517
  query = query.filter(DayOff.person_id == person_id)
477
518
 
478
- return DayOff.serialize_list(
479
- query.filter(DayOff.date >= func.cast(start, TimeSpent.date.type))
480
- .filter(DayOff.date < func.cast(end, TimeSpent.date.type))
481
- .all()
482
- )
519
+ if start is not None:
520
+ query = query.filter(
521
+ func.cast(start, DayOff.end_date.type) <= DayOff.end_date
522
+ )
523
+ if end is not None:
524
+ query = query.filter(func.cast(end, DayOff.date.type) >= DayOff.date)
525
+
526
+ if exclude_id is not None:
527
+ query = query.filter(DayOff.id != exclude_id)
528
+
529
+ return DayOff.serialize_list(query.all())
483
530
 
484
531
 
485
532
  def get_timezoned_interval(start, end):