refactor worker flow

This commit is contained in:
shimon
2022-06-22 17:44:03 +03:00
parent d6007b24ec
commit c7534760a0
6 changed files with 228 additions and 103 deletions
+14
View File
@@ -153,6 +153,20 @@ App::post('/v1/projects')
$dbForProject->createCollection($key, $attributes, $indexes);
}
if($dbForProject->exists($dbForProject->getDefaultDatabase(), 'video_profiles')) {
foreach (Config::getParam('profiles', []) as $profile) {
Authorization::skip(function () use ($project, $profile, $dbForProject) {
return $dbForProject->createDocument('video_profiles', new Document([
'name' => $profile['name'],
'videoBitrate' => $profile['videoBitrate'],
'audioBitrate' => $profile['audioBitrate'],
'width' => $profile['width'],
'height' => $profile['height']
]));
});
}
}
$response->setStatusCode(Response::STATUS_CODE_CREATED);
$response->dynamic($project, Response::MODEL_PROJECT);
});