codevdesign 1.0.31 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/assets/csqc.css +259 -0
  2. package/composants/csqcAide.vue +55 -0
  3. package/composants/csqcAlerteErreur.vue +87 -0
  4. package/composants/csqcChaise/chaiseConteneur.vue +367 -0
  5. package/composants/csqcChaise/chaiseItem.vue +54 -0
  6. package/composants/csqcCodeBudgetaireGenerique.vue +336 -0
  7. package/composants/csqcConfirmation.vue +75 -0
  8. package/composants/csqcDate.vue +57 -0
  9. package/composants/csqcDialogue.vue +118 -0
  10. package/composants/csqcEditeurTexteRiche.vue +380 -0
  11. package/composants/csqcEntete.vue +163 -0
  12. package/composants/csqcImportCSV.vue +125 -0
  13. package/composants/csqcModaleSaisie.vue +95 -0
  14. package/composants/csqcOptionSwitch.vue +120 -0
  15. package/composants/csqcRecherche.vue +213 -0
  16. package/composants/csqcRechercheUtilisateur.vue +197 -0
  17. package/composants/csqcSnackbar.vue +88 -0
  18. package/composants/csqcTable/csqcTable.vue +383 -0
  19. package/composants/csqcTable/csqcTableExportExcel.vue +58 -0
  20. package/composants/csqcTable/csqcTableModaleChoixColonnes.vue +586 -0
  21. package/composants/csqcTexteBilingue.vue +175 -0
  22. package/composants/csqcTiroir.vue +156 -0
  23. package/composants/gabarit/csqcMenu.vue +281 -0
  24. package/composants/gabarit/pivEntete.vue +205 -0
  25. package/composants/gabarit/pivPiedPage.vue +70 -0
  26. package/composants/gabarit/vueDefault.vue +5 -0
  27. package/composants/validateurs.ts +183 -0
  28. package/enums/choixLangue.ts +10 -0
  29. package/index.ts +74 -0
  30. package/locales/en.json +100 -0
  31. package/locales/fr.json +101 -0
  32. package/modeles/apiReponse.ts +12 -0
  33. package/modeles/assurancesAssuranceGeneraleGrics.ts +10 -0
  34. package/modeles/assurancesAssurancePersonnelleGrics.ts +13 -0
  35. package/modeles/assurancesContratGrics.ts +14 -0
  36. package/modeles/assurancesDetailsPrimeReguliereGrics.ts +12 -0
  37. package/modeles/assurancesDonneesAssureurGrics.ts +13 -0
  38. package/modeles/assurancesEmployeGrics.ts +11 -0
  39. package/modeles/assurancesGrics.ts +14 -0
  40. package/modeles/assurancesRegimeAssuranceGrics.ts +9 -0
  41. package/modeles/assurancesRegimeBaseEmployeurGrics.ts +9 -0
  42. package/modeles/assurancesRegimeBaseGrics.ts +9 -0
  43. package/modeles/composants/csqcMenuModele.ts +18 -0
  44. package/modeles/composants/datatableColonne.ts +31 -0
  45. package/modeles/composants/snackbar.ts +18 -0
  46. package/modeles/data.ts +24 -0
  47. package/modeles/droitIntervention.ts +14 -0
  48. package/modeles/employeAdresseGrics.ts +13 -0
  49. package/modeles/employeAdressesPersonnellesGrics.ts +12 -0
  50. package/modeles/employeAffectationCorpsEmploiGrics.ts +9 -0
  51. package/modeles/employeBanquesCongeBanqueGrics.ts +9 -0
  52. package/modeles/employeBanquesCongeGrics.ts +14 -0
  53. package/modeles/employeBanquesCongeRegimeAbsenceGrics.ts +9 -0
  54. package/modeles/employeCourrielsPersonnels.ts +9 -0
  55. package/modeles/employeCourrielsProfessionnels.ts +9 -0
  56. package/modeles/employeEmploisCategorieGrics.ts +9 -0
  57. package/modeles/employeEmploisClasseGrics.ts +9 -0
  58. package/modeles/employeEmploisCorpsEmploiGrics.ts +9 -0
  59. package/modeles/employeEmploisEtatEmploiGrics.ts +9 -0
  60. package/modeles/employeEmploisGrics.ts +37 -0
  61. package/modeles/employeEmploisGroupePaieGrics.ts +9 -0
  62. package/modeles/employeEmploisLieuTravailPrincipalGrics.ts +10 -0
  63. package/modeles/employeEmploisLieuxTravailSecondairesGrics.ts +10 -0
  64. package/modeles/employeEmploisRegimeAbsenceGrics.ts +9 -0
  65. package/modeles/employeEmploisSecteurGrics.ts +9 -0
  66. package/modeles/employeEmploisStatutEngagementGrics.ts +9 -0
  67. package/modeles/employeExperienceEmploiGrics.ts +9 -0
  68. package/modeles/employeExperienceEmployeGrics.ts +12 -0
  69. package/modeles/employeExperienceExperiencesGrics.ts +11 -0
  70. package/modeles/employeExperienceExperiencesTotalesGrics.ts +15 -0
  71. package/modeles/employeExperienceGrics.ts +17 -0
  72. package/modeles/employeGrics.ts +31 -0
  73. package/modeles/employeMinsLsCodev.ts +10 -0
  74. package/modeles/employeTelephoneGrics.ts +12 -0
  75. package/modeles/employeTelephonesPersonnelsGrics.ts +11 -0
  76. package/modeles/employeTelephonesProfessionnelsGrics.ts +11 -0
  77. package/modeles/groupeCE.ts +14 -0
  78. package/modeles/groupeCEIntervalle.ts +13 -0
  79. package/modeles/historiquesAbsenceBanqueGrics.ts +9 -0
  80. package/modeles/historiquesAbsenceGrics.ts +21 -0
  81. package/modeles/historiquesAbsenceLieuTravailGrics.ts +9 -0
  82. package/modeles/historiquesAbsenceSousBanqueGrics.ts +9 -0
  83. package/modeles/intervention.ts +35 -0
  84. package/modeles/motifsAbsenceBanque.ts +9 -0
  85. package/modeles/motifsAbsenceGrics.ts +17 -0
  86. package/modeles/motifsAbsenceRegimeAbsence.ts +9 -0
  87. package/modeles/motifsAbsenceSousMotifs.ts +9 -0
  88. package/modeles/motifsAbsenceTraitementBanques.ts +11 -0
  89. package/modeles/notificationGabaritDefaut.ts +10 -0
  90. package/modeles/response.ts +12 -0
  91. package/modeles/role.ts +31 -0
  92. package/modeles/roleMin.ts +12 -0
  93. package/modeles/syndicat.ts +26 -0
  94. package/modeles/syndicatGroupeCe.ts +10 -0
  95. package/modeles/syndicatResponsable.ts +15 -0
  96. package/modeles/syndicatUnite.ts +10 -0
  97. package/modeles/typeEnseignement.ts +14 -0
  98. package/modeles/typeTelephone.ts +12 -0
  99. package/modeles/unite.ts +23 -0
  100. package/modeles/uniteTypeEnseignement.ts +12 -0
  101. package/modeles/utilisateur.ts +15 -0
  102. package/outils/appAxios.ts +116 -0
  103. package/outils/csqcOutils.ts +366 -0
  104. package/outils/rafraichisseurToken.ts +187 -0
  105. package/package.json +11 -15
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { EmployeExperienceEmployeGrics } from "./employeExperienceEmployeGrics";
7
+ import type { EmployeExperienceExperiencesTotalesGrics } from "./employeExperienceExperiencesTotalesGrics";
8
+
9
+ export interface EmployeExperienceGrics {
10
+ employe: EmployeExperienceEmployeGrics;
11
+ experiencesTotales: EmployeExperienceExperiencesTotalesGrics[];
12
+ dateConsignee: string;
13
+ dateCalculPonctuel: string;
14
+ dateCalculAnnuel: string;
15
+ dateDebutCongeMaternite: string;
16
+ nombreSemainesAccordées: number;
17
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { EmployeAdressesPersonnellesGrics } from "./employeAdressesPersonnellesGrics";
7
+ import type { EmployeTelephonesPersonnelsGrics } from "./employeTelephonesPersonnelsGrics";
8
+ import type { EmployeTelephonesProfessionnelsGrics } from "./employeTelephonesProfessionnelsGrics";
9
+ import type { EmployeCourrielsPersonnels } from "./employeCourrielsPersonnels";
10
+ import type { EmployeCourrielsProfessionnels } from "./employeCourrielsProfessionnels";
11
+ import type { EmployeEmploisGrics } from "./employeEmploisGrics";
12
+
13
+ export interface EmployeGrics {
14
+ id: string;
15
+ nom: string;
16
+ prenom: string;
17
+ adressesPersonnelles: EmployeAdressesPersonnellesGrics[];
18
+ telephonesPersonnels: EmployeTelephonesPersonnelsGrics[];
19
+ telephonesProfessionnels: EmployeTelephonesProfessionnelsGrics[];
20
+ courrielsPersonnels: EmployeCourrielsPersonnels[];
21
+ courrielsProfessionnels: EmployeCourrielsProfessionnels[];
22
+ sexe: string;
23
+ dateNaissance: string;
24
+ dateEntree: string;
25
+ dateEngagement: string;
26
+ dateFinPeriodeEssai: string;
27
+ dateCessationDefinitive: string;
28
+ dateDebutServiceContinu: string;
29
+ dateFinServiceContinu: string;
30
+ emploiPrincipal: EmployeEmploisGrics;
31
+ }
@@ -0,0 +1,10 @@
1
+ export interface EmployeMinsLsCodev {
2
+ nom: string
3
+ prenom: string
4
+ courrielProfessionnel: string
5
+ matricule: string
6
+ numeroLieuPrincipal: string
7
+ nomLieuPrincipal: string
8
+ corpsEmploiPrincipalDescription: string
9
+ corpsEmploiPrincipal: string
10
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { TypeTelephone } from "./typeTelephone";
7
+
8
+ export interface EmployeTelephoneGrics {
9
+ numero: string;
10
+ poste: string;
11
+ typeTelephone: TypeTelephone;
12
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { EmployeTelephoneGrics } from "./employeTelephoneGrics";
7
+
8
+ export interface EmployeTelephonesPersonnelsGrics {
9
+ description: string;
10
+ telephone: EmployeTelephoneGrics;
11
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { EmployeTelephoneGrics } from "./employeTelephoneGrics";
7
+
8
+ export interface EmployeTelephonesProfessionnelsGrics {
9
+ description: string;
10
+ telephone: EmployeTelephoneGrics;
11
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { GroupeCEIntervalle } from "./groupeCEIntervalle";
7
+
8
+ export interface GroupeCE {
9
+ id: number;
10
+ commissionScolaireId: number;
11
+ nom: string;
12
+ groupeCEIntervalles: GroupeCEIntervalle[];
13
+ parentId: number;
14
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface GroupeCEIntervalle {
7
+ id: number;
8
+ corpsEmploiMin: string;
9
+ corpsEmploiMax: string;
10
+ groupeCEId: number;
11
+ min: number;
12
+ max: number;
13
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export class HistoriquesAbsenceBanqueGrics {
7
+ id: string;
8
+ description: string;
9
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { HistoriquesAbsenceLieuTravailGrics } from "./historiquesAbsenceLieuTravailGrics";
7
+ import type { HistoriquesAbsenceBanqueGrics } from "./historiquesAbsenceBanqueGrics";
8
+ import type { HistoriquesAbsenceSousBanqueGrics } from "./historiquesAbsenceSousBanqueGrics";
9
+
10
+ export interface HistoriquesAbsenceGrics {
11
+ id: number;
12
+ idMotifAbsence: string;
13
+ date: string;
14
+ heureFin: string;
15
+ heureDebut: string;
16
+ duree: number;
17
+ idEmploi: string;
18
+ lieuTravail: HistoriquesAbsenceLieuTravailGrics;
19
+ banque: HistoriquesAbsenceBanqueGrics;
20
+ sousBanque: HistoriquesAbsenceSousBanqueGrics;
21
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export class HistoriquesAbsenceLieuTravailGrics {
7
+ id: string;
8
+ description: string;
9
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export class HistoriquesAbsenceSousBanqueGrics {
7
+ id: string;
8
+ description: string;
9
+ }
@@ -0,0 +1,35 @@
1
+ class Intervention {
2
+ id: number
3
+ demandeId: number
4
+ uniteId: number
5
+ chaiseId?: number
6
+ niveauChaise?: number
7
+ typeIntervenant: number
8
+ utilisateurIdAyantIntervenu?: number
9
+ dateIntervention?: Date
10
+ etat: number
11
+
12
+ constructor(
13
+ id: number = 0,
14
+ demandeId: number = 0,
15
+ uniteId: number = 0,
16
+ typeIntervenant: number = 0,
17
+ etat: number = 0,
18
+ chaiseId?: number,
19
+ niveauChaise?: number,
20
+ utilisateurIdAyantIntervenu?: number,
21
+ dateIntervention?: Date,
22
+ ) {
23
+ this.id = id
24
+ this.demandeId = demandeId
25
+ this.uniteId = uniteId
26
+ this.typeIntervenant = typeIntervenant
27
+ this.etat = etat
28
+ this.chaiseId = chaiseId
29
+ this.niveauChaise = niveauChaise
30
+ this.utilisateurIdAyantIntervenu = utilisateurIdAyantIntervenu
31
+ this.dateIntervention = dateIntervention
32
+ }
33
+ }
34
+
35
+ export default Intervention
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface MotifsAbsenceBanque {
7
+ id: string;
8
+ description: string;
9
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { MotifsAbsenceRegimeAbsence } from "./motifsAbsenceRegimeAbsence";
7
+ import type { MotifsAbsenceSousMotifs } from "./motifsAbsenceSousMotifs";
8
+ import type { MotifsAbsenceTraitementBanques } from "./motifsAbsenceTraitementBanques";
9
+
10
+ export interface MotifsAbsenceGrics {
11
+ id: string;
12
+ description: string;
13
+ actif: boolean;
14
+ regimeAbsence: MotifsAbsenceRegimeAbsence;
15
+ sousMotifs: MotifsAbsenceSousMotifs[];
16
+ traitementBanques: MotifsAbsenceTraitementBanques[];
17
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface MotifsAbsenceRegimeAbsence {
7
+ id: string;
8
+ description: string;
9
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface MotifsAbsenceSousMotifs {
7
+ id: string;
8
+ description: string;
9
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { MotifsAbsenceBanque } from "./motifsAbsenceBanque";
7
+
8
+ export interface MotifsAbsenceTraitementBanques {
9
+ ordreTraitement: string;
10
+ banque: MotifsAbsenceBanque;
11
+ }
@@ -0,0 +1,10 @@
1
+ class NotificationGabaritDefaut {
2
+ message: string
3
+ sujet: string
4
+ constructor(message: string = '', sujet: string = '') {
5
+ this.message = message
6
+ this.sujet = sujet
7
+ }
8
+ }
9
+
10
+ export default NotificationGabaritDefaut
@@ -0,0 +1,12 @@
1
+ import data from './data'
2
+ class response {
3
+ public data: data | null
4
+ public status: number
5
+
6
+ constructor(data: data | null = null, status: number = 0) {
7
+ this.data = data
8
+ this.status = status
9
+ }
10
+ }
11
+
12
+ export default response
@@ -0,0 +1,31 @@
1
+ import RoleMin from './roleMin'
2
+
3
+ class Role extends RoleMin {
4
+ ordreAffichage: number
5
+ descriptionEn: string
6
+ descriptionFr: string
7
+ nomFr: string
8
+ nomEn: string
9
+ utilisateursId: string[]
10
+ constructor(
11
+ descriptionEn: string = '',
12
+ ordreAffichage: number = 0,
13
+ descriptionFr: string = '',
14
+ nomFr: string = '',
15
+ nomEn: string = '',
16
+ utilisateursId: string[] = [],
17
+ identifiant: string = '',
18
+ id: number = 0,
19
+ formulaireId: number = 0,
20
+ ) {
21
+ super(identifiant, id, formulaireId) // Appel au constructeur de la classe parente
22
+ this.descriptionEn = descriptionEn
23
+ this.ordreAffichage = ordreAffichage
24
+ this.descriptionFr = descriptionFr
25
+ this.nomFr = nomFr
26
+ this.nomEn = nomEn
27
+ this.utilisateursId = utilisateursId
28
+ }
29
+ }
30
+
31
+ export default Role
@@ -0,0 +1,12 @@
1
+ class RoleMin {
2
+ identifiant: string
3
+ formulaireId?: number
4
+ id: number
5
+ constructor(identifiant: string = '', id: number = 0, formulaireId: number = 0) {
6
+ this.id = id
7
+ this.identifiant = identifiant
8
+ this.formulaireId = formulaireId
9
+ }
10
+ }
11
+
12
+ export default RoleMin
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { SyndicatGroupeCe } from "./syndicatGroupeCe";
7
+ import type { SyndicatResponsable } from "./syndicatResponsable";
8
+ import type { SyndicatUnite } from "./syndicatUnite";
9
+
10
+ export interface Syndicat {
11
+ id: number;
12
+ cSSId: number;
13
+ nom: string;
14
+ description: string;
15
+ estActif: boolean;
16
+ courriel: string;
17
+ adresse: string;
18
+ local: string;
19
+ telephone: string;
20
+ lienSiteWeb: string;
21
+ lienConventionCollective: string;
22
+ lienPlanClassification: string;
23
+ syndicatGroupeCEs: SyndicatGroupeCe[];
24
+ responsables: SyndicatResponsable[];
25
+ unites: SyndicatUnite[];
26
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface SyndicatGroupeCe {
7
+ id: number;
8
+ syndicatId: number;
9
+ groupeCEId: number;
10
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface SyndicatResponsable {
7
+ id: number;
8
+ nom: string;
9
+ prenom: string;
10
+ courriel: string;
11
+ responsablePrincipal: boolean;
12
+ syndicatId: number;
13
+ utilisateurId: number;
14
+ poste: string;
15
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export class SyndicatUnite {
7
+ id: number;
8
+ syndicatId: number;
9
+ uniteId: number;
10
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export enum TypeEnseignement {
7
+ Prescolaire4ans = 0,
8
+ Prescolaire5ans = 1,
9
+ Primaire = 2,
10
+ Secondaire = 3,
11
+ FP = 4,
12
+ FGA = 5,
13
+ ServiceAdmin = 6,
14
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export enum TypeTelephone {
7
+ telephone = 0,
8
+ mobile = 1,
9
+ telecopier = 2,
10
+ teleavertisseur = 3,
11
+ autre = 4,
12
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { UniteTypeEnseignement } from "./uniteTypeEnseignement";
7
+
8
+ export interface Unite {
9
+ id: number;
10
+ numero: string;
11
+ nom: string;
12
+ numeroEcoleJeune: string;
13
+ numeroCentreAdulte: string;
14
+ estActif: boolean;
15
+ typesEnseignementUnite: UniteTypeEnseignement[];
16
+ commissionScolaireId: number;
17
+ numeroNom: string;
18
+ nomNumero: string;
19
+ numeroEcoleJeuneStr: string;
20
+ numeroCentreAdulteStr: string;
21
+ estJeune: boolean;
22
+ estAdulte: boolean;
23
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ import type { TypeEnseignement } from "./typeEnseignement";
7
+
8
+ export interface UniteTypeEnseignement {
9
+ id: number;
10
+ typeEnseignement: TypeEnseignement;
11
+ uniteId: number;
12
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This is a TypeGen auto-generated file.
3
+ * Any changes made to this file can be lost when this file is regenerated.
4
+ */
5
+
6
+ export interface Utilisateur {
7
+ id: number;
8
+ identifiant: string;
9
+ nom: string;
10
+ prenom: string;
11
+ courriel: string;
12
+ matricule: string;
13
+ commissionScolaireId: number;
14
+ langue: string;
15
+ }
@@ -0,0 +1,116 @@
1
+ import axios, { type AxiosInstance, type AxiosError, type AxiosResponse } from 'axios'
2
+ import { useAppStore } from '@/store/appStore'
3
+ import router from '@/router'
4
+
5
+ type ApiReponse<T = unknown> =
6
+ // Succès
7
+ | {
8
+ succes: true
9
+ resultat: T
10
+ status?: number
11
+ message?: string
12
+ location?: string
13
+ parametres?: unknown
14
+ [k: string]: unknown
15
+ }
16
+ // Échec (le backend peut quand même renvoyer resultat null/absent)
17
+ | {
18
+ succes: false
19
+ resultat?: unknown
20
+ status?: number
21
+ message?: string
22
+ location?: string
23
+ parametres?: unknown
24
+ [k: string]: unknown
25
+ }
26
+
27
+ let client: AxiosInstance | null = null
28
+ let cachedBaseUrl = '' // pour éviter de régénérer une instance axios si rien n’a changé
29
+
30
+ export default {
31
+ clearCache: false,
32
+
33
+ getAxios(): AxiosInstance {
34
+ // Singleton + clearCache
35
+ if (client && !this.clearCache) return client
36
+
37
+ const appStore = useAppStore()
38
+
39
+ const rawUrl = appStore.modeleCharger
40
+ ? appStore.appModele!.urlBase
41
+ : window.location.origin + import.meta.env.BASE_URL
42
+
43
+ const urlBase = rawUrl.endsWith('/') ? rawUrl.slice(0, -1) : rawUrl
44
+
45
+ // Si la base URL n'a pas changé et qu'on a déjà un client, on le renvoie
46
+ if (client && cachedBaseUrl === urlBase && !this.clearCache) return client
47
+ cachedBaseUrl = urlBase
48
+
49
+ client = axios.create({
50
+ baseURL: `${urlBase}/api`,
51
+ withCredentials: true,
52
+ timeout: 30_000,
53
+ headers: {
54
+ Accept: 'application/json',
55
+ 'Content-Type': 'application/json',
56
+ 'X-Requested-With': 'XMLHttpRequest',
57
+ },
58
+ // validateStatus: (s) => s >= 200 && s < 300, // défaut axios
59
+ })
60
+
61
+ client.interceptors.response.use(
62
+ (response: AxiosResponse<any>) => {
63
+ const data = response.data
64
+
65
+ // Détection de la réponse { succes, resultat }
66
+ if (data && typeof data === 'object' && 'succes' in data) {
67
+ const env = data as ApiReponse
68
+ return env.succes === true ? env.resultat : Promise.reject(env)
69
+ }
70
+
71
+ // Sinon, renvoyer data si présent, sinon la réponse complète
72
+ return data ?? response
73
+ },
74
+
75
+ (error: AxiosError<any>) => {
76
+ const status = error.response?.status
77
+ const payload = error.response?.data?.resultat ?? { message: error.message }
78
+
79
+ // 403 / 404
80
+ if (status === 403 || status === 404) {
81
+ try {
82
+ appStore.lancerErreur(payload)
83
+ if (router.currentRoute.value.name !== '403') {
84
+ router.push({ name: '403' })
85
+ }
86
+ } catch {
87
+ // no-op
88
+ }
89
+ return Promise.reject(payload)
90
+ }
91
+
92
+ // gérer les autres 4XX ici
93
+
94
+ // Log minimal
95
+ console.error('HTTP error', {
96
+ status,
97
+ url: error.config?.url,
98
+ payload,
99
+ })
100
+
101
+ // Remonter l’erreur normalisée dans appstore
102
+ try {
103
+ if (payload?.resultat) appStore.lancerErreur(payload)
104
+ else if (payload) appStore.lancerErreur(payload)
105
+ } catch {
106
+ // no-op
107
+ }
108
+ return Promise.reject(payload)
109
+ },
110
+ )
111
+
112
+ // reset le flag si on l’avait utilisé pour forcer la recréation de l'instance
113
+ this.clearCache = false
114
+ return client
115
+ },
116
+ }