from auth.auth_view import RegisteredAuthorizedView from projects.validators import ProjectsValidator from services.recent_search.recent_search_service import RecentSearchesService from projects.services.unclaimed_project_service import UnclaimedProjectsService from projects.schemas import update_project_params, project_response_schema, ProjectResponseSchema from flask_apispec import marshal_with, doc, use_kwargs @doc(tags=["Project"]) class ClaimProjectView(RegisteredAuthorizedView): projects_validator = ProjectsValidator() service = UnclaimedProjectsService() # recent_search_service = RecentSearchesService() @doc(description='Create artist team user and artist teams is needed') @use_kwargs(update_project_params) @marshal_with(schema=project_response_schema, code=200, description='Project successfully claimed') @marshal_with(schema=None, code=401, description='User is not authenticated') @marshal_with(schema=None, code=404, description='Project not found') @marshal_with(schema=None, code=403, description='Claiming ownership of this project is forbidden') def post(self, params, project_id) -> ProjectResponseSchema: self.projects_validator.validate_project_exists(project_id) self.permissions.can_claim_project(project_id) return self.service.claim_project(project_id, params)