-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from BaptisteBuvron/recruteur_candidat
Fix:
- Loading branch information
Showing
18 changed files
with
326 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import {CandidatureRepository} from "../repository/CandidatureRepository"; | |
import {Candidature} from "../entity/Candidature"; | ||
import {StatutCandidatureEnum} from "../utils/StatutCandidatureEnum"; | ||
import {Piece} from "../entity/Piece"; | ||
import {PieceRepository} from "../repository/FichierRepository"; | ||
import {PieceRepository} from "../repository/PieceRepository"; | ||
import {loggedInNoRedirection} from "../passport/passportFunctions"; | ||
|
||
export class CandidatureController { | ||
|
@@ -64,7 +64,12 @@ export class CandidatureController { | |
|
||
} | ||
} | ||
res.render("candidater", {title: "Candidater", offer: offer, alerts: alerts, userLogged: loggedInNoRedirection(req, res)}); | ||
res.render("candidater", { | ||
title: "Candidater", | ||
offer: offer, | ||
alerts: alerts, | ||
userLogged: loggedInNoRedirection(req, res) | ||
}); | ||
|
||
} | ||
) | ||
|
@@ -73,12 +78,49 @@ export class CandidatureController { | |
}); | ||
} | ||
|
||
static async getFile(req: express.Request, res: express.Response) { | ||
let id = req.params.id; | ||
//TODO vérifier que l'utilisateur est bien un candidat ou un recruteur et qu'il a le droit d'accéder au fichier | ||
try { | ||
const piece = await PieceRepository.getById(Number(id)); | ||
if (!piece) { | ||
throw new Error("File not found"); | ||
} | ||
res.download(piece.url); | ||
} catch (err) { | ||
res.statusCode = 404; | ||
res.send("File not found"); | ||
} | ||
} | ||
|
||
static candidature(req: express.Request, res: express.Response) { | ||
let email = req.params.email; | ||
let offerNumber = req.params.numero; | ||
|
||
CandidatureRepository.getById(email, offerNumber).then((candidature) => { | ||
if (candidature) { | ||
return res.render("candidature", { | ||
title: "Candidature", | ||
candidature: candidature, | ||
userLogged: loggedInNoRedirection(req, res) | ||
}); | ||
} | ||
return res.redirect("/"); | ||
}).catch((err) => { | ||
return res.redirect("/"); | ||
}); | ||
|
||
} | ||
|
||
static candidatures(req: express.Request, res: express.Response) { | ||
//TODO Vérifier que l'utilisateur est bien un candidat | ||
let user: User = new User('[email protected]', 'Doe', 'John', '123456789', new Date(), true, 'password123', 'Candidat', 'En attente', null); | ||
let user: User = req.user as User; | ||
CandidatureRepository.getByUser(user).then((candidatures) => { | ||
res.render("candidatures", {title: "Mes candidatures", candidatures: candidatures, userLogged: loggedInNoRedirection(req, res)}); | ||
res.render("candidatures", { | ||
title: "Mes candidatures", | ||
candidatures: candidatures, | ||
userLogged: loggedInNoRedirection(req, res) | ||
}); | ||
|
||
}).catch((err) => { | ||
console.log(err); | ||
|
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
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.