This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
191305b
commit 811ab87
Showing
15 changed files
with
427 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export class AbsenceEleveAppel { | ||
public idAbsence: number|undefined | ||
public type: string | ||
public dateDebut: Date | ||
public dateFin: Date | ||
public idMotif: string|undefined | ||
public modifiable: boolean | ||
public idEleve:string|undefined | ||
|
||
constructor (absenceEleveAppel:{ | ||
idEleve:string|undefined | ||
idAbsence:number|undefined | ||
type:string | ||
dateDebut:number | ||
dateFin:number | ||
idMotif:string|undefined | ||
modifiable:boolean | ||
}) { | ||
this.idAbsence = absenceEleveAppel.idAbsence | ||
this.type = absenceEleveAppel.type | ||
this.dateDebut = new Date(absenceEleveAppel.dateDebut) | ||
this.dateFin = new Date(absenceEleveAppel.dateFin) | ||
this.idMotif = absenceEleveAppel.idMotif | ||
this.modifiable = absenceEleveAppel.modifiable | ||
this.idEleve = absenceEleveAppel.idEleve | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { EleveAppel } from './EleveAppel' | ||
|
||
export class Appel { | ||
public isEnCours: boolean | ||
public dateDebut: Date | ||
public dateFin: Date | ||
public idAppel:number | ||
public libelleGroupe:string | ||
public listeElevesAppel:EleveAppel[] = [] | ||
|
||
constructor (appel:{ | ||
isEnCours:boolean | ||
dateDebut:number | ||
dateFin:number | ||
idAppel:number | ||
libelleGroupe:string | ||
listeElevesAppel:{ | ||
nomEleve: string | ||
prenomEleve: string | ||
idEleve: string | ||
absenceEleveAppel: { | ||
idEleve:string|undefined | ||
idAbsence:number|undefined | ||
type:string | ||
dateDebut:number | ||
dateFin:number | ||
idMotif:string|undefined | ||
modifiable:boolean | ||
} | undefined | ||
}[] | ||
}) { | ||
this.isEnCours = appel.isEnCours | ||
this.dateDebut = new Date(appel.dateDebut) | ||
this.dateFin = new Date(appel.dateFin) | ||
this.idAppel = appel.idAppel | ||
this.libelleGroupe = appel.libelleGroupe | ||
appel.listeElevesAppel.forEach(eleveAppel => this.listeElevesAppel.push(new EleveAppel(eleveAppel))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AbsenceEleveAppel } from './AbsenceEleveAppel' | ||
|
||
export class EleveAppel { | ||
public nomEleve: string | ||
public prenomEleve: string | ||
public idEleve: string | ||
public absenceEleveAppel: AbsenceEleveAppel | undefined | ||
|
||
constructor (eleveAppel: { | ||
nomEleve: string | ||
prenomEleve: string | ||
idEleve: string | ||
absenceEleveAppel: { | ||
idEleve:string|undefined | ||
idAbsence:number|undefined | ||
type:string | ||
dateDebut:number | ||
dateFin:number | ||
idMotif:string|undefined | ||
modifiable:boolean | ||
} | undefined | ||
}) { | ||
this.nomEleve = eleveAppel.nomEleve | ||
this.prenomEleve = eleveAppel.prenomEleve | ||
this.idEleve = eleveAppel.idEleve | ||
if (eleveAppel.absenceEleveAppel) this.absenceEleveAppel = new AbsenceEleveAppel(eleveAppel.absenceEleveAppel) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Appel } from './Appel' | ||
|
||
export class GestionAppels { | ||
public dateDuJour: Date | ||
public listeAppels: Appel[] = [] | ||
|
||
constructor (gestionAppels: { | ||
dateDuJour: number | ||
listeAppels: { | ||
isEnCours: boolean | ||
dateDebut: number | ||
dateFin: number | ||
idAppel: number | ||
libelleGroupe: string | ||
listeElevesAppel: { | ||
nomEleve: string | ||
prenomEleve: string | ||
idEleve: string | ||
absenceEleveAppel: { | ||
idEleve:string|undefined | ||
idAbsence:number|undefined | ||
type:string | ||
dateDebut:number | ||
dateFin:number | ||
idMotif:string|undefined | ||
modifiable:boolean | ||
} | undefined | ||
}[] | ||
}[] | ||
}) { | ||
this.dateDuJour = new Date(gestionAppels.dateDuJour) | ||
gestionAppels.listeAppels.forEach(appel => this.listeAppels.push(new Appel(appel))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import axios from 'axios' | ||
import {APP_VERSION, BASE_URL} from "../../dist/config.js" | ||
import {GestionAppels} from "../../dist/entities/Prof/GestionAppels" | ||
|
||
const Kdecole = require('../../dist/Kdecole.js').default | ||
|
||
const authToken = '0AnemIFGvcORx88ESDrvIflY0qRV2ussl0n31tC5Sh2U6xDZJ0E3VrD1RYzrWGX3rYUZK4nI3wLnbxZYQi2sKXMrGbgxIuq2ewjOpRYfWLSP0mLFK3D3CZVu7Ev2s' | ||
const user = new Kdecole(authToken, APP_VERSION, 10485) | ||
|
||
jest.mock('axios') | ||
axios.request.mockResolvedValue({ | ||
data: require('../fakeData/Prof/fakeGestionAppels.json') | ||
}) | ||
|
||
describe('Test valider appel', () => { | ||
beforeEach(() => { | ||
axios.mockClear() | ||
}) | ||
it('should call the right url and return appels', async () => { | ||
expect(await user.gestionAppels()).toBeInstanceOf(GestionAppels) | ||
expect(axios.request).toBeCalledWith({ | ||
"baseURL": BASE_URL, | ||
"data": undefined, | ||
"headers": {"X-Kdecole-Auth": authToken, "X-Kdecole-Vers": APP_VERSION}, | ||
"method": "get", | ||
"responseType": "json", | ||
"url": "/gestionAppels/idetablissement/10485/" | ||
}) | ||
}) | ||
it('should validate appel', async () => { | ||
await user.validerAppel(require('../fakeData/Prof/fakeValiderAppel.json')) | ||
expect(axios.request).toBeCalledWith({ | ||
"baseURL": BASE_URL, | ||
"data": require('../fakeData/Prof/fakeValiderAppel.json'), | ||
"headers": {"X-Kdecole-Auth": authToken, "X-Kdecole-Vers": APP_VERSION}, | ||
"method": "put", | ||
"responseType": "json", | ||
"url": "/gestionAppels/idetablissement/10485/valider/" | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"dateDuJour": 1609260058, | ||
"listeAppels": [ | ||
{ | ||
"isEnCours": true, | ||
"dateDebut": 1609260058, | ||
"dateFin": 1609263658, | ||
"idAppel": 524545, | ||
"libelleGroupe": "1ERE1", | ||
"listeElevesAppel": [ | ||
{ | ||
"nomEleve": "DOE", | ||
"prenomEleve": "John", | ||
"idEleve": "AAP05567", | ||
"absenceEleveAppel": { | ||
"idAbsence": 54542, | ||
"type": "retard", | ||
"dateDebut": 1609260058, | ||
"dateFin": 1609260500, | ||
"idMotif": "Transport scolaire", | ||
"modifiable": true | ||
} | ||
}, | ||
{ | ||
"nomEleve": "Luc", | ||
"prenomEleve": "DUPONT", | ||
"idEleve": "AAP05568" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"idEtab": 10485, | ||
"idAppel": 534552, | ||
"listeAbsencesAppel": [ | ||
{ | ||
"idEleve": "AAP05567", | ||
"type": "absence", | ||
"dateDebut": 1609259443000, | ||
"dateFin": 1609263043000, | ||
"modifiable": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.