mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
replaced 'add_sites_to_representations' with 'reset_timer' in rest api
This commit is contained in:
parent
8feedcbc15
commit
50afec5222
1 changed files with 3 additions and 28 deletions
|
|
@ -26,36 +26,11 @@ class SyncServerModuleRestApi:
|
|||
def register(self):
|
||||
self.server_manager.add_route(
|
||||
"POST",
|
||||
self.prefix + "/add_sites_to_representations",
|
||||
self.add_sites_to_representations,
|
||||
self.prefix + "/reset_timer",
|
||||
self.reset_timer,
|
||||
)
|
||||
|
||||
async def add_sites_to_representations(self, request):
|
||||
# Extract data from request
|
||||
data = await request.json()
|
||||
try:
|
||||
project_name = data["project_name"]
|
||||
sites = data["sites"]
|
||||
representations = data["representations"]
|
||||
except KeyError:
|
||||
msg = (
|
||||
"Payload must contain fields 'project_name,"
|
||||
" 'sites' (list of names) and 'representations' (list of IDs)"
|
||||
)
|
||||
self.log.error(msg)
|
||||
return Response(status=400, message=msg)
|
||||
|
||||
# Add all sites to each representation
|
||||
for representation_id in representations:
|
||||
for site in sites:
|
||||
self.module.add_site(
|
||||
project_name,
|
||||
representation_id,
|
||||
site,
|
||||
force=True,
|
||||
priority=99,
|
||||
)
|
||||
|
||||
async def reset_timer(self, request):
|
||||
# Force timer to run immediately
|
||||
self.module.reset_timer()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue