interfaces.d.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. import { Ability } from '@casl/ability'
  2. import { Store } from 'pinia'
  3. import DataPersister from '~/services/data/dataPersister'
  4. import DataProvider from '~/services/data/dataProvider'
  5. import DataDeleter from '~/services/data/dataDeleter'
  6. import {
  7. ABILITIES,
  8. FORM_FUNCTION,
  9. GENDER,
  10. TYPE_ALERT,
  11. } from '~/types/enum/enums'
  12. import ApiResource from "~/models/ApiResource";
  13. import {AnyJson} from "~/types/enum/data";
  14. import {Record} from "immutable";
  15. /**
  16. * Upgrade du @nuxt/types pour TypeScript
  17. */
  18. declare module '@nuxt/types' {
  19. interface Context {
  20. $ability: Ability
  21. $dataPersister: DataPersister
  22. $dataProvider: DataProvider
  23. $dataDeleter: DataDeleter
  24. }
  25. }
  26. declare module '@vuex-orm/core' {
  27. interface Query {
  28. getAllRelations: () => Array<string>
  29. }
  30. }
  31. interface AbilitiesType {
  32. action: ABILITIES
  33. subject: string
  34. /** an array of fields to which user has (or not) access */
  35. fields?: string[]
  36. /** an object of conditions which restricts the rule scope */
  37. conditions?: any
  38. /** indicates whether rule allows or forbids something */
  39. inverted?: boolean
  40. /** message which explains why rule is forbidden */
  41. reason?: string
  42. }
  43. interface formState {
  44. violations: AnyJson
  45. readonly: boolean
  46. formFunction: FORM_FUNCTION
  47. dirty: boolean
  48. showConfirmToLeave: boolean
  49. goAfterLeave: string | null
  50. }
  51. interface Alert {
  52. type: TYPE_ALERT
  53. messages: Array<string>
  54. }
  55. interface pageState {
  56. alerts: Array<Alert>,
  57. menusOpened: Record<string, boolean>
  58. }
  59. interface ormState {
  60. initialValues: Map<string, Map<number, ApiResource>>
  61. }
  62. interface Historical {
  63. future?: boolean
  64. past?: boolean
  65. present?: boolean
  66. dateStart?: string
  67. dateEnd?: string
  68. }
  69. interface baseAccessState {
  70. id: number | null
  71. name: string | null
  72. givenName: string | null
  73. gender: GENDER | null
  74. avatarId: number | null
  75. }
  76. interface baseOrganizationState {
  77. id: number | null
  78. name: string | null
  79. website?: string | null
  80. }
  81. interface OrignalAccessState extends baseAccessState {
  82. isSuperAdminAccess: boolean
  83. organization: baseOrganizationState
  84. }
  85. interface accessState extends baseAccessState {
  86. bearer: string | null
  87. switchId: number | null
  88. activityYear: number | null
  89. historical: Historical | Array<string>
  90. roles: Array<string>
  91. abilities: Array<AbilitiesType>
  92. isAdminAccess: boolean | null
  93. isSuperAdminAccess: boolean | null
  94. isAdmin: boolean | null
  95. isAdministratifManager: boolean | null
  96. isPedagogicManager: boolean | null
  97. isFinancialManager: boolean | null
  98. isCaMember: boolean | null
  99. isStudent: boolean | null
  100. isTeacher: boolean | null
  101. isMember: boolean | null
  102. isOther: boolean | null
  103. isGuardian: boolean | null
  104. isPayer: boolean | null
  105. multiAccesses: Array<baseOrganizationState>
  106. familyAccesses: Array<baseAccessState>
  107. originalAccess: OrignalAccessState | null
  108. }
  109. interface organizationState extends baseOrganizationState {
  110. id: number | null
  111. parametersId: number | null
  112. name: string | null
  113. product?: string | null
  114. currentActivityYear?: number | null
  115. modules?: Array<string>
  116. hasChildren?: boolean | null
  117. showAdherentList?: boolean | null
  118. legalStatus?: string | null
  119. networks: Array<string>
  120. parents: Array<baseOrganizationState>
  121. }
  122. type AnyStore = Store<any>
  123. interface EnumChoice {
  124. value: string
  125. label: string
  126. }
  127. interface Filter {
  128. readonly key: string
  129. readonly value: string | boolean | number
  130. }
  131. type EnumChoices = Array<EnumChoice>
  132. interface HookProvider {
  133. invoke(args: DataProviderArgs): Promise<any>
  134. }
  135. interface HookPersister {
  136. invoke(args: DataPersisterArgs): Promise<any>
  137. }
  138. interface HookDeleter {
  139. invoke(args: DataDeleterArgs): Promise<any>
  140. }
  141. interface Processor {
  142. process(data: AnyJson): Promise<any>
  143. }
  144. interface Normalizer {
  145. normalize(args: DataPersisterArgs): any
  146. }
  147. interface Denormalizer {
  148. denormalize(data: any): any
  149. }
  150. interface DolibarrContractLine {
  151. id: number
  152. contractId: number
  153. dateStart: Date
  154. dateEnd: Date
  155. serviceRef: string
  156. serviceLabel: string
  157. }
  158. interface DolibarrContract {
  159. ref: string
  160. socId: number
  161. lines: Array<DolibarrContractLine>
  162. }
  163. interface DolibarrBill {
  164. id: number
  165. ref: string
  166. socId: number
  167. date: Date
  168. taxExcludedAmount: number
  169. taxIncludedAmount: number
  170. paid: boolean
  171. }
  172. interface DolibarrAccount {
  173. organizationId: number
  174. socId: number
  175. clientNumber: string
  176. product:
  177. | 'PRODUCT_ARTIST'
  178. | 'PRODUCT_ARTIST_PREMIUM'
  179. | 'PRODUCT_SCHOOL'
  180. | 'PRODUCT_SCHOOL_PREMIUM'
  181. | 'PRODUCT_MANAGER'
  182. contract: DolibarrContract
  183. bills: Array<DolibarrBill>
  184. }
  185. interface MobytUserStatus {
  186. organizationId: number
  187. active: boolean
  188. amount: number
  189. money: number
  190. }
  191. interface MercureEntityUpdate {
  192. iri: string
  193. operation: 'create' | 'delete' | 'update'
  194. data: any
  195. }
  196. interface sseState {
  197. connected: boolean
  198. events: Array<MercureEntityUpdate>
  199. }