types.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {
  2. Store
  3. } from "vuex";
  4. import {Ability} from "@casl/ability";
  5. import {Rest} from "~/services/queries/rest";
  6. /**
  7. * Upgrade du @nuxt/types pour TypeScript
  8. */
  9. declare module '@nuxt/types' {
  10. interface Context {
  11. $ability(): Ability,
  12. $rest: Rest
  13. }
  14. }
  15. interface ItemMenu {
  16. title: string,
  17. icon?: string,
  18. to?: string,
  19. children?: ItemsMenu,
  20. isExternalLink?: boolean,
  21. }
  22. interface ItemsMenu extends Array<ItemMenu> {}
  23. interface AbilitiesType {
  24. action: 'display' | 'read' | 'manage',
  25. subject: string,
  26. /** an array of fields to which user has (or not) access */
  27. fields?: string[]
  28. /** an object of conditions which restricts the rule scope */
  29. conditions?: any
  30. /** indicates whether rule allows or forbids something */
  31. inverted?: boolean
  32. /** message which explains why rule is forbidden */
  33. reason?: string
  34. }
  35. interface accessState {
  36. bearer: string,
  37. accessId: number,
  38. name: string,
  39. givenName: string,
  40. roles: Array<string>,
  41. abilities: Array<AbilitiesType>,
  42. isAdminAccess: boolean,
  43. isAdmin: boolean,
  44. isAdministratifManager: boolean,
  45. isPedagogicManager: boolean,
  46. isFinancialManager: boolean,
  47. isCaMember: boolean,
  48. isStudent: boolean,
  49. isTeacher: boolean,
  50. isMember: boolean,
  51. isOther: boolean,
  52. hasLateralMenu: boolean,
  53. hasConfigurationMenu: boolean,
  54. hasAccessesMenu: boolean,
  55. hasFamilyMenu: boolean
  56. }
  57. interface AccessStore extends Store<{profile:{access:accessState}}> {}
  58. interface organizationState {
  59. id: number,
  60. name: string,
  61. product?: string,
  62. modules?: Array<string>,
  63. hasChildren?: boolean,
  64. networks: Array<string>,
  65. website?: string,
  66. subDomain?: string,
  67. parents: Array<organizationState>,
  68. }
  69. interface OrganizationStore extends Store<{profile:{organization:organizationState}}> {}
  70. interface AnyJson extends Record<string, any> {}
  71. interface AnyStore extends Store<any> {}
  72. interface EnumChoice {
  73. value: string,
  74. label: string
  75. }
  76. interface EnumChoices extends Array<EnumChoice> {}
  77. import {Query, Repository} from "@vuex-orm/core";
  78. export type RepositoryOrQuery<R extends Repository = Repository, Q extends Query = Query> = R | Q;