async def method_post(self, request: Request, body: dict, session, *args, **kwargs) -> BaseHTTPResponse: request_model = RequestCreateEmployeeDto(body) try: hashed_password = generate_hash(request_model.password) except GeneratePasswordHashException as e: raise SanicPasswordHashException(str(e)) try: db_employee = employee_queries.create_employee( session, request_model, hashed_password) except DBEmployeeExistsException: raise SanicEmployeeConflictException('Login is busy') try: session.commit_session() except (DBDataException, DBIntegrityException) as e: raise SanicDBException(str(e)) response_model = ResponseEmployeeDto(db_employee) return await self.make_response_json(body=response_model.dump(), status=201)
async def method_post(self, request: Request, body: dict, session, *args, **kwargs) -> BaseHTTPResponse: request_model = RequestCreateEmployeeDto(body) db_employee = employee_queries.create_employee(session, request_model) session.commit_session() response_model = ResponseEmployeeDto(db_employee) return await self.make_response_json(body=response_model.dump(), status=201)