class UserListApi(ResourceList): def after_get(self, result): for item in result['data']: del item['attributes']['password'] return result decorators = (api.has_permission(access_level='admin'),) schema = UserSchema data_layer = {'session': db.session, 'model': User, 'methods': {'after_get': after_get}}
class PersonListApi(ResourceList): decorators = (api.has_permission(access_level='user'),) schema = PersonSchema data_layer = {'session': db.session, 'model': Person}
class PersonDetailApi(ResourceDetail): decorators = (api.has_permission(access_level='user'),) schema = PersonSchema
class UserDetailApi(ResourceDetail): decorators = (api.has_permission(access_level='admin'),) schema = UserSchema data_layer = {'session': db.session, 'model': User}
class SwipeDetailApi(ResourceDetail): decorators = (api.has_permission(access_level='user'), ) schema = SwipeSchema