interfaces.d.ts 4.2 KB

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