We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/services/schemas
/services/response
export const success = (res, status) => (entity) => { if (entity) { res.status(status || 200).json(entity) } return null } export const notFound = (res) => (entity) => { if (entity) { return entity } res.status(404).end() return null } export const authorOrAdmin = (res, user, userField) => (entity) => { if (entity) { const isAdmin = user.role === 'admin' const isAuthor = entity[userField] && entity[userField].equals(user.id) if (isAuthor || isAdmin) { return entity } res.status(401).end() } return null }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
/services/schemas
to store./services/response
) that can be used to standardize this responses and make it available on each route:The text was updated successfully, but these errors were encountered: