interfaces.d.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import type { Store } from 'pinia'
  2. import type { AnyJson } from '~/types/enum/data'
  3. import type { 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. principalType?: string | null
  117. networks: Array<string>
  118. parents: Array<BaseOrganizationProfile>
  119. isTrialActive: boolean
  120. trialCountDown: number
  121. productBeforeTrial?: string | null
  122. hasModule(module: string): boolean
  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. }
  174. interface LayoutState {
  175. menus: Record<string, MenuGroup | MenuItem>
  176. menusOpened: Record<string, boolean>
  177. }
  178. interface ColumnDefinition {
  179. /**
  180. * The entity's property to display in this column
  181. */
  182. property: string
  183. /**
  184. * Label of the column.
  185. * If not provided, a translation of the property's name will be looked for.
  186. * If none is found, the property's name will be displayed as it is.
  187. */
  188. label?: string
  189. }