def post(self): data = UserRegistration.parse.parse_args() user = AuthModel.find_by_username(data['username']) if user: return { "AlreadyExistError": { "error": "Username already exist" } }, 400 user = AuthModel(**data) user.save_to_db() return { "message": "User Created Successfully", "User": user.json() }, 201
def post(self): data = Registration.parse.parse_args() user = AuthModel.find_by_role_and_city("Vendor", data['city']) if user: return { "AlreadyExistError": { "error": "Vendor from this city already exist" } }, 400 user = AuthModel(**data) user.save_to_db() return { "message": "Vendor Created Successfully", "User": user.json() }, 201