Skip to content

Commit 6b36a55

Browse files
authored
Merge pull request #57 from ungdev/dev
Dev to prod
2 parents 7067071 + ec68a13 commit 6b36a55

26 files changed

Lines changed: 4376 additions & 757 deletions

backend/src/controllers/event.controller.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export const checkFoodStatus = async (req: Request, res: Response) => {
5555
}
5656
};
5757

58+
export const checkChallStatus = async (req: Request, res: Response) => {
59+
try{
60+
const status = await event_service.getEventsStatus();
61+
Ok(res, ({data: status?.chall_open}));
62+
63+
}catch(error){
64+
Error(res, {msg :"Error while catching Challenge status :" + error})
65+
}
66+
};
67+
5868

5969
export const shotgunAttempt = async (req: Request, res: Response) => {
6070

@@ -142,4 +152,15 @@ export const toggleFood = async (req: Request, res: Response) => {
142152
} catch (error) {
143153
Error(res,{ msg: "Erreur lors de la mise à jour." });
144154
}
155+
};
156+
157+
export const toggleChall = async (req: Request, res: Response) => {
158+
const { challOpen } = req.body;
159+
160+
try {
161+
const result = await event_service.updateChallStatus(challOpen);
162+
Ok(res,{ msg: "Paramètres mis à jour.", data: result });
163+
} catch (error) {
164+
Error(res,{ msg: "Erreur lors de la mise à jour." });
165+
}
145166
};

backend/src/controllers/user.controller.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Request, Response } from "express";
55
import bcrypt from 'bcryptjs';
66
import * as randomstring from 'randomstring';
77
import * as auth_service from "../services/auth.service"
8+
import { noSyncEmails } from '../utils/no_sync_list';
89

910
export const getUsersAdmin = async (req: Request, res: Response) => {
1011
try {
@@ -53,9 +54,9 @@ export const syncNewstudent = async (req: Request, res: Response) => {
5354

5455
const token = await SIEP_Utils.getTokenUTTAPI();
5556
const newStudents = await SIEP_Utils.getNewStudentsFromUTTAPI_NOPAGE(token, date);
56-
//const newStudentfiltered = newStudents.filter((student : any) => !noSyncEmails.includes(student.email));
57+
const newStudentfiltered = newStudents.filter((student : any) => !noSyncEmails.includes(student.email));//Nouveau à ne pas sync (Démissionnaires, etc)
5758

58-
for (const element of newStudents) {
59+
for (const element of newStudentfiltered) {
5960

6061
let userInDb = await user_service.getUserByEmail(element.email.toLowerCase());
6162
if(userInDb === undefined){
@@ -129,6 +130,3 @@ export const adminDeleteUser = async (req: Request, res: Response) => {
129130
Error(res, { msg: "Erreur lors de la suppression de l'utilisateur." });
130131
}
131132
};
132-
133-
134-

backend/src/database/initdb/initevent.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ export const initEvent = async () => {
66

77
// Si il n'y a pas de ligne existante, insérer une nouvelle ligne
88
if (existingEvent.length === 0) {
9-
await db.insert(eventSchema).values({ pre_registration_open: false, shotgun_open: false, sdi_open: false, wei_open: false, food_open : false }).onConflictDoNothing();
9+
await db.insert(eventSchema).values({
10+
pre_registration_open: false,
11+
shotgun_open: false,
12+
sdi_open: false,
13+
wei_open: false,
14+
food_open : false,
15+
chall_open : false }).onConflictDoNothing();
1016
}
1117
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "events" ADD COLUMN "chall_open" boolean DEFAULT false;

0 commit comments

Comments
 (0)