interfaces.d.ts 4.4 KB

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