Created
November 17, 2019 09:09
-
-
Save koskimas/17d9efad5de5f474e34ec1cf9722c4b0 to your computer and use it in GitHub Desktop.
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 Person extends Model { | |
| static async beforeDelete({ | |
| asFindQuery, | |
| cancelQuery | |
| }: StaticHookArguments<Person>): Promise<any> { | |
| const idsOfPersonsAboutToBeDeleted = await asFindQuery().select('id') | |
| if (!(await shouldDelete(idsOfPersonsAboutToBeDeleted))) { | |
| cancelQuery() | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment