예제 #1
0
    def get(cls, name: str):
        shop_list = ShoppingListModel.find_by_name(name)
        if shop_list:
            return shopping_list_schema.dump(shop_list), 200

        return {"message": gettext("shop_list_not_found")}, 404
예제 #2
0
 def delete(cls, user_id: int):
     user = UserModel.find_by_id(user_id)
     if not user:
         return {"message": gettext("user_not_found")}, 404
     user.delete_from_db()
     return {"message": gettext("user_deleted")}, 200
예제 #3
0
    def get(cls, user_id: int):
        user = UserModel.find_by_id(user_id)
        if not user:
            return {"message": gettext("user_not_found")}, 404

        return user_schema.dump(user), 200
 def get(cls, name: str):
     item = ItemModel.find_by_name(name)
     if item:
         return item_schema.dump(item), 200
     return {'message': gettext('item_not_found')}, 404
    def delete(cls, name: str):
        store = StoreModel.find_by_name(name)
        if store:
            store.delete_from_db()

        return {"message": gettext("store_deleted")}
예제 #6
0
 def post(cls):
     jti = get_raw_jwt()["jti"]  # jti is "JWT ID", a unique identifier for a JWT.
     user_id = get_jwt_identity()
     BLACKLIST.add(jti)
     return {"message": gettext("user_logged_out").format(user_id)}, 200
예제 #7
0
 def get(cls, name: str):
     item = ItemModel.find_by_name(name)
     if item:
         return item_schema.dump(item)
     return {"message": gettext("item_not_found")}, 404
예제 #8
0
    def get(cls, user_id: int, offer_id: int):
        offer = OfferModel.find_by_id(offer_id)
        if not offer:
            return {"message": gettext("offer_not_found")}, 404

        return offer_schema.dump(offer), 200
예제 #9
0
    def get(cls, email: str):
        customer = CustomerModel.find_by_email(email)

        if customer:
            return customer_schema.dump(customer), 200
        return {"message": gettext("CUSTOMER_NOT_FOUND")}, 404
예제 #10
0
    def delete(cls, name: str):
        store = StoreModel.find_by_name(name)
        if store:
            store.delete_from_db()

        return {'message': gettext('store_deleted')}
예제 #11
0
def postlogoutpage(user_id):
    return render_template("post_logout.html",
                           text=gettext("user_logged_out").format(user_id))
예제 #12
0
def postloginpage(response):
    if response == "success":
        return render_template("post_login.html",
                               text=gettext("user_logged_in"))
    return render_template("post_login.html",
                           text=gettext("user_invalid_credentials"))
예제 #13
0
    def get(cls, id: int):
        payment = PaymentModel.find_by_id(id)
        if order:
            return payment_schema.dump(payment), 200

        return {"message": gettext("order_not_found")}, 404
예제 #14
0
 def delete(cls, name: str):
     item = ItemModel.find_by_name(name)
     if item:
         item.delete_from_db()
         return {'message': gettext("generic_deleted").format(name)}
     return {'message': gettext("item_not_found").format(name)}, 404
예제 #15
0
파일: post.py 프로젝트: stenlyx/final-try
    def get(cls, name: str):
        post = PostModel.find_by_name(name)
        if post:
            return post_schema.dump(post), 200

        return {"message": gettext("post_not_found")}, 404
예제 #16
0
 def delete(self, name: str):
     x = StoreModel.find_store_by_name(name)
     if x:
         x.delete()
     return {"message": (gettext("store_STORE_DELETED_MSG"))}
예제 #17
0
    def patch(cls):
        users = UserModel.find_all_users()
        if not users:
            return {"message": gettext("user_not_found")}, 404

        return {"users": user_list_schema.dump(users)}, 200
예제 #18
0
 def delete(cls, user_id: int, offer_id: int):
     offer = OfferModel.find_by_id(offer_id)
     if offer:
         offer.delete_from_db()
         return {"message": gettext("offer_deleted")}, 200
     return {"message": gettext("offer_not_found")}, 400
예제 #19
0
파일: user.py 프로젝트: eneskanra/taskapi
 def post(cls):
     jti = get_jwt()['jti']
     BLACKLIST.add(jti)
     return {'message': gettext("user_logged_out")}, 200
예제 #20
0
    def get(self, user_name):
        curr_user = user_api.get_user_by_username(user_name)
        if not curr_user:
            return {"message": gettext("user_not_found")}, 404

        return {'user_id' : str(curr_user['_id'])}, 200
예제 #21
0
파일: user.py 프로젝트: eneskanra/taskapi
 def get(cls, username: str):
     user = UserModel.find_by_username(username)
     if not user:
         return {'message': gettext("user_not_found")}, 404
     return user_schema.dump(user), 200
예제 #22
0
 def send_sms(self) -> MessageInstance:
     text = gettext("user_sms_text_code").format(
         str(self.most_recent_confirmation.code))
     return Twilio.send_sms(number="+351" + self.phone, body=text)
예제 #23
0
파일: user.py 프로젝트: eneskanra/taskapi
 def delete(cls, username: str):
     user = UserModel.find_by_username(username)
     if not user:
         return {'message': gettext("user_not_found")}, 404
     user.delete_from_db()
     return {'message': gettext("user_deleted")}, 200
예제 #24
0
 def get(cls, name: str):
     store = StoreModel.find_by_name(name)
     if store:
         return store_schema.dump(store), 200
     return {"message": gettext("store_not_found")}, 404
예제 #25
0
 def is_amount_above_zero(self, value):
     if value <= 0:
         raise ValidationError(gettext("trade_amount_above_zero"))
 def delete(cls, name: str):
     item = ItemModel.find_by_name(name)
     if item:
         item.delete_from_db()
         return {'message': gettext('item_deleted')}, 200
     return {'message': gettext('item_not_found')}, 404
예제 #27
0
 def post(cls):
     jti = get_raw_jwt()["jti"]
     user_id = get_jwt_identity()
     BLACKLIST.add(jti)
     return {"message": gettext("user_logged_out").format(user_id)}, 200