zou 1.0.3__py3-none-any.whl → 1.0.4__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "1.0.3"
1
+ __version__ = "1.0.4"
@@ -38,6 +38,13 @@ class EventsResource(Resource, ArgsMixin):
38
38
  default: false
39
39
  description: Return only file-related events
40
40
  example: false
41
+ - in: query
42
+ name: cursor_event_id
43
+ required: False
44
+ type: string
45
+ format: uuid
46
+ example: a24a6ea4-ce75-4665-a070-57453082c25
47
+ description: ID of the last event from previous page for cursor-based pagination
41
48
  - in: query
42
49
  name: limit
43
50
  type: integer
@@ -99,7 +106,8 @@ class EventsResource(Resource, ArgsMixin):
99
106
  ("after", None, False),
100
107
  ("before", None, False),
101
108
  ("only_files", False, False),
102
- ("limit", 100, False),
109
+ ("cursor_event_id", None, False),
110
+ ("limit", 100, False, int),
103
111
  ("project_id", None, False),
104
112
  ("name", None, False),
105
113
  ],
@@ -108,6 +116,7 @@ class EventsResource(Resource, ArgsMixin):
108
116
  permissions.check_manager_permissions()
109
117
  before = self.parse_date_parameter(args["before"])
110
118
  after = self.parse_date_parameter(args["after"])
119
+ cursor_event_id = args["cursor_event_id"]
111
120
  limit = args["limit"]
112
121
  only_files = args["only_files"] == "true"
113
122
  project_id = args.get("project_id", None)
@@ -116,15 +125,21 @@ class EventsResource(Resource, ArgsMixin):
116
125
  raise WrongParameterException(
117
126
  "The project_id parameter is not a valid id"
118
127
  )
