interfaces.d.ts 4.4 KB

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