def create_order(total_price, ctx: AuthContext, if_match: int): try: schema = order_store_schema(OrderSaga().create(total_price, ctx, if_match)) return json_response(data=schema) except StoreValidation as e: raise BadRequest(message=str(e))
def auth(): token = request.headers.get('Authorization') if token is None: raise BadRequest(message='Authorization token not found') try: headers = AuthStory().execute(token) return json_response(headers=headers) except Exception as e: raise NotAuthorized(message=str(e))
def create_order(total_price, ctx: AuthContext, if_match: int): try: return json_response( data=OrderStoreStory().execute(total_price, ctx, if_match)) except StoreValidation as e: raise BadRequest(message=str(e))
def login(phone: int, pin: int): try: return json_response(UserLoginStory().execute(phone, pin)) except StoreValidation as e: raise BadRequest(message=str(e))
def get_confirmation(phone: int): try: GetConfirmationStory().execute(phone) return json_response() except StoreValidation as e: raise BadRequest(message=str(e))
def register(**kwargs): try: return json_response(data=UserStoreStory().execute(**kwargs)) except StoreValidation as e: raise BadRequest(message=str(e))
def update(ctx: AuthContext, first_name, last_name): try: return json_response( data=UserUpdateByCtxStory().execute(ctx, first_name, last_name)) except StoreValidation as e: raise BadRequest(message=str(e))