-
Notifications
You must be signed in to change notification settings - Fork 0
Maker Battle Repartition (Admin & User faces) #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tuturd
merged 18 commits into
dev
from
146-feature-tc-branches-challenges-team-repartition
Aug 30, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
76f533f
WIP: Maker Battle Frontend (Admin & User faces)
tuturd 73a2f4f
feat: distribute maker battle teams
Remi-pcn aeef3da
feat: api route for generating maker battle team (ca marché mais ca m…
Remi-pcn 509b203
feat: generate maker battle placement
Remi-pcn e5cdc75
feat: getme route
Remi-pcn 48009a0
feat: maker battle table and team in adminusers
Remi-pcn 992bd7c
fix: faction_id not in db when generating teams for more than 1 group
Remi-pcn 9141427
feat: json to csv utils + refactor bus and team members export
Remi-pcn a7143c3
fix: db
Remi-pcn e498d49
fix: leftJoin instead of innerJoin
tuturd eceb168
fix: use Ok returns
tuturd 8387c13
fix: makerbattleresponsedata format
tuturd db8f581
Merge branch 'dev' into 146-feature-tc-branches-challenges-team-repar…
tuturd bac0ec5
fix: adminSettings
tuturd f2970ed
feat: makerBattleGroup Card settings condition
tuturd dd6b38d
feat: remove MM newcomers from Branch MakerBattle
tuturd 21bac6e
fix: add first and last name to maker battle team export
Remi-pcn c5d02a6
Merge pull request #167 from ungdev/163-feature-uploads-exports-prote…
Remi-pcn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -162,23 +162,29 @@ export const updatePlannings: AppRequestHandler = async (_req, res) => { | |
| } | ||
| }; | ||
|
|
||
| export const exportUsersCSV: AppRequestHandler = async (_req, res) => { | ||
| export const exportBus: AppRequestHandler = async (_req, res) => { | ||
| try { | ||
| await export_service.exportUsersToCSV(); | ||
| Ok(res, { msg: 'CSV des bus généré' }); | ||
| const exportData = await export_service.exportBus(); | ||
| res.setHeader('Content-Type', 'application/json'); | ||
| res.setHeader('Content-Disposition', `attachment; filename="bus_${Date.now()}.json"`); | ||
|
|
||
| return res.status(200).json(exportData); | ||
| } catch (error) { | ||
| console.error(error); | ||
| Error(res, { msg: "Erreur lors de l'export CSV" }); | ||
| return Error(res, { msg: "Erreur lors de l'exportation des memsbres des équipes : " + error }); | ||
| } | ||
| }; | ||
|
|
||
| export const exportTeamMembersCSV: AppRequestHandler = async (_req, res) => { | ||
| export const exportTeamMembers: AppRequestHandler = async (_req, res) => { | ||
| try { | ||
| await export_service.exportTeamMembersToCSV(); | ||
| Ok(res, { msg: "CSV des membres de l'équipe généré" }); | ||
| const exportData = await export_service.exportTeamMembers(); | ||
| res.setHeader('Content-Type', 'application/json'); | ||
| res.setHeader('Content-Disposition', `attachment; filename="team_members_${Date.now()}.json"`); | ||
|
|
||
| return res.status(200).json(exportData); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. faudrait passer par un |
||
| } catch (error) { | ||
| console.error(error); | ||
| Error(res, { msg: "Erreur lors de l'export CSV" }); | ||
| return Error(res, { msg: "Erreur lors de l'exportation des memsbres des équipes : " + error }); | ||
| } | ||
| }; | ||
| export const getUploadedDocumentStatus: AppRequestHandler<unknown, unknown, UploadedDocumentParams> = async ( | ||
|
|
||
This file contains hidden or 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,61 @@ | ||
| import * as maker_battle_service from '../services/maker_battle.service'; | ||
| import type { AppRequestHandler } from '../types/http'; | ||
| import { Error, Ok } from '../shared/http/responses'; | ||
| import type { Group, GroupsList } from '../dto/maker_battle.dto'; | ||
|
|
||
| export const distributeGroups: AppRequestHandler<GroupsList> = async (req, res) => { | ||
| const groups = req.body.groups; | ||
| if (!groups || !Array.isArray(groups)) { | ||
| return Error(res, { msg: 'Invalid request: groups must be an array' }); | ||
| } | ||
|
|
||
| try { | ||
| for (const group of groups) { | ||
| await maker_battle_service.distributeGroups(group); | ||
| } | ||
| await maker_battle_service.placeTeamsOnTables(groups); | ||
|
|
||
| Ok(res, { data: { success: true, message: 'Groups allocated successfully' } }); | ||
| return; | ||
| } catch (err) { | ||
| return Error(res, { msg: 'Erreur lors de la distribution des groupes : ' + err }); | ||
| } | ||
| }; | ||
|
|
||
| export const exportGroups: AppRequestHandler<Group> = async (req, res) => { | ||
| const { group } = req.params; | ||
| if (!group || typeof group !== 'string') { | ||
| return Error(res, { msg: 'Invalid request: group must be a string' }); | ||
| } | ||
|
|
||
| try { | ||
| const exportData = await maker_battle_service.exportGroups(group); | ||
|
|
||
| res.setHeader('Content-Type', 'application/json'); | ||
| res.setHeader('Content-Disposition', `attachment; filename="maker_battle_${group}_${Date.now()}.json"`); | ||
|
|
||
| Ok(res, { data: exportData }); | ||
| return; | ||
| } catch (err) { | ||
| return Error(res, { msg: "Erreur lors de l'exportation des groupes : " + err }); | ||
| } | ||
| }; | ||
|
|
||
| export const getCurrentUser: AppRequestHandler = async (req, res) => { | ||
| try { | ||
| const userId = req.user.userId; | ||
|
|
||
| if (!userId) { | ||
| return Error(res, { msg: 'User not authenticated' }); | ||
| } | ||
|
|
||
| const userGroup = await maker_battle_service.getUserTeam(userId); | ||
|
|
||
| Ok(res, { data: { group: userGroup ?? null } }); | ||
| return; | ||
| } catch (err) { | ||
| return Error(res, { | ||
| msg: "Erreur lors de la récupération du groupe de l'utilisateur : " + err, | ||
| }); | ||
| } | ||
| }; |
This file contains hidden or 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,9 @@ | ||
| CREATE TABLE "maker_battle_attribution" ( | ||
| "user_id" integer PRIMARY KEY NOT NULL, | ||
| "maker_team_id" integer NOT NULL, | ||
| "faction_id" integer NOT NULL, | ||
| "table" integer, | ||
| "group" text NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "maker_battle_attribution" ADD CONSTRAINT "maker_battle_attribution_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
faudrait passer par un
Ok