Skip to content

Commit db79e6d

Browse files
authored
Merge pull request #168 from ungdev/dev
2026 Fixes n°12
2 parents 1c518be + b89c290 commit db79e6d

54 files changed

Lines changed: 3275 additions & 896 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yaml‎

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ name: CI
33
on:
44
push:
55
branches:
6-
- prod
76
- dev
7+
tags:
8+
- 'v*'
89
pull_request:
910
branches:
10-
- prod
1111
- dev
12+
- prod
1213

1314
env:
1415
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
@@ -68,7 +69,7 @@ jobs:
6869

6970
build-api:
7071
runs-on: self-hosted
71-
if: github.event_name == 'pull_request'
72+
if: github.event_name == 'pull_request' || github.event_name == 'push'
7273
needs:
7374
- lint-api
7475
steps:
@@ -97,7 +98,7 @@ jobs:
9798

9899
build-front:
99100
runs-on: self-hosted
100-
if: github.event_name == 'pull_request'
101+
if: github.event_name == 'pull_request' || github.event_name == 'push'
101102
needs:
102103
- lint-front
103104
steps:
@@ -126,10 +127,11 @@ jobs:
126127

127128
deploy-api:
128129
runs-on: self-hosted
129-
if : github.event_name == 'push'
130-
environment: ${{ github.ref == 'refs/heads/dev' && 'development' || 'production' }}
130+
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || startswith(github.ref, 'refs/tags/v'))
131+
environment: ${{ startswith(github.ref, 'refs/tags/') && 'production' || 'development' }}
131132
needs:
132133
- lint-api
134+
- build-api
133135
steps:
134136
- name: Checkout repository
135137
uses: actions/checkout@v5
@@ -150,14 +152,16 @@ jobs:
150152
context: ./backend
151153
push: true
152154
tags: |
153-
${{ secrets.REGISTRY_URL }}/integration/api:${{ github.ref == 'refs/heads/prod' && 'prod' || 'dev' }}
155+
${{ secrets.REGISTRY_URL }}/integration/api:${{ startswith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
156+
${{ startswith(github.ref, 'refs/tags/') && format('{0}/integration/api:prod', secrets.REGISTRY_URL) || '' }}
154157
155158
deploy-front:
156159
runs-on: self-hosted
157-
if : github.event_name == 'push'
158-
environment: ${{ github.ref == 'refs/heads/dev' && 'development' || 'production' }}
160+
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || startswith(github.ref, 'refs/tags/v'))
161+
environment: ${{ startswith(github.ref, 'refs/tags/') && 'production' || 'development' }}
159162
needs:
160163
- lint-front
164+
- build-front
161165
steps:
162166
- name: Checkout repository
163167
uses: actions/checkout@v5
@@ -172,7 +176,7 @@ jobs:
172176
- name: Install docker
173177
uses: docker/setup-buildx-action@v3
174178

175-
- name: Front- Build and push
179+
- name: Front - Build and push
176180
uses: docker/build-push-action@v6
177181
with:
178182
context: ./frontend
@@ -199,5 +203,8 @@ jobs:
199203
VITE_BDE_SIREN=${{ vars.BDE_SIREN }}
200204
VITE_DPO_EMAIL=${{ vars.DPO_EMAIL }}
201205
VITE_DPO_NAME=${{ vars.DPO_NAME }}
206+
VITE_APP_VERSION=${{ startswith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
207+
VITE_RELEASE_URL=${{ startswith(github.ref, 'refs/tags/') && format('https://github.com/{0}/releases/tag/{1}', github.repository, github.ref_name) || '' }}
202208
tags: |
203-
${{ secrets.REGISTRY_URL }}/integration/front:${{ github.ref == 'refs/heads/prod' && 'prod' || 'dev' }}
209+
${{ secrets.REGISTRY_URL }}/integration/front:${{ startswith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
210+
${{ startswith(github.ref, 'refs/tags/') && format('{0}/integration/front:prod', secrets.REGISTRY_URL) || '' }}

‎backend/server.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import challengeRoutes from './src/routes/challenge.routes';
1818
import defaultRoute from './src/routes/default.routes';
1919
import discordRoutes from './src/routes/discord.routes';
2020
import emailRoutes from './src/routes/email.routes';
21-
import eventRoutes from './src/routes/event.routes';
21+
import settingsRoutes from './src/routes/settings.routes';
2222
import factionRoutes from './src/routes/faction.routes';
2323
import imexportRouter from './src/routes/im_export.routes';
2424
import newsRoutes from './src/routes/news.routes';
@@ -27,6 +27,7 @@ import roleRoutes from './src/routes/role.routes';
2727
import teamRoutes from './src/routes/team.routes';
2828
import tentRoutes from './src/routes/tent.routes';
2929
import userRoutes from './src/routes/user.routes';
30+
import makerBattleRoutes from './src/routes/maker_battle.routes';
3031
import bannedRoutes from './src/routes/banned.routes';
3132
import { server_port } from './src/shared/secrets/secrets';
3233
import { initQcmvss } from './src/database/initdb/initQcmvss';
@@ -59,7 +60,7 @@ async function startServer() {
5960
app.use('/api/role', authenticateUser, roleRoutes);
6061
app.use('/api/user', authenticateUser, userRoutes);
6162
app.use('/api/team', authenticateUser, teamRoutes);
62-
app.use('/api/event', authenticateUser, eventRoutes);
63+
app.use('/api/settings', authenticateUser, settingsRoutes);
6364
app.use('/api/faction', authenticateUser, factionRoutes);
6465
app.use('/api/imexport', authenticateUser, imexportRouter);
6566
app.use('/api/permanence', authenticateUser, permanenceRoutes);
@@ -69,6 +70,7 @@ async function startServer() {
6970
app.use('/api/discord', authenticateUser, discordRoutes);
7071
app.use('/api/tent', authenticateUser, tentRoutes);
7172
app.use('/api/bus', authenticateUser, busRoutes);
73+
app.use('/api/maker-battle', authenticateUser, makerBattleRoutes);
7274
app.use('/api/uploads/news', express.static(path.join(__dirname, '/uploads/news')));
7375
app.use('/api/uploads/notebooks', express.static(path.join(__dirname, '/uploads/notebooks')));
7476
app.use('/api/uploads/foodmenu', express.static(path.join(__dirname, '/uploads/foodmenu')));

‎backend/src/controllers/event.controller.ts‎

Lines changed: 0 additions & 199 deletions
This file was deleted.

‎backend/src/controllers/im_export.controller.ts‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import * as event_service from '../services/event.service';
3+
import * as settings_service from '../services/settings.service';
44
import * as export_service from '../services/im_export.service';
55
import * as permanence_service from '../services/permanence.service';
66
import * as team_service from '../services/team.service';
@@ -22,7 +22,7 @@ export const exportAllDataToSheets: AppRequestHandler = async (_req, res) => {
2222
const userList = await user_service.getUsersAll();
2323
const teamList = await team_service.getTeamsAll();
2424
const permanenceList = await permanence_service.getAllPermanencesWithUsers();
25-
const shotgunList = await event_service.getAllTeamShotguns();
25+
const shotgunList = await settings_service.getAllTeamShotguns();
2626

2727
// 2. Mapping -> format pour Google Sheets (array de array)
2828
const usersValues = [
@@ -162,23 +162,29 @@ export const updatePlannings: AppRequestHandler = async (_req, res) => {
162162
}
163163
};
164164

165-
export const exportUsersCSV: AppRequestHandler = async (_req, res) => {
165+
export const exportBus: AppRequestHandler = async (_req, res) => {
166166
try {
167-
await export_service.exportUsersToCSV();
168-
Ok(res, { msg: 'CSV des bus généré' });
167+
const exportData = await export_service.exportBus();
168+
res.setHeader('Content-Type', 'application/json');
169+
res.setHeader('Content-Disposition', `attachment; filename="bus_${Date.now()}.json"`);
170+
171+
return res.status(200).json(exportData);
169172
} catch (error) {
170173
console.error(error);
171-
Error(res, { msg: "Erreur lors de l'export CSV" });
174+
return Error(res, { msg: "Erreur lors de l'exportation des memsbres des équipes : " + error });
172175
}
173176
};
174177

175-
export const exportTeamMembersCSV: AppRequestHandler = async (_req, res) => {
178+
export const exportTeamMembers: AppRequestHandler = async (_req, res) => {
176179
try {
177-
await export_service.exportTeamMembersToCSV();
178-
Ok(res, { msg: "CSV des membres de l'équipe généré" });
180+
const exportData = await export_service.exportTeamMembers();
181+
res.setHeader('Content-Type', 'application/json');
182+
res.setHeader('Content-Disposition', `attachment; filename="team_members_${Date.now()}.json"`);
183+
184+
return res.status(200).json(exportData);
179185
} catch (error) {
180186
console.error(error);
181-
Error(res, { msg: "Erreur lors de l'export CSV" });
187+
return Error(res, { msg: "Erreur lors de l'exportation des memsbres des équipes : " + error });
182188
}
183189
};
184190
export const getUploadedDocumentStatus: AppRequestHandler<unknown, unknown, UploadedDocumentParams> = async (

0 commit comments

Comments
 (0)