def get(self): return {'stores': [x.json() for x in StoreModel.find_all()]}
def get(self): # The find_all() method returns a list of all items in the DB as objects, # but we cannot return objects, we need to convert them into JSON # So we use a list comprehension to convert each object into JSON return {'stores': [store.json for store in StoreModel.find_all()]}
def delete(self): for store in StoreModel.find_all(): store.delete_from_db() return {'message': 'Stores deleted'}
def get(self): #return {'stores':[store.json() for store in StoreModel.query.all()]} return {'stores': [x.json() for x in StoreModel.find_all()]}
def get(self): return {"stores": [x.json() for x in StoreModel.find_all()]}
def get(cls): return {'stores': [x.json() for x in StoreModel.find_all()]}
def get(self): stores = StoreModel.find_all() return ({'stores': [k.json() for k in stores]})
def get(cls): return {'stores': [store.json() for store in StoreModel.find_all()]}
def get(self): """ Get method for the list of stores. :return: """ return {'stores': [store.json() for store in StoreModel.find_all()]}
def get(self): """ Returns the list of stores --- tags: - Stores definitions: Store: type: object properties: id: type: integer description: Identifier of the store default: 1 name: type: string description: Name of the Store default: New Store items: type: array items: $ref: '#/definitions/Item' Item: type: object properties: id: type: integer description: Identifier of the Item name: type: string description: Name of the item store_id: type: integer responses: 200: description: The list of stores data schema: id: Stores type: object properties: stores: type: array items: $ref: '#/definitions/Store' examples: stores: [{'id': 1, 'name': 'New Store', 'items': []},] """ # Access the identity of the current user identity (username) with get_jwt_identity current_user = get_jwt_identity() stores = [store.json() for store in StoreModel.find_all()] if current_user: return {'stores': stores} return { 'stores': list(map(lambda x: x['name'], stores)), 'message': 'More data available if logged in' }
def get(self): return {'stores': store_list_schema.dump(StoreModel.find_all())}, 200
def get(self): # return {'items': list(map(lambda x: x.to_json(), ItemModel.query.all()))} return {'stores': [store.to_json() for store in StoreModel.find_all()]}
def get(cls): return {'stores': storeListSchema.dump(StoreModel.find_all())}
def get(self): # user_id = get_jwt_identity() # stores = [store.json() for store in StoreModel.find_all()] # if user_id: # return {'stores': stores} return {'stores': store_list_schema.dump(StoreModel.find_all())}
def get(self): """ GET list store """ return {'stores': [store.json() for store in StoreModel.find_all()]}
def get(self): # get method return {"stores": [item.json() for item in StoreModel.find_all()]}
def get(self): # return {'stores': list(map(lambda x: x.json(), StoreModel.query.all()))} # return {'stores': [x.json for x in StoreModel.query.all()]} return {'stores': [x.json for x in StoreModel.find_all()]}
def get(cls): return { 'stores': [store.json() for store in StoreModel.find_all()] }, 200
def get(self): return { "stores": [store.json() for store in StoreModel.find_all()] }, 200
def get(self): stores = [store.json() for store in StoreModel.find_all()] return {'items': stores}
def get(cls): return {"stores": [store.json() for store in StoreModel.find_all()]}
def get(self): return {'stores': [store.json() for store in StoreModel.find_all()]} #return {'stores': list(map(lambda x: x.json(), StoreModel.query.all()))}
def get(self): return {'stores': list(map(lambda x: x.json(), StoreModel.find_all()))}
def get(self): return store_list_schema.dump(StoreModel.find_all()), 200
def get(cls): return {"stores": store_list_schema.dump(StoreModel.find_all())}, 200
def get(self): #return {"stores": [store.json() for store in StoreModel.query.all()]} return {"stores": [store.json() for store in StoreModel.find_all()]}
def get(self): return {'stores': [store.json() for store in StoreModel.find_all()]}
def get(self): return {'stores': [item.json() for item in StoreModel.find_all()]}