|
| 1 | +import { AbilityTuple, ForcedSubject, subject } from "@casl/ability"; |
| 2 | + |
| 3 | +export namespace AWBStocksAcl { |
| 4 | +/** |
| 5 | + * Use for `usePaginate` query ability. For global ability, omit the object parameter. |
| 6 | + * @description List AWB stocks |
| 7 | + * @param { string } object.officeId officeId from officeId path parameter |
| 8 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `usePaginate` query |
| 9 | + */ |
| 10 | +export const canUsePaginate = ( |
| 11 | + object?: { officeId: string, } |
| 12 | +) => [ |
| 13 | + "Read", |
| 14 | + object ? subject("AWBStock", object) : "AWBStock" |
| 15 | +] as AbilityTuple<"Read", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 16 | + |
| 17 | +/** |
| 18 | + * Use for `useCreate` mutation ability. For global ability, omit the object parameter. |
| 19 | + * @description Create AWB stock |
| 20 | + * @param { string } object.officeId officeId from officeId path parameter |
| 21 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `useCreate` mutation |
| 22 | + */ |
| 23 | +export const canUseCreate = ( |
| 24 | + object?: { officeId: string, } |
| 25 | +) => [ |
| 26 | + "Create", |
| 27 | + object ? subject("AWBStock", object) : "AWBStock" |
| 28 | +] as AbilityTuple<"Create", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 29 | + |
| 30 | +/** |
| 31 | + * Use for `useFindById` query ability. For global ability, omit the object parameter. |
| 32 | + * @description Get AWB stock details |
| 33 | + * @param { string } object.officeId officeId from officeId path parameter |
| 34 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `useFindById` query |
| 35 | + */ |
| 36 | +export const canUseFindById = ( |
| 37 | + object?: { officeId: string, } |
| 38 | +) => [ |
| 39 | + "Read", |
| 40 | + object ? subject("AWBStock", object) : "AWBStock" |
| 41 | +] as AbilityTuple<"Read", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 42 | + |
| 43 | +/** |
| 44 | + * Use for `useUpdate` mutation ability. For global ability, omit the object parameter. |
| 45 | + * @description Update AWB stock |
| 46 | + * @param { string } object.officeId officeId from officeId path parameter |
| 47 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `useUpdate` mutation |
| 48 | + */ |
| 49 | +export const canUseUpdate = ( |
| 50 | + object?: { officeId: string, } |
| 51 | +) => [ |
| 52 | + "Update", |
| 53 | + object ? subject("AWBStock", object) : "AWBStock" |
| 54 | +] as AbilityTuple<"Update", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 55 | + |
| 56 | +/** |
| 57 | + * Use for `useArchive` mutation ability. For global ability, omit the object parameter. |
| 58 | + * @description Archive AWB stock |
| 59 | + * @param { string } object.officeId officeId from officeId path parameter |
| 60 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `useArchive` mutation |
| 61 | + */ |
| 62 | +export const canUseArchive = ( |
| 63 | + object?: { officeId: string, } |
| 64 | +) => [ |
| 65 | + "Update", |
| 66 | + object ? subject("AWBStock", object) : "AWBStock" |
| 67 | +] as AbilityTuple<"Update", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 68 | + |
| 69 | +/** |
| 70 | + * Use for `useUnarchive` mutation ability. For global ability, omit the object parameter. |
| 71 | + * @description Unarchive AWB stock |
| 72 | + * @param { string } object.officeId officeId from officeId path parameter |
| 73 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `useUnarchive` mutation |
| 74 | + */ |
| 75 | +export const canUseUnarchive = ( |
| 76 | + object?: { officeId: string, } |
| 77 | +) => [ |
| 78 | + "Update", |
| 79 | + object ? subject("AWBStock", object) : "AWBStock" |
| 80 | +] as AbilityTuple<"Update", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 81 | + |
| 82 | +/** |
| 83 | + * Use for `useGenerateNextNumber` mutation ability. For global ability, omit the object parameter. |
| 84 | + * @description Generate next AWB number |
| 85 | + * @param { string } object.officeId officeId from officeId path parameter |
| 86 | + * @returns { AbilityTuple } An ability tuple indicating the user's ability to use `useGenerateNextNumber` mutation |
| 87 | + */ |
| 88 | +export const canUseGenerateNextNumber = ( |
| 89 | + object?: { officeId: string, } |
| 90 | +) => [ |
| 91 | + "Update", |
| 92 | + object ? subject("AWBStock", object) : "AWBStock" |
| 93 | +] as AbilityTuple<"Update", "AWBStock" | ForcedSubject<"AWBStock"> & { officeId: string, }>; |
| 94 | + |
| 95 | +} |
0 commit comments