Skip to content

Instantly share code, notes, and snippets.

@MariusBongarts
Last active August 7, 2021 13:33
Show Gist options
  • Save MariusBongarts/d1122587a5ed97956fafed028d96b61e to your computer and use it in GitHub Desktop.
Save MariusBongarts/d1122587a5ed97956fafed028d96b61e to your computer and use it in GitHub Desktop.
DRY - FeedbackService updated
class FeedbackService extends CRUDService<Feedback> {
constructor() {
super('feedback');
}
async create(options: CrudOperationOptions<Feedback>) {
if (userIsPermitted(options.user)) {
return super.create(options);
}
return undefined;
}
async read(options: CrudOperationOptions<Feedback>) {
return super.read(options);
}
async update(options: CrudOperationOptions<Feedback>) {
if (userIsPermitted(options.user)) {
return super.update(options);
}
return undefined;
}
async delete(options: CrudOperationOptions<Feedback>) {
if (userIsPermitted(options.user)) {
return super.delete(options);
}
return undefined;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment