def add_post_to_favorites(ctx: rest.Context, params: Dict[str, str]) -> rest.Response: auth.verify_privilege(ctx.user, 'posts:favorite') post = _get_post(params) favorites.set_favorite(post, ctx.user) ctx.session.commit() return _serialize_post(ctx, post)
def add_post_to_favorites( ctx: rest.Context, params: Dict[str, str]) -> rest.Response: auth.verify_privilege(ctx.user, 'posts:favorite') post = _get_post(params) favorites.set_favorite(post, ctx.user) ctx.session.commit() return _serialize_post(ctx, post)
def add_post_to_favorites(ctx, params): auth.verify_privilege(ctx.user, 'posts:favorite') post = posts.get_post_by_id(params['post_id']) favorites.set_favorite(post, ctx.user) ctx.session.commit() return _serialize_post(ctx, post)
def post(self, ctx, post_id): auth.verify_privilege(ctx.user, 'posts:favorite') post = posts.get_post_by_id(post_id) favorites.set_favorite(post, ctx.user) ctx.session.commit() return posts.serialize_post_with_details(post, ctx.user)