瀏覽代碼

fix TS errors (ongoing)

Olivier Massot 4 月之前
父節點
當前提交
b7e602a19c
共有 59 個文件被更改,包括 232 次插入143 次删除
  1. 3 3
      composables/data/useEntityFetch.ts
  2. 1 1
      composables/form/useFieldViolation.ts
  3. 2 1
      composables/form/useValidation.ts
  4. 8 8
      models/Organization/DolibarrAccount.ts
  5. 22 0
      models/Organization/OrganizationProfile.ts
  6. 25 18
      pages/parameters/teaching.vue
  7. 1 1
      pages/parameters/website.vue
  8. 12 4
      plugins/ability.ts
  9. 1 1
      prepare/buildIndex.ts
  10. 2 1
      services/data/Filters/EqualFilter.ts
  11. 1 1
      services/data/Filters/InArrayFilter.ts
  12. 2 3
      services/data/Filters/SearchFilter.ts
  13. 1 0
      services/data/Filters/TimeFilter.ts
  14. 12 12
      services/data/apiRequestService.ts
  15. 16 7
      services/data/entityManager.ts
  16. 3 2
      services/data/enumManager.ts
  17. 11 10
      services/data/normalizer/hydraNormalizer.ts
  18. 1 1
      services/layout/menuBuilder/mainMenuBuilder.ts
  19. 3 6
      services/layout/menuBuilder/rewardsMenuBuilder.ts
  20. 4 2
      services/rights/abilityBuilder.ts
  21. 2 1
      services/rights/roleUtils.ts
  22. 1 1
      services/utils/dateUtils.ts
  23. 1 0
      services/utils/i18nUtils.ts
  24. 4 4
      services/utils/objectUtils.ts
  25. 2 2
      stores/form.ts
  26. 1 1
      stores/repositories/AttendanceBookingReasonRepository.ts
  27. 2 1
      stores/repositories/BaseRepository.ts
  28. 1 1
      stores/repositories/EducationTimingsRepository.ts
  29. 2 2
      stores/repositories/NotificationRepository.ts
  30. 1 1
      stores/repositories/ResidenceAreasRepository.ts
  31. 3 2
      stores/sse.ts
  32. 9 9
      tests/units/services/data/apiRequestService.test.ts
  33. 11 6
      tests/units/services/data/entityManager.test.ts
  34. 1 1
      tests/units/services/data/filters/searchFilter.test.ts
  35. 15 16
      tests/units/services/data/normalizer/hydraNormalizer.test.ts
  36. 4 0
      tests/units/services/data/query.test.ts
  37. 5 5
      tests/units/services/layout/menuBuilder/abstractMenuBuilder.test.ts
  38. 1 0
      tests/units/services/layout/menuBuilder/accessMenuBuilder.test.ts
  39. 1 0
      tests/units/services/layout/menuBuilder/accountMenuBuilder.test.ts
  40. 1 0
      tests/units/services/layout/menuBuilder/admin2iosMenuBuilder.test.ts
  41. 1 0
      tests/units/services/layout/menuBuilder/agendaMenuBuilder.test.ts
  42. 1 0
      tests/units/services/layout/menuBuilder/billingMenuBuilder.test.ts
  43. 1 0
      tests/units/services/layout/menuBuilder/communicationMenuBuilder.test.ts
  44. 3 0
      tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts
  45. 1 0
      tests/units/services/layout/menuBuilder/cotisationsMenuBuilder.test.ts
  46. 1 0
      tests/units/services/layout/menuBuilder/donorsMenuBuilder.test.ts
  47. 1 0
      tests/units/services/layout/menuBuilder/educationalMenuBuilder.test.ts
  48. 1 0
      tests/units/services/layout/menuBuilder/equipmentMenuBuilder.test.ts
  49. 2 1
      tests/units/services/layout/menuBuilder/mainMenuBuilder.test.ts
  50. 1 0
      tests/units/services/layout/menuBuilder/myAccessesMenuBuilder.test.ts
  51. 1 0
      tests/units/services/layout/menuBuilder/myFamilyMenuBuilder.test.ts
  52. 3 2
      tests/units/services/layout/menuBuilder/parametersMenuBuilder.test.ts
  53. 1 0
      tests/units/services/layout/menuBuilder/statsMenuBuilder.test.ts
  54. 1 0
      tests/units/services/layout/menuBuilder/websiteAdminMenuBuilder.test.ts
  55. 1 0
      tests/units/services/layout/menuBuilder/websiteListMenuBuilder.test.ts
  56. 1 0
      tests/units/services/layout/menuComposer.test.ts
  57. 4 3
      tests/units/services/rights/abilityBuilder.test.ts
  58. 2 2
      types/data.d.ts
  59. 6 0
      types/interfaces.d.ts

+ 3 - 3
composables/data/useEntityFetch.ts

