Last active
August 7, 2021 13:33
-
-
Save MariusBongarts/d1122587a5ed97956fafed028d96b61e to your computer and use it in GitHub Desktop.
DRY - FeedbackService updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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