def post(self,name): store = StoreModel.find_store_name(name) if store: return {"message":"Store Already exists"},400 store = StoreModel(name) try: store.save_to_db() except: return {"message":"error occured while saving"},500 return store.json(),201
def get(self,name): store = StoreModel.find_store_name(name) if store: return store.json() return {"message":"store not found"},404
def delete(self,name): store = StoreModel.find_store_name(name) if store: store.delete_from_db() return({'message':'store has been deleted'})