def get(self, project_id): """ Retrieve all asset types for given project. """ if not permissions.has_manager_permissions(): user_service.check_has_task_related(project_id) asset_types = assets_service.get_asset_types_for_project(project_id) return asset_types
def get_asset_types_schedule_items(project_id, task_type_id): """ Return all asset type schedule items for given project. If no schedule item exists for a given asset type, it creates one. """ asset_types = assets_service.get_asset_types_for_project(project_id) asset_type_map = base_service.get_model_map_from_array(asset_types) existing_schedule_items = set( ScheduleItem.query.join( EntityType, ScheduleItem.object_id == EntityType.id).filter( ScheduleItem.project_id == project_id).filter( ScheduleItem.task_type_id == task_type_id).all()) return get_entity_schedule_items( project_id, task_type_id, asset_types, asset_type_map, existing_schedule_items, )
def get(self, project_id): """ Retrieve all asset types for given project. --- tags: - Assets parameters: - in: path name: project_id schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 required: True responses: 200: description: All asset types for given project """ user_service.check_project_access(project_id) return assets_service.get_asset_types_for_project(project_id)
def prepare_import(self, project_id, task_type_id, episode_id=None): self.organisation = Organisation.query.first() self.assets_map = {} self.shots_map = {} self.tasks_map = {} asset_types_map = {} asset_types = assets_service.get_asset_types_for_project(project_id) for asset_type in asset_types: asset_types_map[asset_type["id"]] = slugify(asset_type["name"]) criterions_assets = {"project_id": project_id} if episode_id is not None and episode_id not in ["main", "all"]: criterions_assets["source_id"] = episode_id assets = assets_service.get_assets(criterions_assets) for asset in assets: key = "%s%s" % ( asset_types_map[asset["entity_type_id"]], slugify(asset["name"]), ) self.assets_map[key] = asset["id"] sequences_map = {} criterions_sequences = {"project_id": project_id} if episode_id is not None and episode_id not in ["main", "all"]: criterions_sequences["parent_id"] = episode_id sequences = shots_service.get_sequences(criterions_sequences) for sequence in sequences: sequences_map[sequence["id"]] = slugify(sequence["name"]) shots = shots_service.get_shots({"project_id": project_id}) for shot in shots: sequence_key = sequences_map.get(shot["parent_id"]) if sequence_key is not None: key = "%s%s" % (sequence_key, slugify(shot["name"])) self.shots_map[key] = shot["id"] for task in tasks_service.get_tasks_for_project_and_task_type( project_id, task_type_id): self.tasks_map[task["entity_id"]] = task["id"]
def get(self, project_id): """ Retrieve all asset types for given project. """ user_service.check_project_access(project_id) return assets_service.get_asset_types_for_project(project_id)
def test_get_asset_types_for_project(self): asset_types = assets_service.get_asset_types_for_project( self.project.id) self.assertEqual(len(asset_types), 1) self.assertEqual(asset_types[0]["name"], "Props")