interfaces.d.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 { MenuGroup, MenuItem } from '~/types/layout'
  5. declare module '@vuex-orm/core' {
  6. interface Query {
  7. getAllRelations: () => Array<string>
  8. }
  9. }
  10. interface AbilitiesType {
  11. action: ABILITIES
  12. subject: string
  13. /** an array of fields to which user has (or not) access */
  14. fields?: string[]
  15. /** an object of conditions which restricts the rule scope */
  16. conditions?: unknown
  17. /** indicates whether rule allows or forbids something */
  18. inverted?: boolean
  19. /** message which explains why rule is forbidden */
  20. reason?: string
  21. }
  22. interface Alert {
  23. type: TYPE_ALERT
  24. messages: Array<string>
  25. }
  26. type AnyStore = Store<unknown>
  27. interface EnumChoice {
  28. value: string
  29. label: string
  30. }
  31. interface Filter {
  32. readonly key: string
  33. readonly value: string | boolean | number
  34. }
  35. type EnumChoices = Array<EnumChoice>
  36. interface HookProvider {
  37. invoke(args: DataProviderArgs): Promise<unknown>
  38. }
  39. interface HookPersister {
  40. invoke(args: DataPersisterArgs): Promise<unknown>
  41. }
  42. interface HookDeleter {
  43. invoke(args: DataDeleterArgs): Promise<unknown>
  44. }
  45. interface Processor {
  46. process(data: AnyJson): Promise<unknown>
  47. }
  48. interface Encoder {
  49. encode(data: AnyJson): string
  50. decode(input: string): AnyJson
  51. }
  52. interface Historical {
  53. future: boolean
  54. past: boolean
  55. present: boolean
  56. dateStart?: string | null
  57. dateEnd?: string | null
  58. }
  59. interface BaseAccessProfile {
  60. id: number | null
  61. name: string | null
  62. givenName: string | null
  63. gender: GENDER | null
  64. avatarId: number | null
  65. }
  66. interface BaseOrganizationProfile {
  67. id: number | null
  68. name: string | null
  69. website?: string | null
  70. }
  71. interface OrignalAccessProfile extends BaseAccessProfile {
  72. isSuperAdminAccess: boolean
  73. organization: BaseOrganizationProfile
  74. }
  75. interface AccessProfile extends BaseAccessProfile {
  76. bearer: string | null
  77. switchId: number | null
  78. activityYear: number | null
  79. historical: Historical
  80. roles: Array<string>
  81. abilities: Array<AbilitiesType>
  82. isAdminAccess: boolean | null
  83. isSuperAdminAccess: boolean | null
  84. isAdmin: boolean | null
  85. isAdministratifManager: boolean | null
  86. isPedagogicManager: boolean | null
  87. isFinancialManager: boolean | null
  88. isCaMember: boolean | null
  89. isStudent: boolean | null
  90. isTeacher: boolean | null
  91. isMember: boolean | null
  92. isOther: boolean | null
  93. isGuardian: boolean | null
  94. isPayer: boolean | null
  95. multiAccesses: Array<BaseOrganizationProfile>
  96. familyAccesses: Array<BaseAccessProfile>
  97. originalAccess: OrignalAccessProfile | null
  98. hasRole: (role: string) => boolean
  99. isAdminAccount: boolean
  100. preferencesId: number | null
  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. principalType?: string | null
  116. networks: Array<string>
  117. parents: Array<BaseOrganizationProfile>
  118. isTrialActive: boolean
  119. trialCountDown: number
  120. productBeforeTrial?: string | null
  121. hasModule(module: string): boolean
  122. }
  123. interface DolibarrContractLine {
  124. id: number
  125. contractId: number
  126. dateStart: Date
  127. dateEnd: Date
  128. serviceRef: string
  129. serviceLabel: string
  130. }
  131. interface DolibarrContract {
  132. ref: string
  133. socId: number
  134. lines: Array<DolibarrContractLine>
  135. }
  136. interface DolibarrBill {
  137. id: number
  138. ref: string
  139. socId: number
  140. date: Date
  141. taxExcludedAmount: number
  142. taxIncludedAmount: number
  143. paid: boolean
  144. }
  145. interface DolibarrAccount {
  146. organizationId: number
  147. socId: number
  148. clientNumber: string
  149. product:
  150. | 'PRODUCT_ARTIST'
  151. | 'PRODUCT_ARTIST_PREMIUM'
  152. | 'PRODUCT_SCHOOL'
  153. | 'PRODUCT_SCHOOL_PREMIUM'
  154. | 'PRODUCT_MANAGER'
  155. contract: DolibarrContract
  156. bills: Array<DolibarrBill>
  157. }
  158. interface MobytUserStatus {
  159. organizationId: number
  160. active: boolean
  161. amount: number
  162. money: number
  163. }
  164. interface MercureEntityUpdate {
  165. iri: string
  166. operation: 'create' | 'delete' | 'update'
  167. data: unknown
  168. }
  169. interface SseState {
  170. connected: boolean
  171. events: Array<MercureEntityUpdate>
  172. }
  173. interface LayoutState {
  174. menus: Record<string, MenuGroup | MenuItem>
  175. menusOpened: Record<string, boolean>
  176. }
  177. interface ColumnDefinition {
  178. /**
  179. * The entity's property to display in this column
  180. */
  181. property: string
  182. /**
  183. * Label of the column.
  184. * If not provided, a translation of the property's name will be looked for.
  185. * If none is found, the property's name will be displayed as it is.
  186. */
  187. label?: string
  188. }
  189. interface AssertRule {
  190. supports(key: string): boolean
  191. createRule(criteria: unknown): (value: unknown) => true | string
  192. }