Skip to content

Commit 0aaea4d

Browse files
committed
fixed accessibility stuff
2 parents 78bedfc + 007eb19 commit 0aaea4d

Some content is hidden

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

58 files changed

+1556
-1231
lines changed

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ INTERNAL_SECRET_KEY=cle_code_secret_interne
1818
FRONTEND_PORT=NUMERO_DE_PORT_DU_FRONTEND
1919
SERVEUR_URL=http://localhost:GATEWAY_PORT/api || https://URL_DU_SERVEUR/api
2020
SERVEUR_URL_DOCKER=http://backend:SERVEUR_PORT_DOCKER/graphql || https://URL_DU_SERVEUR/graphql
21-
SERVICE_MESSAGE_URL=http://localhost:3000/service/message
21+
SERVICE_MESSAGE_URL=http://localhost:3000
2222

2323
# variable gateway
2424
GATEWAY_PORT=NUMERO_DE_PORT_DU_GATEWAY
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: check-biome
2+
3+
on: push
4+
5+
jobs:
6+
check-biome:
7+
name: check-biome
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Récupère le code du dépôt
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 22.20.0
18+
cache: "npm"
19+
20+
- name: Installe les dépendances
21+
run: npm install
22+
23+
- name: Exécute biome
24+
run: npm run husky-lint
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test le build des services
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
branches-ignore:
7+
- main
8+
9+
jobs:
10+
build-and-push-projects:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
# pouvoir voir tout les builds qui échouent pas juste le premier
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- nom_service: frontend
18+
- nom_service: backend
19+
- nom_service: gateway
20+
- nom_service: message-service
21+
- nom_service: picture-service
22+
steps:
23+
- name: Récupérer le code source
24+
uses: actions/checkout@v4
25+
26+
- name: setup Docker Buildx (pour du cache)
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Build l'image Docker
30+
uses: docker/build-push-action@v4
31+
with:
32+
context: ./${{ matrix.nom_service }}
33+
file: ./${{ matrix.nom_service }}/Dockerfile.staging
34+
push: false
35+
load: false
36+
cache-from: type=gha
37+
cache-to: type=gha,mode=max
38+

backend/src/resolvers/GroupResolver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default class GroupResolver {
9595
return messages || [];
9696
}
9797

98+
@UseMiddleware(RoleMiddleware())
9899
@Mutation(() => Group)
99100
async createGroup(@Arg("data") data: CreateGroupInput, @Ctx() ctx: ContextType) {
100101
//TO DO: vérifier les inputs et les nettoyer

backend/src/resolvers/GroupWishlistResolver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Arg, Ctx, Field, Int, Mutation, ObjectType, Query, Resolver } from "type-graphql";
1+
import { Arg, Ctx, Field, Int, Mutation, ObjectType, Query, Resolver, UseMiddleware } from "type-graphql";
22
import { Gift } from "../entities/Gift";
33
import Group from "../entities/Group";
44
import { GroupMember } from "../entities/GroupMember";
55

66
// biome-ignore lint/style/useImportType: bypass biome linting
77
import { AddGiftInput } from "../inputs/AddGiftInput";
8+
import { RoleMiddleware } from "../middleware/RoleMiddleware";
89
import type { ContextType } from "../types/context";
910
import { getOrCreateUserWishlist } from "../utils/getOrCreateUserWishlist";
1011

@@ -18,6 +19,7 @@ class GroupWishlistItems {
1819
}
1920

