interfaces.d.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. showAdherentList?: boolean | null
  115. legalStatus?: string | null
  116. networks: Array<string>
  117. parents: Array<BaseOrganizationProfile>
  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. }