interfaces.d.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. active?: boolean
  49. }
  50. type ItemsMenu = Array<ItemMenu>
  51. interface Menu {
  52. getMenu: () => ItemMenu | null
  53. getHeaderMenu: () => ItemMenu | null
  54. }
  55. interface AbilitiesType {
  56. action: ABILITIES
  57. subject: string
  58. /** an array of fields to which user has (or not) access */
  59. fields?: string[]
  60. /** an object of conditions which restricts the rule scope */
  61. conditions?: any
  62. /** indicates whether rule allows or forbids something */
  63. inverted?: boolean
  64. /** message which explains why rule is forbidden */
  65. reason?: string
  66. }
  67. interface formState {
  68. violations: AnyJson
  69. readonly: boolean
  70. formFunction: FORM_FUNCTION
  71. dirty: boolean
  72. showConfirmToLeave: boolean
  73. goAfterLeave: string | null
  74. }
  75. interface Alert {
  76. type: TYPE_ALERT
  77. messages: Array<string>
  78. }
  79. interface pageState {
  80. alerts: Array<Alert>
  81. }
  82. interface ormState {
  83. initialValues: Map<string, Map<number, ApiResource>>
  84. }
  85. interface Historical {
  86. future?: boolean
  87. past?: boolean
  88. present?: boolean
  89. dateStart?: string
  90. dateEnd?: string
  91. }
  92. interface baseAccessState {
  93. id: number | null
  94. name: string | null
  95. givenName: string | null
  96. gender: GENDER | null
  97. avatarId: number | null
  98. }
  99. interface baseOrganizationState {
  100. id: number | null
  101. name: string | null
  102. website?: string | null
  103. }
  104. interface OrignalAccessState extends baseAccessState {
  105. isSuperAdminAccess: boolean
  106. organization: baseOrganizationState
  107. }
  108. interface accessState extends baseAccessState {
  109. bearer: string | null
  110. switchId: number | null
  111. activityYear: number | null
  112. historical: Historical | Array<string>
  113. roles: Array<string>
  114. abilities: Array<AbilitiesType>
  115. isAdminAccess: boolean | null
  116. isSuperAdminAccess: boolean | null
  117. isAdmin: boolean | null
  118. isAdministratifManager: boolean | null
  119. isPedagogicManager: boolean | null
  120. isFinancialManager: boolean | null
  121. isCaMember: boolean | null
  122. isStudent: boolean | null
  123. isTeacher: boolean | null
  124. isMember: boolean | null
  125. isOther: boolean | null
  126. isGuardian: boolean | null
  127. isPayor: boolean | null
  128. hasLateralMenu: boolean | null
  129. hasConfigurationMenu: boolean | null
  130. hasAccessesMenu: boolean | null
  131. hasFamilyMenu: boolean | null
  132. multiAccesses: Array<baseOrganizationState>
  133. familyAccesses: Array<baseAccessState>
  134. originalAccess: OrignalAccessState | null
  135. }
  136. interface organizationState extends baseOrganizationState {
  137. id: number | null
  138. parametersId: number | null
  139. name: string | null
  140. product?: string | null
  141. currentActivityYear?: number | null
  142. modules?: Array<string>
  143. hasChildren?: boolean | null
  144. showAdherentList?: boolean | null
  145. legalStatus?: string | null
  146. networks: Array<string>
  147. parents: Array<baseOrganizationState>
  148. }
  149. type AnyStore = Store<any>
  150. interface EnumChoice {
  151. value: string
  152. label: string
  153. }
  154. interface Filter {
  155. readonly key: string
  156. readonly value: string | boolean | number
  157. }
  158. type EnumChoices = Array<EnumChoice>
  159. interface HookProvider {
  160. invoke(args: DataProviderArgs): Promise<any>
  161. }
  162. interface HookPersister {
  163. invoke(args: DataPersisterArgs): Promise<any>
  164. }
  165. interface HookDeleter {
  166. invoke(args: DataDeleterArgs): Promise<any>
  167. }
  168. interface Processor {
  169. process(data: AnyJson): Promise<any>
  170. }
  171. interface Normalizer {
  172. normalize(args: DataPersisterArgs): any
  173. }
  174. interface Denormalizer {
  175. denormalize(data: any): any
  176. }
  177. interface DolibarrContractLine {
  178. id: number
  179. contractId: number
  180. dateStart: Date
  181. dateEnd: Date
  182. serviceRef: string
  183. serviceLabel: string
  184. }
  185. interface DolibarrContract {
  186. ref: string
  187. socId: number
  188. lines: Array<DolibarrContractLine>
  189. }
  190. interface DolibarrBill {
  191. id: number
  192. ref: string
  193. socId: number
  194. date: Date
  195. taxExcludedAmount: number
  196. taxIncludedAmount: number
  197. paid: boolean
  198. }
  199. interface DolibarrAccount {
  200. organizationId: number
  201. socId: number
  202. clientNumber: string
  203. product:
  204. | 'PRODUCT_ARTIST'
  205. | 'PRODUCT_ARTIST_PREMIUM'
  206. | 'PRODUCT_SCHOOL'
  207. | 'PRODUCT_SCHOOL_PREMIUM'
  208. | 'PRODUCT_MANAGER'
  209. contract: DolibarrContract
  210. bills: Array<DolibarrBill>
  211. }
  212. interface MobytUserStatus {
  213. organizationId: number
  214. active: boolean
  215. amount: number
  216. money: number
  217. }
  218. interface MercureEntityUpdate {
  219. iri: string
  220. operation: 'create' | 'delete' | 'update'
  221. data: any
  222. }
  223. interface sseState {
  224. connected: boolean
  225. events: Array<MercureEntityUpdate>
  226. }