2021
@Resolver()
22+
@UseMiddleware(RoleMiddleware())
2123
export default class GroupWishlistResolver {
2224
@Query(() => GroupWishlistItems)
2325
async groupWishlistItems(
@@ -105,6 +107,7 @@ export default class GroupWishlistResolver {
105107
}
106108

107109
@Mutation(() => Gift)
110+
@UseMiddleware(RoleMiddleware())
108111
async addGiftToGroupList(
109112
@Arg("groupId", () => Int) groupId: number,
110113
@Arg("data") data: AddGiftInput,

backend/src/resolvers/MyWishlistResolver.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
import { Arg, Ctx, Int, Mutation, Query, Resolver } from "type-graphql";
1+
import { Arg, Ctx, Int, Mutation, Query, Resolver, UseMiddleware } from "type-graphql";
22
import { Gift } from "../entities/Gift";
33
import List from "../entities/List";
44
import User from "../entities/User";
55
// biome-ignore lint/style/useImportType: bypass biome linting
66
import { AddGiftInput } from "../inputs/AddGiftInput";
77
// biome-ignore lint/style/useImportType: bypass biome linting
88
import { UpdateGiftInput } from "../inputs/UpdateGiftInput";
9+
import { RoleMiddleware } from "../middleware/RoleMiddleware";
910
import type { ContextType } from "../types/context";
1011
import { getOrCreateUserWishlist } from "../utils/getOrCreateUserWishlist";
1112

1213
@Resolver()
1314
export default class MyWishlistResolver {
1415
@Query(() => [Gift])
16+
@UseMiddleware(RoleMiddleware())
1517
async myWishlistItems(@Ctx() ctx: ContextType): Promise<Gift[]> {
1618
if (!ctx.user) throw new Error("Utilisateur non connecté");
1719

@@ -25,6 +27,7 @@ export default class MyWishlistResolver {
2527
}
2628

2729
@Mutation(() => Gift)
30+
@UseMiddleware(RoleMiddleware())
2831
async addGift(@Arg("data") data: AddGiftInput, @Ctx() ctx: ContextType): Promise<Gift> {
2932
if (!ctx.user) throw new Error("Utilisateur non connecté");
3033

@@ -60,6 +63,7 @@ export default class MyWishlistResolver {
6063
}
6164

6265
@Mutation(() => Gift)
66+
@UseMiddleware(RoleMiddleware())
6367
async updateGift(
6468
@Arg("id", () => Int) id: number,
6569
@Arg("data") data: UpdateGiftInput,
@@ -81,6 +85,7 @@ export default class MyWishlistResolver {
8185
return gift;
8286
}
8387

88+
@UseMiddleware(RoleMiddleware())
8489
@Mutation(() => Int)
8590
async deleteGift(@Arg("id", () => Int) id: number, @Ctx() ctx: ContextType): Promise<number> {
8691
if (!ctx.user) throw new Error("Utilisateur non connecté");

backend/src/resolvers/UserResolver.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export default class UserResolver {
9898
}
9999

100100
@Query(() => User)
101+
@UseMiddleware(RoleMiddleware())
101102
async getMyProfile(@Ctx() ctx: ContextType) {
102103
if (!ctx.user) throw new Error("Utilisateur non connecté");
103104
const user = await User.findOne({
@@ -121,7 +122,7 @@ export default class UserResolver {
121122

122123
@Query(() => [User])
123124
@UseMiddleware(RoleMiddleware(true))
124-
async getAllUsersForAdmin(@Ctx() _ctx: ContextType) {
125+
async getAllUsersForAdmin() {
125126
// Récupérer tous les utilisateurs (y compris les bannis, mais pas les supprimés)
126127
const allUsers = await User.find({
127128
where: { deletedAt: IsNull() },
@@ -227,6 +228,7 @@ export default class UserResolver {
227228
}
228229

229230
@Mutation(() => Boolean)
231+
@UseMiddleware(RoleMiddleware())
230232
async logout(@Ctx() ctx: ContextType) {
231233
// set le cookie vide pour déconnecter l'utilisateur
232234
cookieManager.delCookie(ctx, "token", { secure: false });
@@ -236,6 +238,7 @@ export default class UserResolver {
236238
}
237239

238240
@Mutation(() => User)
241+
@UseMiddleware(RoleMiddleware())
239242
async UpdateMyProfile(@Arg("data") data: UpdateMyProfileInput, @Ctx() ctx: ContextType) {
240243
if (!ctx.user) throw new Error("Utilisateur non connecté update impossible");
241244

@@ -251,7 +254,7 @@ export default class UserResolver {
251254
}
252255

253256
// hash le mot de passe
254-
const password_hashed = await argon2.hash(data.password);
257+
const password_hashed = data.password ? await argon2.hash(data.password) : undefined;
255258
const newData = {
256259
...data,
257260
password_hashed,
@@ -419,6 +422,7 @@ export default class UserResolver {
419422
}
420423

421424
@Mutation(() => DeleteUserResponse)
425+
@UseMiddleware(RoleMiddleware())
422426
async deleteMyProfile(@Ctx() ctx: ContextType): Promise<DeleteUserResponse> {
423427
// Vérifier que l'utilisateur est connecté
424428
if (!ctx.user) {

compose.dev.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ services:
55
build: ./frontend
66
volumes:
77
- ./frontend/src/:/app/src/
8+
- ./frontend/public/:/app/public/
89
healthcheck:
910
test: [ "CMD-SHELL", "curl --fail --request GET --url 'http://localhost:${FRONTEND_PORT}' || exit 1" ]
1011
interval: 10s
@@ -15,7 +16,7 @@ services:
1516
condition: service_healthy
1617
environment:
1718
VITE_API_URL: ${SERVEUR_URL}
18-
VITE_API_MESSAGE: ${SERVICE_MESSAGE_URL}
19+
VITE_MESSAGE_SOCKET_URL: ${SERVICE_MESSAGE_URL}
1920
VITE_API_URL_DOCKER: ${SERVEUR_URL_DOCKER}
2021
VITE_MODE: ${MODE}
2122
CHOKIDAR_USEPOLLING: true

frontend/Dockerfile.production

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COPY index.html .
99
COPY src src
1010

1111
RUN echo "VITE_MODE=prod" >> .env
12+
RUN echo "VITE_MESSAGE_SOCKET_URL=https://giftchat.032025-bleu-2.wns.wilders.dev" >> .env
13+
RUN echo "VITE_API_URL=https://giftchat.032025-bleu-2.wns.wilders.dev/api" >> .env
1214
RUN npm run build
1315

1416
FROM httpd:2.4-alpine

frontend/Dockerfile.staging

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ RUN npm i
66
COPY *.ts .
77
COPY public public
88
COPY index.html .
9-
COPY src src
9+
COPY src src
1010

1111
RUN echo "VITE_MODE=prod" >> .env
12+
RUN echo "VITE_MESSAGE_SOCKET_URL=https://staging.giftchat.032025-bleu-2.wns.wilders.dev" >> .env
13+
RUN echo "VITE_API_URL=https://staging.giftchat.032025-bleu-2.wns.wilders.dev/api" >> .env
14+
1215
RUN npm run build
1316

1417
FROM httpd:2.4-alpine

0 commit comments

Comments
 (0)