119
- else:
120
- return events_service.get_last_events(
121
- after=after,
122
- before=before,
123
- limit=limit,
124
- only_files=only_files,
125
- project_id=project_id,
126
- name=name,
128
+ if cursor_event_id is not None and not fields.is_valid_id(
129
+ cursor_event_id
130
+ ):
131
+ raise WrongParameterException(
132
+ "The cursor_event_id parameter is not a valid id"
127
133
  )
134
+ return events_service.get_last_events(
135
+ after=after,
136
+ before=before,
137
+ cursor_event_id=cursor_event_id,
138
+ limit=limit,
139
+ only_files=only_files,
140
+ project_id=project_id,
141
+ name=name,
142
+ )
128
143
 
129
144
 
130
145
  class LoginLogsResource(Resource, ArgsMixin):
@@ -27,6 +27,7 @@ from zou.app.services import (
27
27
  from zou.app.stores import queue_store
28
28
  from zou.utils import movie
29
29
  from zou.app.utils import (
30
+ fields,
30
31
  fs,
31
32
  events,
32
33
  permissions,
@@ -1567,6 +1568,20 @@ class RunningPreviewFiles(Resource, ArgsMixin):
1567
1568
  states equal to processing or broken.
1568
1569
  tags:
1569
1570
  - Previews
1571
+ parameters:
1572
+ - in: query
1573
+ name: cursor_preview_file_id
1574
+ required: false
1575
+ type: string
1576
+ format: uuid
1577
+ description: ID of the last preview file from previous page for cursor-based pagination
1578
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1579
+ - in: query
1580
+ name: limit
1581
+ required: false
1582
+ type: integer
1583
+ description: Maximum number of preview files to return
1584
+ example: 100
1570
1585
  responses:
1571
1586
  200:
1572
1587
  description: All preview files from open productions with processing or broken states
@@ -1588,7 +1603,26 @@ class RunningPreviewFiles(Resource, ArgsMixin):
1588
1603
  example: "processing"
1589
1604
  """
1590
1605
  permissions.check_admin_permissions()
1591
- return preview_files_service.get_running_preview_files()
1606
+ args = self.get_args(
1607
+ [
1608
+ ("cursor_preview_file_id", None, False),
1609
+ ("limit", None, False, int),
1610
+ ],
1611
+ )
1612
+ cursor_preview_file_id = args["cursor_preview_file_id"]
1613
+ limit = args["limit"]
1614
+
1615
+ if cursor_preview_file_id is not None and not fields.is_valid_id(
1616
+ cursor_preview_file_id
1617
+ ):
1618
+ raise WrongParameterException(
1619
+ "The cursor_preview_file_id parameter is not a valid id"
1620
+ )
1621
+
1622
+ return preview_files_service.get_running_preview_files(
1623
+ cursor_preview_file_id=cursor_preview_file_id,
1624
+ limit=limit,
1625
+ )
1592
1626
 
1593
1627
 
1594
1628
  class ExtractFrameFromPreview(Resource, ArgsMixin):
@@ -1,20 +1,22 @@
1
1
  from zou.app.models.event import ApiEvent
2
2
  from zou.app.models.login_log import LoginLog
3
3
  from zou.app.utils import fields
4
+ from zou.app.services.exception import WrongParameterException
4
5
  from sqlalchemy import func
5
6
 
6
7
 
7
8
  def get_last_events(
8
9
  after=None,
9
10
  before=None,
11
+ cursor_event_id=None,
10
12
  limit=100,
11
13
  only_files=False,
12
14
  project_id=None,
13
15
  name=None,
14
16
  ):
15
17
  """
16
- Return last 100 events published. If before parameter is set, it returns
17
- last 100 events before this date.
18
+ Return paginated events using cursor-based pagination.
19
+ If cursor_event_id is set, it returns events older than this event.
18
20
  """
19
21
  query = ApiEvent.query.order_by(ApiEvent.created_at.desc())
20
22
 
@@ -46,6 +48,14 @@ def get_last_events(
46
48
  if name is not None:
47
49
  query = query.filter(ApiEvent.name == name)
48
50
 
51
+ if cursor_event_id is not None:
52
+ cursor_event = ApiEvent.query.get(cursor_event_id)
53
+ if cursor_event is None:
54
+ raise WrongParameterException(
55
+ f"No event found with id: {cursor_event_id}"
56
+ )
57
+ query = query.filter(ApiEvent.created_at < cursor_event.created_at)
58
+
49
59
  events = query.limit(limit).all()
50
60
  return [
51
61
  fields.serialize_dict(
@@ -551,12 +551,12 @@ def _clear_empty_annotations(annotations):
551
551
  ]
552
552
 
553
553
 
554
- def get_running_preview_files():
554
+ def get_running_preview_files(cursor_preview_file_id=None, limit=None):
555
555
  """
556
556
  Return preview files for all productions with status equals to broken
557
- or processing.
557
+ or processing using cursor-based pagination.
558
558
  """
559
- entries = (
559
+ query = (
560
560
  PreviewFile.query.join(Task)
561
561
  .join(Project)
562
562
  .join(ProjectStatus, ProjectStatus.id == Project.project_status_id)
@@ -566,6 +566,21 @@ def get_running_preview_files():
566
566
  .order_by(PreviewFile.created_at.desc())
567
567
  )
568
568
 
569
+ if cursor_preview_file_id is not None:
570
+ cursor_preview_file = PreviewFile.query.get(cursor_preview_file_id)
571
+ if cursor_preview_file is None:
572
+ raise WrongParameterException(
573
+ f"No preview file found with id: {cursor_preview_file_id}"
574
+ )
575
+ query = query.filter(
576
+ PreviewFile.created_at < cursor_preview_file.created_at
577
+ )
578
+
579
+ if limit is not None:
580
+ query = query.limit(limit)
581
+
582
+ entries = query.all()
583
+
569
584
  results = []
570
585
  for preview_file, project_id, task_type_id, entity_id in entries:
571
586
  result = preview_file.serialize()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zou
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: API to store and manage the data of your animation production
5
5
  Home-page: https://zou.cg-wire.com
6
6
  Author: CG Wire
@@ -1,4 +1,4 @@
1
- zou/__init__.py,sha256=2plzdEEb24FLjE2I2XyBBcJEPYWHccNL4SgtLC_6erg,22
1
+ zou/__init__.py,sha256=acuR_XSJzp4OrQ5T8-Ac5gYe48mUwObuwjRmisFmZ7k,22
2
2
  zou/cli.py,sha256=N9FyrL4TDgIiCUa-I3xIzOgiVLM14kz8_QLQ48y51oE,22767
3
3
  zou/debug.py,sha256=1fawPbkD4wn0Y9Gk0BiBFSa-CQe5agFi8R9uJYl2Uyk,520
4
4
  zou/event_stream.py,sha256=9O1PE_vDW8p3yfHJNSZ8w0ybD-660x8oGN0izgJdTjM,8575
@@ -74,7 +74,7 @@ zou/app/blueprints/edits/resources.py,sha256=TLdajQm-b9q-QjBo__NeX95VvxUCLUovj34
74
74
  zou/app/blueprints/entities/__init__.py,sha256=v-qt2dl3s3tmK_ur-cpDHNPmcL0A6xCybczyuidjUCo,713
75
75
  zou/app/blueprints/entities/resources.py,sha256=KDvGz7xtEkG5cE_oe8ivdX_NqmBhQcpV6Em35WX8zIY,11262
76
76
  zou/app/blueprints/events/__init__.py,sha256=Vb0gO7Bpj_2Dpx9hhKd2SZW2qqnJrFVoDpJjFOmoMZw,394
77
- zou/app/blueprints/events/resources.py,sha256=K85om5n0WjBahUp2vE56Mf1VLExrdCLLQXL2C_lE0ic,7119
77
+ zou/app/blueprints/events/resources.py,sha256=N_KFpwo9IJucZhZN67mqIYfAuYVW50c1f_dReGys88Y,7736
78
78
  zou/app/blueprints/export/__init__.py,sha256=W3U93VD-dHlozFVSt_RDvP7h7K_FqgHPLA__W5H1DkE,1574
79
79
  zou/app/blueprints/export/csv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
80
  zou/app/blueprints/export/csv/assets.py,sha256=QzRoX00bOX6M1ISPPWqhmNZPDah36avit72mBE1_A28,6282
@@ -99,7 +99,7 @@ zou/app/blueprints/persons/resources.py,sha256=-2FV1rDkMDtEvrUkbHdHFC7lTCoWRkxjI
99
99
  zou/app/blueprints/playlists/__init__.py,sha256=gI6dV102RwsztOnUDk53BErYd9zrjA43gfNgGeYwfFU,1700
100
100
  zou/app/blueprints/playlists/resources.py,sha256=2NA5UAnl7JQUIB0WbmMmXnFqKB6pEdbgWqhlNqdxyE8,28978
101
101
  zou/app/blueprints/previews/__init__.py,sha256=ihC6OQ9AUjnZ2JeMnjRh_tKGO0UmAjOwhZnOivc3BnQ,4460
102
- zou/app/blueprints/previews/resources.py,sha256=uCSQ1ytpCGHvbg-NcWtY0vEQWznxb2mLKN0V-BR03Ko,61722
102
+ zou/app/blueprints/previews/resources.py,sha256=YdwlPATv3bCB5OrzEE0wfVyPkEUrLES1WNjQ3FUEdf8,62854
103
103
  zou/app/blueprints/projects/__init__.py,sha256=mUQI2C_6GfH-JkhPEOpGsGCYBbCr__c5CWPaW7sKH4c,6103
104
104
  zou/app/blueprints/projects/resources.py,sha256=q4hEOkA7vOfncrEeoXb6FQJ2TwVo0xKs44M0SAu4ZHc,87747
105
105
  zou/app/blueprints/search/__init__.py,sha256=QCjQIY_85l_orhdEiqav_GifjReuwsjZggN3V0GeUVY,356
@@ -208,7 +208,7 @@ zou/app/services/departments_service.py,sha256=7jLKH7ziToc6uHZsZKdBUzN2Ubi2YloHC
208
208
  zou/app/services/edits_service.py,sha256=hfg6Fk9J9W41Qyw96UF35cSgbXqCYci6H8OY5rL_cIk,12075
209
209
  zou/app/services/emails_service.py,sha256=6Ye4dUB_04XItdH6mynCERYP2Jj5wYTYrJQfir7slDA,14993
210
210
  zou/app/services/entities_service.py,sha256=mSVoKt06pF9-7H5eD43UpfwOpSGWKjrE7F7eo0IBjw8,17788
211
- zou/app/services/events_service.py,sha256=Ew-bY5hqrWLmpbVj1_xd3E2S3JtyAGzdgw2XjudTZjc,2700
211
+ zou/app/services/events_service.py,sha256=lsBzNo4zez9ucYZQLUDJh_hv37KyOO_OoSxZiEHB72E,3128
212
212
  zou/app/services/exception.py,sha256=VaQbvvv7yJ-lCFOlvAPKkYPuw7MjCaSAo1F40fS3kZ8,4478
213
213
  zou/app/services/file_tree_service.py,sha256=sz2Eq4S5VqEU7AupmKtRzX2W8ouUheTyYWkgiMf2G6o,33857
214
214
  zou/app/services/files_service.py,sha256=df1_9v-vwE5HVi9XjtilTPWHuiWunvrwPyQh_IXupNM,28517
@@ -219,7 +219,7 @@ zou/app/services/notifications_service.py,sha256=FsZ7rFv8p_4bVn0IlpW7TIo5rDQoupO
219
219
  zou/app/services/persons_service.py,sha256=XtaYofeYgjNIaQ-nvynj15jW2yDWEqdUtJgf7l0SgDg,16450
220
220
  zou/app/services/playlists_service.py,sha256=ftEP7LFyPAXogssOYi3TGZstdn2k9eq5o5FveYC25TI,33282
221
221
  zou/app/services/plugins_service.py,sha256=dbU-2f7t3eo6VISQBsASM8Or4Y8ha6Vt8ZHgtizdOi0,1917
222
- zou/app/services/preview_files_service.py,sha256=mxOc1bBjlA3a900QU6fUufBM1JmAzr5D8jvcf_HAkXM,36178
222
+ zou/app/services/preview_files_service.py,sha256=nHjRa_5zwGUZDbrYDwhEBMNzgaGCAwrQCn-HhONfXKI,36734
223
223
  zou/app/services/projects_service.py,sha256=OBKFEYna-hi1WfVM3FtcYCpe_AoHVP3C3zSk97VPNKQ,23665
224
224
  zou/app/services/scenes_service.py,sha256=iXN19HU4njPF5VtZXuUrVJ-W23ZQuQNPC3ADXltbWtU,992
225
225
  zou/app/services/schedule_service.py,sha256=cG8RRjdjMX4_D04cSt-WkqBCNeCQMLyX0O-I99DwCqI,14474
@@ -475,9 +475,9 @@ zou/remote/normalize_movie.py,sha256=zNfEY3N1UbAHZfddGONTg2Sff3ieLVWd4dfZa1dpnes
475
475
  zou/remote/playlist.py,sha256=AsDo0bgYhDcd6DfNRV6r6Jj3URWwavE2ZN3VkKRPbLU,3293
476
476
  zou/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
477
477
  zou/utils/movie.py,sha256=d67fIL9dVBKt-E_qCGXRbNNdbJaJR5sHvZeX3hf8ldE,16559
478
- zou-1.0.3.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
479
- zou-1.0.3.dist-info/METADATA,sha256=rFFzVXfuB7IqirHHztqP8hMLdzfEHVZ8SbhsMFZuVaY,6695
480
- zou-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
481
- zou-1.0.3.dist-info/entry_points.txt,sha256=PelQoIx3qhQ_Tmne7wrLY-1m2izuzgpwokoURwSohy4,130
482
- zou-1.0.3.dist-info/top_level.txt,sha256=4S7G_jk4MzpToeDItHGjPhHx_fRdX52zJZWTD4SL54g,4
483
- zou-1.0.3.dist-info/RECORD,,
478
+ zou-1.0.4.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
479
+ zou-1.0.4.dist-info/METADATA,sha256=96AdsyHrnhMFfUG2gWlBr-lXNUleEtpxVc1yNSWauDE,6695
480
+ zou-1.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
481
+ zou-1.0.4.dist-info/entry_points.txt,sha256=PelQoIx3qhQ_Tmne7wrLY-1m2izuzgpwokoURwSohy4,130
482
+ zou-1.0.4.dist-info/top_level.txt,sha256=4S7G_jk4MzpToeDItHGjPhHx_fRdX52zJZWTD4SL54g,4
483
+ zou-1.0.4.dist-info/RECORD,,
File without changes