interfaces.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. import { Store } from 'pinia'
  2. import {AnyJson} from "~/types/enum/data";
  3. import {
  4. ABILITIES,
  5. GENDER,
  6. TYPE_ALERT,
  7. } from '~/types/enum/enums'
  8. import {type ComputedRef, Ref} from "@vue/reactivity";
  9. import type {MenuGroup, MenuItem} from "~/types/layout";
  10. declare module '@vuex-orm/core' {
  11. interface Query {
  12. getAllRelations: () => Array<string>
  13. }
  14. }
  15. interface AbilitiesType {
  16. action: ABILITIES
  17. subject: string
  18. /** an array of fields to which user has (or not) access */
  19. fields?: string[]
  20. /** an object of conditions which restricts the rule scope */
  21. conditions?: any
  22. /** indicates whether rule allows or forbids something */
  23. inverted?: boolean
  24. /** message which explains why rule is forbidden */
  25. reason?: string
  26. }
  27. interface Alert {
  28. type: TYPE_ALERT
  29. messages: Array<string>
  30. }
  31. type AnyStore = Store<any>
  32. interface EnumChoice {
  33. value: string
  34. label: string
  35. }
  36. interface Filter {
  37. readonly key: string
  38. readonly value: string | boolean | number
  39. }
  40. type EnumChoices = Array<EnumChoice>
  41. interface HookProvider {
  42. invoke(args: DataProviderArgs): Promise<any>
  43. }
  44. interface HookPersister {
  45. invoke(args: DataPersisterArgs): Promise<any>
  46. }
  47. interface HookDeleter {
  48. invoke(args: DataDeleterArgs): Promise<any>
  49. }
  50. interface Processor {
  51. process(data: AnyJson): Promise<any>
  52. }
  53. interface Encoder {
  54. encode(data: AnyJson): string
  55. decode(input: string): AnyJson
  56. }
  57. interface Historical {
  58. future: boolean
  59. past: boolean
  60. present: boolean
  61. dateStart?: string | null
  62. dateEnd?: string | null
  63. }
  64. interface BaseAccessProfile {
  65. id: number | null
  66. name: string | null
  67. givenName: string | null
  68. gender: GENDER | null
  69. avatarId: number | null
  70. }
  71. interface BaseOrganizationProfile {
  72. id: number | null
  73. name: string | null
  74. website?: string | null
  75. }
  76. interface OrignalAccessProfile extends BaseAccessProfile {
  77. isSuperAdminAccess: boolean
  78. organization: BaseOrganizationProfile
  79. }
  80. interface AccessProfile extends BaseAccessProfile {
  81. bearer: string | null
  82. switchId: number | null
  83. activityYear: number | null
  84. historical: Historical
  85. roles: Array<string>
  86. abilities: Array<AbilitiesType>
  87. isAdminAccess: boolean | null
  88. isSuperAdminAccess: boolean | null
  89. isAdmin: boolean | null
  90. isAdministratifManager: boolean | null
  91. isPedagogicManager: boolean | null
  92. isFinancialManager: boolean | null
  93. isCaMember: boolean | null
  94. isStudent: boolean | null
  95. isTeacher: boolean | null
  96. isMember: boolean | null
  97. isOther: boolean | null
  98. isGuardian: boolean | null
  99. isPayer: boolean | null
  100. multiAccesses: Array<BaseOrganizationProfile>
  101. familyAccesses: Array<BaseAccessProfile>
  102. originalAccess: OrignalAccessProfile | null
  103. hasRole: (role: string) => boolean
  104. isAdminAccount: boolean
  105. }
  106. // TODO: y'a un problème entre l'interface AccessProfile et celle organizationState, les noms sont construits différemment,
  107. // il faut tout remettre sur le même modèle
  108. interface organizationState extends BaseOrganizationProfile {
  109. id: number | null
  110. parametersId: number | null
  111. name: string | null
  112. product?: string | null
  113. currentActivityYear?: number | null
  114. modules?: Array<string>
  115. hasChildren?: boolean | null
  116. isSchool: boolean
  117. showAdherentList?: boolean | null
  118. legalStatus?: string | null
  119. networks: Array<string>
  120. parents: Array<BaseOrganizationProfile>
  121. hasModule(module: string): boolean
  122. }
  123. interface DolibarrContractLine {
  124. id: number
  125. contractId: number
  126. dateStart: Date
  127. dateEnd: Date
  128. serviceRef: string
  129. serviceLabel: string
  130. }
  131. interface DolibarrContract {
  132. ref: string
  133. socId: number
  134. lines: Array<DolibarrContractLine>
  135. }
  136. interface DolibarrBill {
  137. id: number
  138. ref: string
  139. socId: number
  140. date: Date
  141. taxExcludedAmount: number
  142. taxIncludedAmount: number
  143. paid: boolean
  144. }
  145. interface DolibarrAccount {
  146. organizationId: number
  147. socId: number
  148. clientNumber: string
  149. product:
  150. | 'PRODUCT_ARTIST'
  151. | 'PRODUCT_ARTIST_PREMIUM'
  152. | 'PRODUCT_SCHOOL'
  153. | 'PRODUCT_SCHOOL_PREMIUM'
  154. | 'PRODUCT_MANAGER'
  155. contract: DolibarrContract
  156. bills: Array<DolibarrBill>
  157. }
  158. interface MobytUserStatus {
  159. organizationId: number
  160. active: boolean
  161. amount: number
  162. money: number
  163. }
  164. interface MercureEntityUpdate {
  165. iri: string
  166. operation: 'create' | 'delete' | 'update'
  167. data: any
  168. }
  169. interface SseState {
  170. connected: boolean
  171. events: Array<MercureEntityUpdate>
  172. }
  173. interface LayoutState {
  174. menus: Record<string, MenuGroup | MenuItem>
  175. menusOpened: Record<string, boolean>
  176. }