interfaces.d.ts 5.3 KB

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