Esempio n. 1
0
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))
Esempio n. 2
0
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))
Esempio n. 3
0
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))
Esempio n. 4
0
def login(phone: int, pin: int):
    try:
        return json_response(UserLoginStory().execute(phone, pin))
    except StoreValidation as e:
        raise BadRequest(message=str(e))
Esempio n. 5
0
def get_confirmation(phone: int):
    try:
        GetConfirmationStory().execute(phone)
        return json_response()
    except StoreValidation as e:
        raise BadRequest(message=str(e))
Esempio n. 6
0
def register(**kwargs):
    try:
        return json_response(data=UserStoreStory().execute(**kwargs))
    except StoreValidation as e:
        raise BadRequest(message=str(e))
Esempio n. 7
0
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))