interfaces.d.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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 {Ref} from "@vue/reactivity";
  9. import {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 | Array<string>
  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. }
  104. // TODO: y'a un problème entre l'interface AccessProfile et celle organizationState, les noms sont construits différemment,
  105. // il faut tout remettre sur le même modèle
  106. interface organizationState extends BaseOrganizationProfile {
  107. id: number | null
  108. parametersId: number | null
  109. name: string | null
  110. product?: string | null
  111. currentActivityYear?: number | null
  112. modules?: Array<string>
  113. hasChildren?: boolean | null
  114. isSchool: boolean
  115. showAdherentList?: boolean | null
  116. legalStatus?: string | null
  117. networks: Array<string>
  118. parents: Array<BaseOrganizationProfile>
  119. hasModule(module: string): boolean
  120. }
  121. interface DolibarrContractLine {
  122. id: number
  123. contractId: number
  124. dateStart: Date
  125. dateEnd: Date
  126. serviceRef: string
  127. serviceLabel: string
  128. }
  129. interface DolibarrContract {
  130. ref: string
  131. socId: number
  132. lines: Array<DolibarrContractLine>
  133. }
  134. interface DolibarrBill {
  135. id: number
  136. ref: string
  137. socId: number
  138. date: Date
  139. taxExcludedAmount: number
  140. taxIncludedAmount: number
  141. paid: boolean
  142. }
  143. interface DolibarrAccount {
  144. organizationId: number
  145. socId: number
  146. clientNumber: string
  147. product:
  148. | 'PRODUCT_ARTIST'
  149. | 'PRODUCT_ARTIST_PREMIUM'
  150. | 'PRODUCT_SCHOOL'
  151. | 'PRODUCT_SCHOOL_PREMIUM'
  152. | 'PRODUCT_MANAGER'
  153. contract: DolibarrContract
  154. bills: Array<DolibarrBill>
  155. }
  156. interface MobytUserStatus {
  157. organizationId: number
  158. active: boolean
  159. amount: number
  160. money: number
  161. }
  162. interface MercureEntityUpdate {
  163. iri: string
  164. operation: 'create' | 'delete' | 'update'
  165. data: any
  166. }
  167. interface SseState {
  168. connected: boolean
  169. events: Array<MercureEntityUpdate>
  170. }
  171. interface LayoutState {
  172. menus: Record<string, MenuGroup | MenuItem>
  173. menusOpened: Record<string, boolean>
  174. }