@@ -18,7 +18,7 @@ interface useEntityFetchReturnType {
 
 
   fetchCollection: <T extends typeof ApiResource>(
   fetchCollection: <T extends typeof ApiResource>(
     model: T,
     model: T,
-    parent?: T | null,
+    parent?: InstanceType<T> | null,
     query?: typeof Query | Query| null,
     query?: typeof Query | Query| null,
   ) => {
   ) => {
     data: ComputedRef<Collection<InstanceType<T>> | null>
     data: ComputedRef<Collection<InstanceType<T>> | null>
@@ -45,12 +45,12 @@ export const useEntityFetch = (
       model.entity + '_' + id + '_' + uuid4(),
       model.entity + '_' + id + '_' + uuid4(),
       () => em.fetch(model, id),
       () => em.fetch(model, id),
       { lazy },
       { lazy },
-    ) as AsyncData<InstanceType<T> | null, Error | null>
+    ) as unknown as AsyncData<InstanceType<T> | null, Error | null>
   }
   }
 
 
   const fetchCollection = <T extends typeof ApiResource> (
   const fetchCollection = <T extends typeof ApiResource> (
     model: T,
     model: T,
-    parent: T | null = null,
+    parent: InstanceType<T> | null = null,
     query: Query | null = null,
     query: Query | null = null,
   )  => {
   )  => {
     const {
     const {

+ 1 - 1
composables/form/useFieldViolation.ts

@@ -18,7 +18,7 @@ export function useFieldViolation(field: string) {
    */
    */
   function updateViolationState() {
   function updateViolationState() {
     useFormStore().setViolations(
     useFormStore().setViolations(
-      _.omit(useFormStore().violations, field) as unknown as string[],
+      _.omit(useFormStore().violations, field),
     )
     )
   }
   }
 
 

+ 2 - 1
composables/form/useValidation.ts

@@ -2,6 +2,7 @@ import { useI18n } from 'vue-i18n'
 import type { Ref } from 'vue'
 import type { Ref } from 'vue'
 import { useAp2iRequestService } from '~/composables/data/useAp2iRequestService'
 import { useAp2iRequestService } from '~/composables/data/useAp2iRequestService'
 import UrlUtils from '~/services/utils/urlUtils'
 import UrlUtils from '~/services/utils/urlUtils'
+import type { AnyJson } from '~/types/data'
 
 
 /**
 /**
  * @category composables/form
  * @category composables/form
@@ -17,7 +18,7 @@ export function useValidation() {
 
 
     const validateSiret = async (siret: string) => {
     const validateSiret = async (siret: string) => {
       const { apiRequestService } = useAp2iRequestService()
       const { apiRequestService } = useAp2iRequestService()
-      const response: Response = await apiRequestService.get(
+      const response = await apiRequestService.get(
         UrlUtils.join('/api/siret-checking', siret),
         UrlUtils.join('/api/siret-checking', siret),
       )
       )
 
 

+ 8 - 8
models/Organization/DolibarrAccount.ts

@@ -1,6 +1,11 @@
 import { Attr, Str, Uid, Num } from 'pinia-orm/dist/decorators'
 import { Attr, Str, Uid, Num } from 'pinia-orm/dist/decorators'
 import ApiResource from '~/models/ApiResource'
 import ApiResource from '~/models/ApiResource'
 import { IdField } from '~/models/decorators'
 import { IdField } from '~/models/decorators'
+import type {
+  DolibarrBill,
+  DolibarrContract,
+  DolibarrOrder,
+} from '~/types/interfaces'
 
 
 /**
 /**
  * The Dolibarr account of an organization
  * The Dolibarr account of an organization
@@ -24,16 +29,11 @@ export default class DolibarrAccount extends ApiResource {
   declare product: string
   declare product: string
 
 
   @Attr({})
   @Attr({})
-  declare contract: object
+  declare contract: DolibarrContract
 
 
   @Attr(null)
   @Attr(null)
-  declare order: object
+  declare order: DolibarrOrder
 
 
   @Attr([])
   @Attr([])
-  declare bills: Array<{
-    ref: string
-    date: string
-    taxExcludedAmount: number
-    paid: boolean
-  }>
+  declare bills: Array<DolibarrBill>
 }
 }

+ 22 - 0
models/Organization/OrganizationProfile.ts

@@ -44,4 +44,26 @@ export default class OrganizationProfile extends ApiResource {
 
 
   @Str(null)
   @Str(null)
   declare principalType: string
   declare principalType: string
+
+  // Propriétés calculées du store :
+  declare isCmf: boolean
+  declare isFfec: boolean
+  declare isInsideNetwork: boolean
+  declare isArtistProduct: boolean
+  declare isArtistPremiumProduct: boolean
+  declare isArtist: boolean
+  declare isSchoolProduct: boolean
+  declare isSchoolPremiumProduct: boolean
+  declare isSchool: boolean
+  declare isManagerProduct: boolean
+  declare isFreemiumProduct: boolean
+  declare isShowAdherentList: boolean
+  declare isAssociation: boolean
+  declare isCMFCentralService: boolean
+  declare getWebsite: string | null
+  declare website: string | null
+  declare trialActive: boolean
+  declare trialCountDown: number | null
+  declare productBeforeTrial: string | null
+
 }
 }

+ 25 - 18
pages/parameters/teaching.vue

@@ -42,11 +42,10 @@ import Parameters from '~/models/Organization/Parameters'
 import { useEntityFetch } from '~/composables/data/useEntityFetch'
 import { useEntityFetch } from '~/composables/data/useEntityFetch'
 import Cycle from '~/models/Education/Cycle'
 import Cycle from '~/models/Education/Cycle'
 import { useOrganizationProfileStore } from '~/stores/organizationProfile'
 import { useOrganizationProfileStore } from '~/stores/organizationProfile'
-import type { AnyJson } from '~/types/data'
 import { useEnumFetch } from '~/composables/data/useEnumFetch'
 import { useEnumFetch } from '~/composables/data/useEnumFetch'
 import { TABLE_ACTION } from '~/types/enum/enums'
 import { TABLE_ACTION } from '~/types/enum/enums'
-import {FETCHING_STATUS} from "~/types/enum/data";
-import { type EnumChoice } from '~/types/enum/interface'
+import { FETCHING_STATUS } from "~/types/enum/data";
+import type { EnumChoice } from '~/types/interfaces'
 
 
 definePageMeta({
 definePageMeta({
   name: 'parameters_teaching_page',
   name: 'parameters_teaching_page',
@@ -69,12 +68,12 @@ const pending: ComputedRef<boolean> = computed(
   () => enumStatus.value == FETCHING_STATUS.PENDING || cyclesStatus.value == FETCHING_STATUS.PENDING,
   () => enumStatus.value == FETCHING_STATUS.PENDING || cyclesStatus.value == FETCHING_STATUS.PENDING,
 )
 )
 
 
-const orderedCycles: ComputedRef<AnyJson> = computed(() => {
+const orderedCycles: ComputedRef<Record<string, Cycle>> = computed(() => {
   if (pending.value || cycleEnum.value === null || cycles.value === null) {
   if (pending.value || cycleEnum.value === null || cycles.value === null) {
     return {}
     return {}
   }
   }
 
 
-  const orderedCycles: AnyJson = {}
+  const orderedCycles: Record<string, Cycle> = {}
 
 
   for (const enumItem of cycleEnum.value) {
   for (const enumItem of cycleEnum.value) {
     orderedCycles[enumItem.value] = null
     orderedCycles[enumItem.value] = null
@@ -92,21 +91,29 @@ const orderedCycles: ComputedRef<AnyJson> = computed(() => {
   return orderedCycles
   return orderedCycles
 })
 })
 
 
-const tableItems = computed(() => {
-  return (
-    cycleEnum.value?.map((item) => {
-      const effectiveItem: EnumChoice = orderedCycles.value[item.value] ?? item
-
-      return {
-        value: item.value,
-        originalLabel: item.label,
-        effectiveLabel: effectiveItem.label,
-      }
-    }) || []
-  )
+interface CycleTableItem {
+  value: string
+  originalLabel: string
+  effectiveLabel: string
+}
+
+const tableItems: Ref<CycleTableItem[]> = computed(() => {
+  if (pending.value || cycleEnum.value === null || cycles.value === null) {
+    return []
+  }
+
+  return cycleEnum.value?.map((item) => {
+    const effectiveItem: Cycle = orderedCycles.value[item.value]
+
+    return {
+      value: item.value,
+      originalLabel: item.label,
+      effectiveLabel: effectiveItem.label,
+    }
+  }) || []
 })
 })
 
 
-const goToCycleEditPage = (item: object) => {
+const goToCycleEditPage = (item: CycleTableItem) => {
   const cycle = orderedCycles.value[item.value]
   const cycle = orderedCycles.value[item.value]
   navigateTo(`/parameters/cycles/${cycle.id}`)
   navigateTo(`/parameters/cycles/${cycle.id}`)
 }
 }

+ 1 - 1
pages/parameters/website.vue

@@ -67,7 +67,7 @@
               :key="subdomain.id"
               :key="subdomain.id"
               :title="subdomain.subdomain"
               :title="subdomain.subdomain"
               :class="'subdomainItem' + (subdomain.active ? ' active' : '')"
               :class="'subdomainItem' + (subdomain.active ? ' active' : '')"
-              @click="goToEditPage(subdomain.id)"
+              @click="goToEditPage(Number(subdomain.id))"
             >
             >
               <td>{{ subdomain.subdomain }}</td>
               <td>{{ subdomain.subdomain }}</td>
               <td>
               <td>

+ 12 - 4
plugins/ability.ts

@@ -1,7 +1,15 @@
-import { createMongoAbility } from '@casl/ability'
+import {
+  createMongoAbility,
+  type ExtractSubjectType,
+  type Subject,
+  type SubjectRawRule,
+} from '@casl/ability'
 import AbilityBuilder from '~/services/rights/abilityBuilder'
 import AbilityBuilder from '~/services/rights/abilityBuilder'
 import { useAccessProfileStore } from '~/stores/accessProfile'
 import { useAccessProfileStore } from '~/stores/accessProfile'
 import { useOrganizationProfileStore } from '~/stores/organizationProfile'
 import { useOrganizationProfileStore } from '~/stores/organizationProfile'
+import type { MongoQuery } from '@ucast/mongo'
+import type { AccessProfile } from '~/types/interfaces'
+import type OrganizationProfile from '~/models/Organization/OrganizationProfile'
 
 
 export const ability = createMongoAbility()
 export const ability = createMongoAbility()
 
 
@@ -10,12 +18,12 @@ export default defineNuxtPlugin(() => {
   const organizationProfile = useOrganizationProfileStore()
   const organizationProfile = useOrganizationProfileStore()
 
 
   // Initialisation, nécessaire pour que l'update des habilités soit correcte après la phase SSR
   // Initialisation, nécessaire pour que l'update des habilités soit correcte après la phase SSR
-  ability.update(accessProfile.abilities)
+  ability.update(accessProfile.abilities as SubjectRawRule<string, ExtractSubjectType<Subject>, MongoQuery>[])
 
 
   const abilityUtils = new AbilityBuilder(
   const abilityUtils = new AbilityBuilder(
     ability,
     ability,
-    accessProfile,
-    organizationProfile,
+    accessProfile as unknown as AccessProfile,
+    organizationProfile as unknown as OrganizationProfile,
   )
   )
 
 
   // TODO: voir si on peut se passer du listener
   // TODO: voir si on peut se passer du listener

+ 1 - 1
prepare/buildIndex.ts

@@ -23,7 +23,7 @@ files.forEach((file) => {
   let entity = null
   let entity = null
 
 
   for (const line of lines) {
   for (const line of lines) {
-    const match = line.match(/static entity = ['"]([\w-/]+)['"]/)
+    const match = line.match(/static override entity = ['"]([\w-/]+)['"]/)
     if (match) {
     if (match) {
       // afficher le groupe capturant
       // afficher le groupe capturant
       entity = match[1]
       entity = match[1]

+ 2 - 1
services/data/Filters/EqualFilter.ts

@@ -1,4 +1,4 @@
-import type { Query as PiniaOrmQuery } from 'pinia-orm'
+import { type NonMethodKeys, type Query as PiniaOrmQuery } from 'pinia-orm'
 import type { Ref } from 'vue'
 import type { Ref } from 'vue'
 import type { ApiFilter } from '~/types/data'
 import type { ApiFilter } from '~/types/data'
 import type ApiResource from '~/models/ApiResource'
 import type ApiResource from '~/models/ApiResource'
@@ -36,6 +36,7 @@ export default class EqualFilter extends AbstractFilter implements ApiFilter {
       return query
       return query
     }
     }
 
 
+    // @ts-expect-error: l'erreur de typage de field et value est trop délicate à corriger, on ignore pour le moment
     return query.where(this.field, filterValue.value)
     return query.where(this.field, filterValue.value)
   }
   }
 
 

+ 1 - 1
services/data/Filters/InArrayFilter.ts

@@ -61,7 +61,7 @@ export default class InArrayFilter extends AbstractFilter implements ApiFilter {
 
 
     filterValue.value = filterValue.value.filter((value)=> value !== null)
     filterValue.value = filterValue.value.filter((value)=> value !== null)
 
 
-    if (!filterValue.value.length > 0) {
+    if (filterValue.value.length === 0) {
       return ''
       return ''
     }
     }
 
 

+ 2 - 3
services/data/Filters/SearchFilter.ts

@@ -75,9 +75,8 @@ export default class SearchFilter extends AbstractFilter implements ApiFilter {
       return query
       return query
     }
     }
 
 
-    return query.where(this.field, (value: string) =>
-      this.search(value, filterValue),
-    )
+    // @ts-expect-error: l'erreur de typage de field et value est trop délicate à corriger, on ignore pour le moment
+    return query.where(this.field, (value: string) => this.search(value, filterValue))
   }
   }
 
 
   public getApiQueryPart(): string {
   public getApiQueryPart(): string {

+ 1 - 0
services/data/Filters/TimeFilter.ts

@@ -63,6 +63,7 @@ export default class TimeFilter extends AbstractFilter implements ApiFilter {
       return query
       return query
     }
     }
 
 
+    // @ts-expect-error: l'erreur de typage de field et value est trop délicate à corriger, on ignore pour le moment
     return query.where(this.field, (value: string) =>
     return query.where(this.field, (value: string) =>
       this.search(value, filterValue),
       this.search(value, filterValue),
     )
     )

+ 12 - 12
services/data/apiRequestService.ts

@@ -24,8 +24,8 @@ class ApiRequestService {
    */
    */
   public async get(
   public async get(
     url: string,
     url: string,
-    query: AssociativeArray | null = null,
-    headers: AssociativeArray | null = null,
+    query: AssociativeArray | string[] | null = null,
+    headers: Record<string, string> | null = null,
   ) {
   ) {
     return await this.request(HTTP_METHOD.GET, url, null, query, headers)
     return await this.request(HTTP_METHOD.GET, url, null, query, headers)
   }
   }
@@ -41,8 +41,8 @@ class ApiRequestService {
   public async post(
   public async post(
     url: string,
     url: string,
     body: string | AnyJson | null = null,
     body: string | AnyJson | null = null,
-    query: AssociativeArray | null = null,
-    headers: AssociativeArray | null = null,
+    query: AssociativeArray | string[] | null = null,
+    headers: Record<string, string> | null = null,
   ) {
   ) {
     return await this.request(HTTP_METHOD.POST, url, body, query, headers)
     return await this.request(HTTP_METHOD.POST, url, body, query, headers)
   }
   }
@@ -58,8 +58,8 @@ class ApiRequestService {
   public async put(
   public async put(
     url: string,
     url: string,
     body: string | AnyJson | null = null,
     body: string | AnyJson | null = null,
-    query: AssociativeArray | null = null,
-    headers: AssociativeArray | null = null,
+    query: AssociativeArray | string[] | null = null,
+    headers: Record<string, string> | null = null,
   ) {
   ) {
     return await this.request(HTTP_METHOD.PUT, url, body, query, headers)
     return await this.request(HTTP_METHOD.PUT, url, body, query, headers)
   }
   }
@@ -75,8 +75,8 @@ class ApiRequestService {
   public async patch(
   public async patch(
     url: string,
     url: string,
     body: string | AnyJson | null = null,
     body: string | AnyJson | null = null,
-    query: AssociativeArray | null = null,
-    headers: AssociativeArray | null = null,
+    query: AssociativeArray | string[] | null = null,
+    headers: Record<string, string> | null = null,
   ) {
   ) {
     return await this.request(HTTP_METHOD.PATCH, url, body, query, headers)
     return await this.request(HTTP_METHOD.PATCH, url, body, query, headers)
   }
   }
@@ -90,8 +90,8 @@ class ApiRequestService {
    */
    */
   public async delete(
   public async delete(
     url: string,
     url: string,
-    query: AssociativeArray | null = null,
-    headers: AssociativeArray | null = null,
+    query: AssociativeArray | string[] | null = null,
+    headers: Record<string, string> | null = null,
   ) {
   ) {
     return await this.request(HTTP_METHOD.DELETE, url, null, query, headers)
     return await this.request(HTTP_METHOD.DELETE, url, null, query, headers)
   }
   }
@@ -110,8 +110,8 @@ class ApiRequestService {
     method: HTTP_METHOD,
     method: HTTP_METHOD,
     url: string,
     url: string,
     body: string | AnyJson | null = null,
     body: string | AnyJson | null = null,
-    query: AssociativeArray | null = null,
-    headers: AssociativeArray | null = null,
+    query: AssociativeArray | string[] | null = null,
+    headers: Record<string, string> | null = null,
   ): Promise<Response> {
   ): Promise<Response> {
     const config: FetchOptions = { method }
     const config: FetchOptions = { method }
     if (query) {
     if (query) {

+ 16 - 7
services/data/entityManager.ts

@@ -10,7 +10,13 @@ import type ApiRequestService from './apiRequestService'
 import UrlUtils from '~/services/utils/urlUtils'
 import UrlUtils from '~/services/utils/urlUtils'
 import type ApiModel from '~/models/ApiModel'
 import type ApiModel from '~/models/ApiModel'
 import type ApiResource from '~/models/ApiResource'
 import type ApiResource from '~/models/ApiResource'
-import type { AnyJson, AssociativeArray, Collection } from '~/types/data.d'
+import type {
+  AnyJson,
+  ApiCollection,
+  ApiResponse,
+  AssociativeArray,
+  Collection,
+} from '~/types/data.d'
 import modelsIndex from '~/models/models'
 import modelsIndex from '~/models/models'
 import HydraNormalizer from '~/services/data/normalizer/hydraNormalizer'
 import HydraNormalizer from '~/services/data/normalizer/hydraNormalizer'
 import ObjectUtils from '~/services/utils/objectUtils'
 import ObjectUtils from '~/services/utils/objectUtils'
@@ -69,7 +75,7 @@ class EntityManager {
   }
   }
 
 
   public getModel(instance: ApiResource): typeof ApiResource {
   public getModel(instance: ApiResource): typeof ApiResource {
-    return instance.constructor as typeof ApiModel
+    return instance.constructor as typeof ApiResource
   }
   }
 
 
   /**
   /**
@@ -181,6 +187,7 @@ class EntityManager {
     const response = await this.apiRequestService.get(url)
     const response = await this.apiRequestService.get(url)
 
 
     // deserialize the response
     // deserialize the response
+    // @ts-expect-error Response here is a Json Hydra response
     const attributes = HydraNormalizer.denormalize(response, model)
     const attributes = HydraNormalizer.denormalize(response, model)
       .data as object
       .data as object
 
 
@@ -196,13 +203,13 @@ class EntityManager {
    */
    */
   public async fetchCollection <T extends typeof ApiResource>(
   public async fetchCollection <T extends typeof ApiResource>(
     model: T,
     model: T,
-    parent: T | null,
+    parent: InstanceType<T> | null,
     query: Query | null = null,
     query: Query | null = null,
   ): Promise<ComputedRef<Collection<InstanceType<T>>>> {
   ): Promise<ComputedRef<Collection<InstanceType<T>>>> {
     let url
     let url
 
 
     if (parent !== null) {
     if (parent !== null) {
-      url = UrlUtils.join('api', parent.entity, '' + parent.id, model.entity)
+      url = UrlUtils.join('api', parent.$entity(), '' + String(parent.id), model.entity)
     } else {
     } else {
       url = UrlUtils.join('api', model.entity)
       url = UrlUtils.join('api', model.entity)
     }
     }
@@ -214,7 +221,8 @@ class EntityManager {
     const response = await this.apiRequestService.get(url)
     const response = await this.apiRequestService.get(url)
 
 
     // deserialize the response
     // deserialize the response
-    const apiCollection = HydraNormalizer.denormalize(response, model)
+    // @ts-expect-error Response here is a Json Hydra response
+    const apiCollection = HydraNormalizer.denormalize(response, model) as ApiCollection
 
 
     apiCollection.data.map((attributes: object) => {
     apiCollection.data.map((attributes: object) => {
       return this.newInstance(model, attributes)
       return this.newInstance(model, attributes)
@@ -252,7 +260,7 @@ class EntityManager {
    *
    *
    * @param instance
    * @param instance
    */
    */
-  public async persist<T extends ApiModel>(instance: T): Promise<T> {
+  public async persist<T extends ApiResource>(instance: T): Promise<T> {
     const model = this.getModel(instance)
     const model = this.getModel(instance)
 
 
     let url = UrlUtils.join('api', model.entity)
     let url = UrlUtils.join('api', model.entity)
@@ -284,7 +292,7 @@ class EntityManager {
       this.removeTempAfterPersist(model, instance.id)
       this.removeTempAfterPersist(model, instance.id)
     }
     }
 
 
-    return newInstance
+    return newInstance as T
   }
   }
 
 
   /**
   /**
@@ -304,6 +312,7 @@ class EntityManager {
     const body = JSON.stringify(data)
     const body = JSON.stringify(data)
     const response = await this.apiRequestService.patch(url, body)
     const response = await this.apiRequestService.patch(url, body)
 
 
+    // @ts-expect-error Response here is a Json Hydra response
     const hydraResponse = HydraNormalizer.denormalize(response, model)
     const hydraResponse = HydraNormalizer.denormalize(response, model)
 
 
     return this.newInstance(model, hydraResponse.data)
     return this.newInstance(model, hydraResponse.data)

+ 3 - 2
services/data/enumManager.ts

@@ -2,7 +2,7 @@ import type { VueI18n } from 'vue-i18n'
 import type ApiRequestService from './apiRequestService'
 import type ApiRequestService from './apiRequestService'
 import UrlUtils from '~/services/utils/urlUtils'
 import UrlUtils from '~/services/utils/urlUtils'
 import HydraNormalizer from '~/services/data/normalizer/hydraNormalizer'
 import HydraNormalizer from '~/services/data/normalizer/hydraNormalizer'
-import type { Enum } from '~/types/data.d'
+import type { ApiCollection, Collection, Enum } from '~/types/data.d'
 
 
 class EnumManager {
 class EnumManager {
   private apiRequestService: ApiRequestService
   private apiRequestService: ApiRequestService
@@ -18,7 +18,8 @@ class EnumManager {
 
 
     const response = await this.apiRequestService.get(url)
     const response = await this.apiRequestService.get(url)
 
 
-    const { data } = HydraNormalizer.denormalize(response)
+    // @ts-expect-error Response here is a Json Hydra response
+    const { data } = HydraNormalizer.denormalize(response) as { data: Collection }
 
 
     const enum_: Enum = []
     const enum_: Enum = []
     for (const key in data.items) {
     for (const key in data.items) {

+ 11 - 10
services/data/normalizer/hydraNormalizer.ts

@@ -63,9 +63,9 @@ class HydraNormalizer {
   protected static getData(
   protected static getData(
     hydraData: AnyJson,
     hydraData: AnyJson,
     model?: typeof ApiResource,
     model?: typeof ApiResource,
-  ): AnyJson {
+  ): AnyJson | ApiResource | (AnyJson | ApiResource)[] {
     if (hydraData['@type'] === 'Collection') {
     if (hydraData['@type'] === 'Collection') {
-      const members = hydraData.member
+      const members = hydraData.member as Array<AnyJson>
       return members.map((item: AnyJson) =>
       return members.map((item: AnyJson) =>
         HydraNormalizer.denormalizeItem(item, model),
         HydraNormalizer.denormalizeItem(item, model),
       )
       )
@@ -87,6 +87,7 @@ class HydraNormalizer {
     }
     }
 
 
     const metadata: HydraMetadata = {
     const metadata: HydraMetadata = {
+      // @ts-expect-error A ce niveau, on connait la structure de data
       totalItems: data['totalItems'],
       totalItems: data['totalItems'],
     }
     }
 
 
@@ -130,7 +131,7 @@ class HydraNormalizer {
   protected static denormalizeItem(
   protected static denormalizeItem(
     item: AnyJson,
     item: AnyJson,
     model?: typeof ApiResource,
     model?: typeof ApiResource,
-  ): AnyJson {
+  ): ApiResource | AnyJson {
     if (model) {
     if (model) {
       return HydraNormalizer.denormalizeEntity(model, item)
       return HydraNormalizer.denormalizeEntity(model, item)
     }
     }
@@ -144,7 +145,10 @@ class HydraNormalizer {
       return item
       return item
     }
     }
 
 
-    if (item['@id'].match(/\/api\/enum\/\w+/)) {
+    // The previous condition guarantees the correct type
+    const itemId = (item as { '@id' : string })['@id']
+
+    if (itemId.match(/\/api\/enum\/\w+/)) {
       return HydraNormalizer.denormalizeEnum(item)
       return HydraNormalizer.denormalizeEnum(item)
     }
     }
 
 
@@ -152,7 +156,7 @@ class HydraNormalizer {
 
 
     // On essaie de déterminer la nature de l'objet à partir de son id
     // On essaie de déterminer la nature de l'objet à partir de son id
     try {
     try {
-      const iri = HydraNormalizer.parseEntityIRI(item['@id'])
+      const iri = HydraNormalizer.parseEntityIRI(itemId)
       entity = iri.entity
       entity = iri.entity
     } catch {
     } catch {
       console.error('De-normalization error : could not parse the IRI', item)
       console.error('De-normalization error : could not parse the IRI', item)
@@ -169,10 +173,7 @@ class HydraNormalizer {
 
 
     throw new Error(
     throw new Error(
       'De-normalization error : Could not determine the type of the entity ' +
       'De-normalization error : Could not determine the type of the entity ' +
-        item['@id'] +
-        ' (found: ' +
-        entity +
-        ')',
+      itemId + ' (found: ' + entity + ')',
     )
     )
   }
   }
 
 
@@ -188,7 +189,7 @@ class HydraNormalizer {
         continue
         continue
       }
       }
 
 
-      const targetEntity = iriEncodedFields[field].entity
+      const targetEntity = iriEncodedFields[field].$entity()
 
 
       if (_.isArray(value)) {
       if (_.isArray(value)) {
         instance[field] = value.map((iri: string) => {
         instance[field] = value.map((iri: string) => {

+ 1 - 1
services/layout/menuBuilder/mainMenuBuilder.ts

@@ -6,7 +6,7 @@ import EquipmentMenuBuilder from '~/services/layout/menuBuilder/equipmentMenuBui
 import EducationalMenuBuilder from '~/services/layout/menuBuilder/educationalMenuBuilder'
 import EducationalMenuBuilder from '~/services/layout/menuBuilder/educationalMenuBuilder'
 import BillingMenuBuilder from '~/services/layout/menuBuilder/billingMenuBuilder'
 import BillingMenuBuilder from '~/services/layout/menuBuilder/billingMenuBuilder'
 import CommunicationMenuBuilder from '~/services/layout/menuBuilder/communicationMenuBuilder'
 import CommunicationMenuBuilder from '~/services/layout/menuBuilder/communicationMenuBuilder'
-import RewardsMenuBuilder from '~/services/layout/menuBuilder/rewardsMenuBuilder'
+import { RewardsMenuBuilder } from '~/services/layout/menuBuilder/rewardsMenuBuilder'
 import DonorsMenuBuilder from '~/services/layout/menuBuilder/donorsMenuBuilder'
 import DonorsMenuBuilder from '~/services/layout/menuBuilder/donorsMenuBuilder'
 import WebsiteAdminMenuBuilder from '~/services/layout/menuBuilder/websiteAdminMenuBuilder'
 import WebsiteAdminMenuBuilder from '~/services/layout/menuBuilder/websiteAdminMenuBuilder'
 import CotisationsMenuBuilder from '~/services/layout/menuBuilder/cotisationsMenuBuilder'
 import CotisationsMenuBuilder from '~/services/layout/menuBuilder/cotisationsMenuBuilder'

+ 3 - 6
services/layout/menuBuilder/rewardsMenuBuilder.ts

@@ -1,17 +1,14 @@
 import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
 import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
-import type { MenuGroup, MenuItems } from '~/types/layout'
+import type { MenuGroup, MenuItem, MenuItems } from '~/types/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 import { MENU_LINK_TYPE } from '~/types/enum/layout'
 
 
-/**
- * Menu Distinctions
- */
-export default class RewardsMenuBuilder extends AbstractMenuBuilder {
+export class RewardsMenuBuilder extends AbstractMenuBuilder {
   static override readonly menuName = 'AccessRewards'
   static override readonly menuName = 'AccessRewards'
 
 
   /**
   /**
    * Construit le menu distinctions, ou null si aucune page accessible
    * Construit le menu distinctions, ou null si aucune page accessible
    */
    */
-  build(): MenuItems | MenuGroup | null {
+  build(): MenuItem | MenuGroup | null {
     const children: MenuItems = []
     const children: MenuItems = []
 
 
     if (this.ability.can('display', 'access_rewards_list_page')) {
     if (this.ability.can('display', 'access_rewards_list_page')) {

+ 4 - 2
services/rights/abilityBuilder.ts

@@ -1,10 +1,11 @@
 import * as yaml from 'yaml-import'
 import * as yaml from 'yaml-import'
 import * as _ from 'lodash-es'
 import * as _ from 'lodash-es'
-import type { MongoAbility } from '@casl/ability/dist/types/Ability'
 import RoleUtils from '~/services/rights/roleUtils'
 import RoleUtils from '~/services/rights/roleUtils'
 import type { AbilitiesType, AccessProfile } from '~/types/interfaces'
 import type { AbilitiesType, AccessProfile } from '~/types/interfaces'
 import type { ABILITIES } from '~/types/enum/enums'
 import type { ABILITIES } from '~/types/enum/enums'
 import type OrganizationProfile from '~/models/Organization/OrganizationProfile'
 import type OrganizationProfile from '~/models/Organization/OrganizationProfile'
+// @ts-expect-error false error
+import type { MongoAbility } from '@casl/ability/dist/types/Ability'
 
 
 interface ConditionParameters {
 interface ConditionParameters {
   action: string
   action: string
@@ -150,7 +151,7 @@ class AbilityBuilder {
     organizationIsShowAdherentList: (_) =>
     organizationIsShowAdherentList: (_) =>
       this.organizationProfile.isShowAdherentList,
       this.organizationProfile.isShowAdherentList,
     organizationIsCmf: (_) => this.organizationProfile.isCmf,
     organizationIsCmf: (_) => this.organizationProfile.isCmf,
-    organizationHasWebsite: (_) => this.organizationProfile.getWebsite,
+    organizationHasWebsite: (_) => this.organizationProfile.getWebsite !== null,
   }
   }
 
 
   /**
   /**
@@ -301,6 +302,7 @@ class AbilityBuilder {
       module = (module as ConditionParameters).subject
       module = (module as ConditionParameters).subject
     }
     }
 
 
+    // @ts-expect-error false error
     return this.organizationProfile.hasModule(module)
     return this.organizationProfile.hasModule(module)
   }
   }
 
 

+ 2 - 1
services/rights/roleUtils.ts

@@ -1,6 +1,7 @@
 import * as _ from 'lodash-es'
 import * as _ from 'lodash-es'
 import type { AbilitiesType } from '~/types/interfaces'
 import type { AbilitiesType } from '~/types/interfaces'
 import type { AnyJson } from '~/types/data'
 import type { AnyJson } from '~/types/data'
+import type { ABILITIES } from '~/types/enum/enums'
 
 
 // TODO: peut-être passer ces constantes dans la config?
 // TODO: peut-être passer ces constantes dans la config?
 const rolesByFunction: Array<string> = [
 const rolesByFunction: Array<string> = [
@@ -113,7 +114,7 @@ class RoleUtils {
    * @param role
    * @param role
    */
    */
   static roleToAbility(role: Role): AbilitiesType | null {
   static roleToAbility(role: Role): AbilitiesType | null {
-    const mappedAction = actionMap[role.action]
+    const mappedAction = actionMap[role.action] as ABILITIES
     if (mappedAction === null) {
     if (mappedAction === null) {
       return null
       return null
     }
     }

+ 1 - 1
services/utils/dateUtils.ts

@@ -1,4 +1,4 @@
-import { format } from 'date-fns'
+import { format, type Locale } from 'date-fns'
 
 
 import { enUS, fr } from 'date-fns/locale'
 import { enUS, fr } from 'date-fns/locale'
 import ArrayUtils from '~/services/utils/arrayUtils'
 import ArrayUtils from '~/services/utils/arrayUtils'

+ 1 - 0
services/utils/i18nUtils.ts

@@ -25,6 +25,7 @@ export default class I18nUtils {
     })
     })
 
 
     if (sort) {
     if (sort) {
+      // @ts-expect-error enum_ is now an array of EnumChoice
       enum_ = ArrayUtils.sortObjectsByProp(enum_, 'label') as EnumChoices
       enum_ = ArrayUtils.sortObjectsByProp(enum_, 'label') as EnumChoices
     }
     }
 
 

+ 4 - 4
services/utils/objectUtils.ts

@@ -32,7 +32,7 @@ const ObjectUtils = {
 
 
       if (this.isObject(object[name])) {
       if (this.isObject(object[name])) {
         if (!excludedProperties.includes(name)) {
         if (!excludedProperties.includes(name)) {
-          const flatObject = this.cloneAndFlatten(object[name])
+          const flatObject = this.cloneAndFlatten(object[name] as AnyJson)
           Object.keys(flatObject).forEach((flatObjectKey) => {
           Object.keys(flatObject).forEach((flatObjectKey) => {
             if (
             if (
               !Object.prototype.hasOwnProperty.call(flatObject, flatObjectKey)
               !Object.prototype.hasOwnProperty.call(flatObject, flatObjectKey)
@@ -42,7 +42,7 @@ const ObjectUtils = {
             values[name + '.' + flatObjectKey] = flatObject[flatObjectKey]
             values[name + '.' + flatObjectKey] = flatObject[flatObjectKey]
           })
           })
         } else {
         } else {
-          values[name] = this.clone(object[name])
+          values[name] = this.clone(object[name] as AnyJson)
         }
         }
       } else {
       } else {
         values[name] = object[name]
         values[name] = object[name]
@@ -128,13 +128,13 @@ const ObjectUtils = {
    * @example sortObjectsByKey({b:1, d:2, c:3, a:4}) => {a:4, b:1, c:3, d:2}
    * @example sortObjectsByKey({b:1, d:2, c:3, a:4}) => {a:4, b:1, c:3, d:2}
    * @param toSort
    * @param toSort
    */
    */
-  sortObjectsByKey(toSort: AnyJson): AnyJson {
+  sortObjectsByKey(toSort: object): AnyJson {
     if (typeof toSort !== 'object') {
     if (typeof toSort !== 'object') {
       throw new TypeError('Expecting an object parameter')
       throw new TypeError('Expecting an object parameter')
     }
     }
     return Object.keys(toSort)
     return Object.keys(toSort)
       .sort()
       .sort()
-      .reduce((obj: AnyJson, key: string) => {
+      .reduce((obj: object, key: string) => {
         obj[key] = toSort[key]
         obj[key] = toSort[key]
         return obj
         return obj
       }, {})
       }, {})

+ 2 - 2
stores/form.ts

@@ -11,7 +11,7 @@ export const useFormStore = defineStore('form', () => {
   const showConfirmToLeave: Ref<boolean> = ref(false)
   const showConfirmToLeave: Ref<boolean> = ref(false)
   const goAfterLeave: Ref<string | null> = ref(null)
   const goAfterLeave: Ref<string | null> = ref(null)
 
 
-  const setViolations = (newViolations: Array<string>) => {
+  const setViolations = (newViolations: AnyJson) => {
     violations.value = newViolations
     violations.value = newViolations
   }
   }
 
 
@@ -51,7 +51,7 @@ export const useFormStore = defineStore('form', () => {
       goAfterLeave.value = to
       goAfterLeave.value = to
     } else {
     } else {
       formFunction.value = FORM_FUNCTION.EDIT
       formFunction.value = FORM_FUNCTION.EDIT
-      violations.value = []
+      violations.value = {}
     }
     }
   }
   }
 
 

+ 1 - 1
stores/repositories/AttendanceBookingReasonRepository.ts

@@ -3,7 +3,7 @@ import BaseRepository from '~/stores/repositories/BaseRepository'
 import AttendanceBookingReason from '~/models/Booking/AttendanceBookingReason'
 import AttendanceBookingReason from '~/models/Booking/AttendanceBookingReason'
 
 
 class AttendanceBookingReasonRepository extends BaseRepository {
 class AttendanceBookingReasonRepository extends BaseRepository {
-  use = AttendanceBookingReason
+  override use = AttendanceBookingReason
 
 
   /**
   /**
    * On récupère les AttendanceBookingReasons via le store
    * On récupère les AttendanceBookingReasons via le store

+ 2 - 1
stores/repositories/BaseRepository.ts

@@ -1,8 +1,9 @@
 import { Repository } from 'pinia-orm'
 import { Repository } from 'pinia-orm'
+import type ApiResource from '~/models/ApiResource'
 
 
 abstract class BaseRepository extends Repository {
 abstract class BaseRepository extends Repository {
   public getQuery() {
   public getQuery() {
-    return this.where((val) => Number.isInteger(val.id)) // exclude _clone_ ids
+    return this.where((val) => Number.isInteger((val as ApiResource).id)) // exclude _clone_ ids
   }
   }
 }
 }
 
 

+ 1 - 1
stores/repositories/EducationTimingsRepository.ts

@@ -3,7 +3,7 @@ import EducationTiming from '~/models/Education/EducationTiming'
 import BaseRepository from '~/stores/repositories/BaseRepository'
 import BaseRepository from '~/stores/repositories/BaseRepository'
 
 
 class EducationTimingsRepository extends BaseRepository {
 class EducationTimingsRepository extends BaseRepository {
-  use = EducationTiming
+  override use = EducationTiming
 
 
   /**
   /**
    * On récupère les EducationTimings via le store
    * On récupère les EducationTimings via le store

+ 2 - 2
stores/repositories/NotificationRepository.ts

@@ -3,7 +3,7 @@ import Notification from '~/models/Core/Notification'
 import BaseRepository from '~/stores/repositories/BaseRepository'
 import BaseRepository from '~/stores/repositories/BaseRepository'
 
 
 class NotificationRepository extends BaseRepository {
 class NotificationRepository extends BaseRepository {
-  use = Notification
+  override use = Notification
 
 
   /**
   /**
    * On récupère les Notifications via le store
    * On récupère les Notifications via le store
@@ -19,7 +19,7 @@ class NotificationRepository extends BaseRepository {
    */
    */
   public getUnreadNotifications(): Collection<Notification> {
   public getUnreadNotifications(): Collection<Notification> {
     return this.getQuery()
     return this.getQuery()
-      .where((val) => val.notificationUsers?.length === 0)
+      .where((val) => (val as Notification).notificationUsers?.length === 0)
       .orderBy('createDate', 'desc')
       .orderBy('createDate', 'desc')
       .get() as Collection<Notification>
       .get() as Collection<Notification>
   }
   }

+ 1 - 1
stores/repositories/ResidenceAreasRepository.ts

@@ -3,7 +3,7 @@ import ResidenceArea from '~/models/Billing/ResidenceArea'
 import BaseRepository from '~/stores/repositories/BaseRepository'
 import BaseRepository from '~/stores/repositories/BaseRepository'
 
 
 class ResidenceAreasRepository extends BaseRepository {
 class ResidenceAreasRepository extends BaseRepository {
-  use = ResidenceArea
+  override use = ResidenceArea
 
 
   /**
   /**
    * On récupère les RésidenceArea via le store
    * On récupère les RésidenceArea via le store

+ 3 - 2
stores/sse.ts

@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
 import { ref } from 'vue'
 import { ref } from 'vue'
 import type { Ref } from 'vue'
 import type { Ref } from 'vue'
 import { useEntityManager } from '~/composables/data/useEntityManager'
 import { useEntityManager } from '~/composables/data/useEntityManager'
-import type { MercureEntityUpdate } from '~/types/interfaces'
+import type { AccessProfile, MercureEntityUpdate } from '~/types/interfaces'
 
 
 export const useSseStore = defineStore('sse', () => {
 export const useSseStore = defineStore('sse', () => {
   const connected: Ref<boolean> = ref(false)
   const connected: Ref<boolean> = ref(false)
@@ -12,13 +12,14 @@ export const useSseStore = defineStore('sse', () => {
     const { em } = useEntityManager()
     const { em } = useEntityManager()
 
 
     const model = await em.getModelFromIri(event.iri)
     const model = await em.getModelFromIri(event.iri)
-    const instance = em.newInstance(model, JSON.parse(event.data))
+    const instance = em.newInstance(model, JSON.parse(event.data as string))
 
 
     switch (event.operation) {
     switch (event.operation) {
       case 'update':
       case 'update':
       case 'create':
       case 'create':
         if (model.entity === 'my_profile') {
         if (model.entity === 'my_profile') {
           const accessProfileStore = useAccessProfileStore()
           const accessProfileStore = useAccessProfileStore()
+          // @ts-expect-error on sait que instance est du type AccessProfile ici
           accessProfileStore.initiateProfile(instance)
           accessProfileStore.initiateProfile(instance)
         } else {
         } else {
           // Cas générique d'une entité standard
           // Cas générique d'une entité standard

+ 9 - 9
tests/units/services/data/apiRequestService.test.ts

@@ -50,7 +50,7 @@ describe('get', () => {
       {
       {
         a: 1,
         a: 1,
       },
       },
-      { b: 2 },
+      { b: '2' },
     )
     )
 
 
     expect(result).toEqual('a_response')
     expect(result).toEqual('a_response')
@@ -59,8 +59,8 @@ describe('get', () => {
       HTTP_METHOD.GET,
       HTTP_METHOD.GET,
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       null,
       null,
-      { a: 1 },
-      { b: 2 },
+      { a: '1' },
+      { b: '2' },
     )
     )
   })
   })
 })
 })
@@ -93,7 +93,7 @@ describe('post', () => {
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       'request_body',
       'request_body',
       { a: 1 },
       { a: 1 },
-      { b: 2 },
+      { b: '2' },
     )
     )
 
 
     expect(result).toEqual('a_response')
     expect(result).toEqual('a_response')
@@ -103,7 +103,7 @@ describe('post', () => {
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       'request_body',
       'request_body',
       { a: 1 },
       { a: 1 },
-      { b: 2 },
+      { b: '2' },
     )
     )
   })
   })
 })
 })
@@ -136,7 +136,7 @@ describe('put', () => {
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       'request_body',
       'request_body',
       { a: 1 },
       { a: 1 },
-      { b: 2 },
+      { b: '2' },
     )
     )
 
 
     expect(result).toEqual('a_response')
     expect(result).toEqual('a_response')
@@ -146,7 +146,7 @@ describe('put', () => {
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       'request_body',
       'request_body',
       { a: 1 },
       { a: 1 },
-      { b: 2 },
+      { b: '2' },
     )
     )
   })
   })
 })
 })
@@ -175,7 +175,7 @@ describe('delete', () => {
     const result = await apiRequestService.delete(
     const result = await apiRequestService.delete(
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       { a: 1 },
       { a: 1 },
-      { b: 2 },
+      { b: '2' },
     )
     )
 
 
     expect(result).toEqual('a_response')
     expect(result).toEqual('a_response')
@@ -185,7 +185,7 @@ describe('delete', () => {
       'https://myapi.com/api/item',
       'https://myapi.com/api/item',
       null,
       null,
       { a: 1 },
       { a: 1 },
-      { b: 2 },
+      { b: '2' },
     )
     )
   })
   })
 })
 })

+ 11 - 6
tests/units/services/data/entityManager.test.ts

@@ -8,7 +8,7 @@ import type ApiRequestService from '~/services/data/apiRequestService'
 import { IdField } from '~/models/decorators'
 import { IdField } from '~/models/decorators'
 
 
 class DummyApiResource extends ApiResource {
 class DummyApiResource extends ApiResource {
-  static entity = 'dummyResource'
+  static override entity = 'dummyResource'
 
 
   @Uid()
   @Uid()
   declare id: number | string
   declare id: number | string
@@ -18,7 +18,7 @@ class DummyApiResource extends ApiResource {
 }
 }
 
 
 class DummyApiModel extends ApiModel {
 class DummyApiModel extends ApiModel {
-  static entity = 'dummyModel'
+  static override entity = 'dummyModel'
 
 
   @Uid()
   @Uid()
   declare id: number | string
   declare id: number | string
@@ -28,20 +28,20 @@ class DummyApiModel extends ApiModel {
 }
 }
 
 
 class TestableEntityManager extends EntityManager {
 class TestableEntityManager extends EntityManager {
-  public _getProfileMask: () => object
+  public override _getProfileMask: () => object
 
 
-  public removeTempAfterPersist(
+  public override removeTempAfterPersist(
     model: typeof ApiResource,
     model: typeof ApiResource,
     tempInstanceId: number | string,
     tempInstanceId: number | string,
   ) {
   ) {
     return super.removeTempAfterPersist(model, tempInstanceId)
     return super.removeTempAfterPersist(model, tempInstanceId)
   }
   }
 
 
-  public makeProfileHash() {
+  public override makeProfileHash() {
     return super.makeProfileHash()
     return super.makeProfileHash()
   }
   }
 
 
-  public validateEntity(instance: unknown): void {
+  public override validateEntity(instance: unknown): void {
     return super.validateEntity(instance)
     return super.validateEntity(instance)
   }
   }
 }
 }
@@ -81,8 +81,10 @@ beforeEach(() => {
     return {}
     return {}
   })
   })
 
 
+
   entityManager = new TestableEntityManager(
   entityManager = new TestableEntityManager(
     apiRequestService,
     apiRequestService,
+    //@ts-expect-error problème de typage sans conséquence
     _getRepo,
     _getRepo,
     _getProfileMask,
     _getProfileMask,
   )
   )
@@ -405,6 +407,7 @@ describe('fetchCollection', () => {
 
 
     const parent = new DummyApiModel()
     const parent = new DummyApiModel()
     parent.id = 100
     parent.id = 100
+    //@ts-expect-error problème d'accès à la prop statique, je ne crois pas que ça gêne...
     parent.entity = 'dummyModel' // TODO: je ne comprend pas pqoi cette ligne est nécessaire...
     parent.entity = 'dummyModel' // TODO: je ne comprend pas pqoi cette ligne est nécessaire...
 
 
     await entityManager.fetchCollection(DummyApiResource, parent)
     await entityManager.fetchCollection(DummyApiResource, parent)
@@ -610,6 +613,8 @@ describe('patch', () => {
     })
     })
 
 
     expect(result.id).toEqual(1)
     expect(result.id).toEqual(1)
+
+    //@ts-expect-error name est supposé exister à ce niveau là
     expect(result.name).toEqual('bobby')
     expect(result.name).toEqual('bobby')
   })
   })
 })
 })

+ 1 - 1
tests/units/services/data/filters/searchFilter.test.ts

@@ -8,7 +8,7 @@ import SearchFilter from '~/services/data/Filters/SearchFilter'
 import { SEARCH_STRATEGY } from '~/types/enum/data'
 import { SEARCH_STRATEGY } from '~/types/enum/data'
 
 
 class TestableSearchFilter extends SearchFilter {
 class TestableSearchFilter extends SearchFilter {
-  public search(value: string, filterValue: Ref<string | null>): boolean {
+  public override search(value: string, filterValue: Ref<string | null>): boolean {
     return super.search(value, filterValue)
     return super.search(value, filterValue)
   }
   }
 }
 }

+ 15 - 16
tests/units/services/data/normalizer/hydraNormalizer.test.ts

@@ -9,14 +9,14 @@ import UrlUtils from '~/services/utils/urlUtils'
 import ApiResource from '~/models/ApiResource'
 import ApiResource from '~/models/ApiResource'
 
 
 class DummyApiChild extends ApiModel {
 class DummyApiChild extends ApiModel {
-  static entity = 'dummyChild'
+  static override entity = 'dummyChild'
 
 
   @Uid()
   @Uid()
   declare id: number | string
   declare id: number | string
 }
 }
 
 
 class DummyApiModel extends ApiModel {
 class DummyApiModel extends ApiModel {
-  static entity = 'dummyModel'
+  static override entity = 'dummyModel'
 
 
   @Uid()
   @Uid()
   declare id: number | string
   declare id: number | string
@@ -169,10 +169,10 @@ describe('getMetadata', () => {
     const metadata = HydraNormalizer.getMetadata(data)
     const metadata = HydraNormalizer.getMetadata(data)
 
 
     expect(metadata.totalItems).toEqual(10)
     expect(metadata.totalItems).toEqual(10)
-    expect(metadata.firstPage).toEqual(1)
-    expect(metadata.lastPage).toEqual(5)
-    expect(metadata.nextPage).toEqual(4)
-    expect(metadata.previousPage).toEqual(2)
+    expect(metadata.first).toEqual(1)
+    expect(metadata.last).toEqual(5)
+    expect(metadata.next).toEqual(4)
+    expect(metadata.previous).toEqual(2)
     expect(metadata.type).toEqual(METADATA_TYPE.COLLECTION)
     expect(metadata.type).toEqual(METADATA_TYPE.COLLECTION)
   })
   })
   test('With partial collection metadata', () => {
   test('With partial collection metadata', () => {
@@ -193,10 +193,10 @@ describe('getMetadata', () => {
     const metadata = HydraNormalizer.getMetadata(data)
     const metadata = HydraNormalizer.getMetadata(data)
 
 
     expect(metadata.totalItems).toEqual(10)
     expect(metadata.totalItems).toEqual(10)
-    expect(metadata.firstPage).toEqual(1)
-    expect(metadata.lastPage).toEqual(1)
-    expect(metadata.nextPage).toEqual(undefined)
-    expect(metadata.previousPage).toEqual(undefined)
+    expect(metadata.first).toEqual(1)
+    expect(metadata.last).toEqual(1)
+    expect(metadata.next).toEqual(undefined)
+    expect(metadata.previous).toEqual(undefined)
   })
   })
 
 
   test('With item metadata', () => {
   test('With item metadata', () => {
@@ -318,9 +318,9 @@ describe('denormalizeItem', () => {
   })
   })
 
 
   test('With valid iri and existing model', () => {
   test('With valid iri and existing model', () => {
-    HydraNormalizer.models = {
-      dummyModel: DummyApiModel,
-    }
+
+    //@ts-expect-error problème de typage sans conséquence
+    HydraNormalizer.models = { dummyModel: DummyApiModel }
 
 
     const item = {
     const item = {
       '@id': '/api/dummyModel/1',
       '@id': '/api/dummyModel/1',
@@ -353,9 +353,8 @@ describe('denormalizeItem', () => {
   })
   })
 
 
   test('With valid iri and un-existing model', () => {
   test('With valid iri and un-existing model', () => {
-    HydraNormalizer.models = {
-      dummyModel: DummyApiModel,
-    }
+    //@ts-expect-error problème de typage sans conséquence
+    HydraNormalizer.models = { dummyModel: DummyApiModel }
 
 
     const item = {
     const item = {
       '@id': '/api/unknownModel/1',
       '@id': '/api/unknownModel/1',

+ 4 - 0
tests/units/services/data/query.test.ts

@@ -87,9 +87,13 @@ describe('applyToPiniaOrmQuery', () => {
 
 
     const query = new TestableQuery(orderBy, filter1, pageFilter, filter2)
     const query = new TestableQuery(orderBy, filter1, pageFilter, filter2)
 
 
+    //@ts-expect-error problème de typage sans conséquence
     filter1.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery2)
     filter1.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery2)
+    //@ts-expect-error problème de typage sans conséquence
     filter2.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery3)
     filter2.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery3)
+    //@ts-expect-error problème de typage sans conséquence
     orderBy.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery4)
     orderBy.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery4)
+    //@ts-expect-error problème de typage sans conséquence
     pageFilter.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery5)
     pageFilter.applyToPiniaOrmQuery = vi.fn((query) => piniaOrmQuery5)
 
 
     const result = query.applyToPiniaOrmQuery(piniaOrmQuery1)
     const result = query.applyToPiniaOrmQuery(piniaOrmQuery1)

+ 5 - 5
tests/units/services/layout/menuBuilder/abstractMenuBuilder.test.ts

@@ -9,13 +9,13 @@ import type { AccessProfile, organizationState } from '~/types/interfaces'
 import { LINK_TARGET } from '~/types/enum/enums'
 import { LINK_TARGET } from '~/types/enum/enums'
 
 
 class TestableAbstractMenuBuilder extends AbstractMenuBuilder {
 class TestableAbstractMenuBuilder extends AbstractMenuBuilder {
-  static readonly menuName = 'TestableMenu'
+  static override readonly menuName = 'TestableMenu'
 
 
   public build(): MenuItem | MenuGroup | null {
   public build(): MenuItem | MenuGroup | null {
     return { label: 'my_menu' }
     return { label: 'my_menu' }
   }
   }
 
 
-  public createGroup(
+  public override createGroup(
     label: string,
     label: string,
     icon?: IconItem,
     icon?: IconItem,
     children: MenuItems = [],
     children: MenuItems = [],
@@ -24,7 +24,7 @@ class TestableAbstractMenuBuilder extends AbstractMenuBuilder {
     return super.createGroup(label, icon, children, actions)
     return super.createGroup(label, icon, children, actions)
   }
   }
 
 
-  public createItem(
+  public override createItem(
     label: string,
     label: string,
     icon?: IconItem,
     icon?: IconItem,
     to: string = '',
     to: string = '',
@@ -33,11 +33,11 @@ class TestableAbstractMenuBuilder extends AbstractMenuBuilder {
     return super.createItem(label, icon, to, type)
     return super.createItem(label, icon, to, type)
   }
   }
 
 
-  public buildSubmenu(menuBuilder: typeof AbstractMenuBuilder) {
+  public override buildSubmenu(menuBuilder: typeof AbstractMenuBuilder) {
     return super.buildSubmenu(menuBuilder)
     return super.buildSubmenu(menuBuilder)
   }
   }
 
 
-  public makeChildren(items: Array<{ pageName: string; icon?: string }>) {
+  public override makeChildren(items: Array<{ pageName: string; icon?: string }>) {
     return super.makeChildren(items)
     return super.makeChildren(items)
   }
   }
 }
 }

+ 1 - 0
tests/units/services/layout/menuBuilder/accessMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, beforeEach, vi } from 'vitest'
 import { describe, test, expect, beforeEach, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/accountMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, expect, test, beforeEach, vi } from 'vitest'
 import { describe, expect, test, beforeEach, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/admin2iosMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, beforeEach, vi } from 'vitest'
 import { describe, test, expect, beforeEach, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/agendaMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/billingMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/communicationMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 3 - 0
tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, vi, expect, beforeEach } from 'vitest'
 import { describe, test, vi, expect, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
@@ -23,6 +24,8 @@ beforeEach(() => {
   router = vi.fn() as Router
   router = vi.fn() as Router
 
 
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
   runtimeConfig.baseUrlAdminLegacy = 'https://mydomain.com/'
+
+  //@ts-expect-error problème de typage sans conséquence
   router.resolve = vi.fn(() => {
   router.resolve = vi.fn(() => {
     return 'some_route'
     return 'some_route'
   })
   })

+ 1 - 0
tests/units/services/layout/menuBuilder/cotisationsMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/donorsMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/educationalMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/equipmentMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 2 - 1
tests/units/services/layout/menuBuilder/mainMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
@@ -14,7 +15,7 @@ import EducationalMenuBuilder from '~/services/layout/menuBuilder/educationalMen
 import BillingMenuBuilder from '~/services/layout/menuBuilder/billingMenuBuilder'
 import BillingMenuBuilder from '~/services/layout/menuBuilder/billingMenuBuilder'
 import CommunicationMenuBuilder from '~/services/layout/menuBuilder/communicationMenuBuilder'
 import CommunicationMenuBuilder from '~/services/layout/menuBuilder/communicationMenuBuilder'
 import DonorsMenuBuilder from '~/services/layout/menuBuilder/donorsMenuBuilder'
 import DonorsMenuBuilder from '~/services/layout/menuBuilder/donorsMenuBuilder'
-import RewardsMenuBuilder from '~/services/layout/menuBuilder/rewardsMenuBuilder'
+import { RewardsMenuBuilder } from '~/services/layout/menuBuilder/rewardsMenuBuilder'
 import WebsiteAdminMenuBuilder from '~/services/layout/menuBuilder/websiteAdminMenuBuilder'
 import WebsiteAdminMenuBuilder from '~/services/layout/menuBuilder/websiteAdminMenuBuilder'
 import CotisationsMenuBuilder from '~/services/layout/menuBuilder/cotisationsMenuBuilder'
 import CotisationsMenuBuilder from '~/services/layout/menuBuilder/cotisationsMenuBuilder'
 import StatsMenuBuilder from '~/services/layout/menuBuilder/statsMenuBuilder'
 import StatsMenuBuilder from '~/services/layout/menuBuilder/statsMenuBuilder'

+ 1 - 0
tests/units/services/layout/menuBuilder/myAccessesMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/myFamilyMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, expect, test, vi, beforeEach } from 'vitest'
 import { describe, expect, test, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 3 - 2
tests/units/services/layout/menuBuilder/parametersMenuBuilder.test.ts

@@ -1,6 +1,7 @@
 import { AssertionError } from 'node:assert'
 import { AssertionError } from 'node:assert'
 import { describe, test, expect, beforeEach, vi } from 'vitest'
 import { describe, test, expect, beforeEach, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error problème de typage sans conséquence
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
@@ -8,7 +9,7 @@ import ParametersMenuBuilder from '~/services/layout/menuBuilder/parametersMenuB
 import type { IconItem, MenuGroup, MenuItem, MenuItems } from '~/types/layout'
 import type { IconItem, MenuGroup, MenuItem, MenuItems } from '~/types/layout'
 
 
 class TestableParametersMenuBuilder extends ParametersMenuBuilder {
 class TestableParametersMenuBuilder extends ParametersMenuBuilder {
-  public createGroup(
+  public override createGroup(
     label: string,
     label: string,
     icon?: IconItem,
     icon?: IconItem,
     children: MenuItems = [],
     children: MenuItems = [],
@@ -17,7 +18,7 @@ class TestableParametersMenuBuilder extends ParametersMenuBuilder {
     return super.createGroup(label, icon, children, actions)
     return super.createGroup(label, icon, children, actions)
   }
   }
 
 
-  public makeChildren(items: Array<{ pageName: string; icon?: string }>) {
+  public override makeChildren(items: Array<{ pageName: string; icon?: string }>) {
     return super.makeChildren(items)
     return super.makeChildren(items)
   }
   }
 }
 }

+ 1 - 0
tests/units/services/layout/menuBuilder/statsMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/websiteAdminMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuBuilder/websiteListMenuBuilder.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import type { AccessProfile, organizationState } from '~/types/interfaces'
 import type { AccessProfile, organizationState } from '~/types/interfaces'

+ 1 - 0
tests/units/services/layout/menuComposer.test.ts

@@ -1,5 +1,6 @@
 import { describe, test, expect, vi } from 'vitest'
 import { describe, test, expect, vi } from 'vitest'
 import type { RuntimeConfig } from '@nuxt/schema'
 import type { RuntimeConfig } from '@nuxt/schema'
+//@ts-expect-error false error
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { AnyAbility } from '@casl/ability/dist/types'
 import type { Router } from 'vue-router'
 import type { Router } from 'vue-router'
 import MenuComposer from '~/services/layout/menuComposer'
 import MenuComposer from '~/services/layout/menuComposer'

+ 4 - 3
tests/units/services/rights/abilityBuilder.test.ts

@@ -1,16 +1,17 @@
 import { describe, test, expect, vi, beforeEach } from 'vitest'
 import { describe, test, expect, vi, beforeEach } from 'vitest'
+//@ts-expect-error false error
 import type { MongoAbility } from '@casl/ability/dist/types/Ability'
 import type { MongoAbility } from '@casl/ability/dist/types/Ability'
 import type {
 import type {
   AbilitiesType,
   AbilitiesType,
   AccessProfile,
   AccessProfile,
-  organizationState,
 } from '~/types/interfaces'
 } from '~/types/interfaces'
 import AbilityBuilder from '~/services/rights/abilityBuilder'
 import AbilityBuilder from '~/services/rights/abilityBuilder'
 import { ABILITIES } from '~/types/enum/enums'
 import { ABILITIES } from '~/types/enum/enums'
+import type OrganizationProfile from '~/models/Organization/OrganizationProfile'
 
 
 let ability: MongoAbility
 let ability: MongoAbility
 let accessProfile: AccessProfile
 let accessProfile: AccessProfile
-let organizationProfile: organizationState
+let organizationProfile: OrganizationProfile
 let abilityBuilder: AbilityBuilder
 let abilityBuilder: AbilityBuilder
 
 
 // Mock the content of the config yaml files
 // Mock the content of the config yaml files
@@ -47,7 +48,7 @@ vi.mock('yaml-import', () => {
 beforeEach(() => {
 beforeEach(() => {
   ability = vi.fn() as any as MongoAbility
   ability = vi.fn() as any as MongoAbility
   accessProfile = vi.fn() as any as AccessProfile
   accessProfile = vi.fn() as any as AccessProfile
-  organizationProfile = vi.fn() as any as organizationState
+  organizationProfile = vi.fn() as any as OrganizationProfile
 
 
   abilityBuilder = new AbilityBuilder(
   abilityBuilder = new AbilityBuilder(
     ability,
     ability,

+ 2 - 2
types/data.d.ts

@@ -31,12 +31,12 @@ interface HydraMetadata {
 }
 }
 
 
 interface ApiResponse {
 interface ApiResponse {
-  data: AnyJson
+  data: AnyJson | ApiResource | (AnyJson | ApiResource)[]
   metadata: HydraMetadata
   metadata: HydraMetadata
 }
 }
 
 
 interface ApiCollection extends ApiResponse {
 interface ApiCollection extends ApiResponse {
-  data: AnyJson
+  data: AnyJson[]
   metadata: HydraMetadata
   metadata: HydraMetadata
 }
 }
 
 

+ 6 - 0
types/interfaces.d.ts

@@ -163,6 +163,12 @@ interface DolibarrBill {
   paid: boolean
   paid: boolean
 }
 }
 
 
+interface DolibarrOrder {
+  id: number
+  ref: string
+  date: Date
+}
+
 interface DolibarrAccount {
 interface DolibarrAccount {
   organizationId: number
   organizationId: number
   socId: number
   socId: number