Skip to content

Commit

Permalink
fixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismail-Mouyahada committed Aug 26, 2024
1 parent 511934c commit 1f715a4
Show file tree
Hide file tree
Showing 37 changed files with 661 additions and 410 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,34 @@ jobs:
docker-compose up --build -d
env:
DATABASE_URL: postgresql://satsquare_user:satsquare_password@db:5432/satsquare_db
- name: Notification Discord
uses: nobrayner/discord-webhook@v1
needs: [build, test]
if: always()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}
username: 'Bob'
avatar-url: 'https://octodex.github.com/images/Terracottocat_Single.png'
title: '${{ github.workflow }}: {{STATUS}}'
description: '${{ github.event_name }} a déclenché cette {{STATUS}} !'
include-details: 'false'
color-success: '#4287f5'
color-failure: 'eb4034'
color-cancelled: '0x42daf5'
footer: 'Bob le Constructeur'

- name: Notify
uses: nobrayner/discord-webhook@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}
username: 'Bob'
avatar-url: 'https://octodex.github.com/images/Terracottocat_Single.png'
title: '${{ github.workflow }}: {{STATUS}}'
description: '${{ github.event_name }} trigged this {{STATUS}}!'
include-details: 'false'
color-success: '#4287f5'
color-failure: 'eb4034'
color-cancelled: '0x42daf5'
footer: 'Bob the Builder'
28 changes: 16 additions & 12 deletions satsquare/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# Utiliser une image Node.js comme base
# Use a Node.js image as the base
FROM node:18-alpine

# Définir le répertoire de travail dans le conteneur
# Set the working directory in the container
WORKDIR /app

# Copier le fichier package.json et package-lock.json (s'ils existent)
# Copy package.json and package-lock.json (if they exist)
COPY package*.json ./

# Installer les dépendances
# Install dependencies
RUN npm install

# Copier le reste des fichiers de l'application
# Copy the rest of the application code
COPY . .

# Construire l'application Next.js
# # Generate Prisma client
# RUN npx prisma generate

# Build the Next.js application
RUN npm run build

# Migration des données
RUN npx prisma db push
# Seed des données
RUN npx prisma seed
# # Push database schema changes
# RUN npx prisma db push

# # Seed the database
# RUN npx prisma seed

# Exposer le port 3000 pour l'application Next.js
# Expose port 3000 for Next.js and 5157 for any other service
EXPOSE 3000 5157

# Commande de démarrage de l'application
# Start the application
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion satsquare/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'

services:
# Commenter Nextjs si vous souhaitez developer avec Prostgres en local
# Commenter Nextjs si vous souhaitez developer avec Prostgres en local
nextjs:
build: .
ports:
Expand Down
38 changes: 19 additions & 19 deletions satsquare/prisma/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ model Utilisateur {
email String @unique
role_id Int?
mot_de_passe String
association_id Int?
associationId Int?
statut_compte Boolean
sponsor_id Int?
cree_le DateTime @default(now())
sponsorId Int?
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
walletId String? // Optional field for the LNbits wallet ID
balance BigInt?
Evenement Evenement[]
EvenementsQuiz EvenementsQuiz[]
Quiz Quiz[]
association Association? @relation(fields: [association_id], references: [id], onDelete: Cascade)
association Association? @relation(fields: [associationId], references: [id], onDelete: Cascade)
role Role? @relation(fields: [role_id], references: [id], onDelete: Cascade)
sponsor Sponsor? @relation(fields: [sponsor_id], references: [id], onDelete: Cascade)
sponsor Sponsor? @relation(fields: [sponsorId], references: [id], onDelete: Cascade)
Game Game[]
}

model Association {
id Int @id @default(autoincrement())
nom String
adresse_eclairage String
adresseEclairage String
valide Int
est_confirme Boolean
estConfirme Boolean
logo_url String
cree_le DateTime @default(now())
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
AssociationDons AssociationDon[]
Utilisateurs Utilisateur[]
Expand All @@ -46,9 +46,9 @@ model Sponsor {
id Int @id @default(autoincrement())
nom String
valide Int
adresse_eclairage String
est_confirme Boolean
cree_le DateTime @default(now())
adresseEclairage String
estConfirme Boolean
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
Dons Don[]
Utilisateurs Utilisateur[]
Expand All @@ -73,7 +73,7 @@ model Evenement {
recompense_joueurs Int
don_association Int
don_plateforme Int
cree_le DateTime @default(now())
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
Dons Don[]
utilisateur Utilisateur? @relation(fields: [user_id], references: [id], onDelete: Cascade)
Expand All @@ -82,21 +82,21 @@ model Evenement {

model Don {
id Int @id @default(autoincrement())
sponsor_id Int
sponsorId Int
evenement_id Int
montant Float
cree_le DateTime @default(now())
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
AssociationDons AssociationDon[]
evenement Evenement @relation(fields: [evenement_id], references: [id], onDelete: Cascade)
sponsor Sponsor @relation(fields: [sponsor_id], references: [id], onDelete: Cascade)
sponsor Sponsor @relation(fields: [sponsorId], references: [id], onDelete: Cascade)
}

model AssociationDon {
id Int @id @default(autoincrement())
don_id Int
association_id Int
association Association @relation(fields: [association_id], references: [id], onDelete: Cascade)
associationId Int
association Association @relation(fields: [associationId], references: [id], onDelete: Cascade)
don Don @relation(fields: [don_id], references: [id], onDelete: Cascade)
}

Expand All @@ -105,7 +105,7 @@ model Quiz {
titre String
user_id Int?
categorie String
cree_le DateTime @default(now())
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
EvenementsQuiz EvenementsQuiz[]
Questions Question[]
Expand Down Expand Up @@ -155,7 +155,7 @@ model Game {
roundStartTime DateTime?
players Json
playersAnswer Json
cree_le DateTime @default(now())
creeLe DateTime @default(now())
mis_a_jour_le DateTime @updatedAt
utilisateur Utilisateur? @relation(fields: [manager_id], references: [id], onDelete: Cascade)
quiz_id Int?
Expand Down
8 changes: 4 additions & 4 deletions satsquare/prisma/seed.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ async function main() {
const association = await prisma.association.create({
data: {
nom: faker.company.name(),
adresse_eclairage: faker.address.streetAddress(),
adresseEclairage: faker.address.streetAddress(),
valide: faker.datatype.boolean() ? 1 : 0,
est_confirme: faker.datatype.boolean(),
estConfirme: faker.datatype.boolean(),
logo_url: faker.image.imageUrl(),
},
});
Expand All @@ -42,8 +42,8 @@ async function main() {
data: {
nom: faker.company.name(),
valide: faker.datatype.boolean() ? 1 : 0,
adresse_eclairage: faker.address.streetAddress(),
est_confirme: faker.datatype.boolean(),
adresseEclairage: faker.address.streetAddress(),
estConfirme: faker.datatype.boolean(),
},
});
sponsors.push(sponsor);
Expand Down
8 changes: 4 additions & 4 deletions satsquare/src/app/api/associations/[id]/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ describe("API Routes: Associations", () => {
const mockUpdatedAssociation = {
id: 1,
nom: "Updated Association",
adresse_eclairage: "123 Street",
adresseEclairage: "123 Street",
valide: 1,
est_confirme: true,
estConfirme: true,
logo_url: "http://example.com/logo.png",
cree_le: new Date(),
creeLe: new Date(),
mis_a_jour_le: new Date(),
};

Expand All @@ -52,7 +52,7 @@ describe("API Routes: Associations", () => {
expect(response.status).toBe(200);
expect(body).toEqual({
...mockUpdatedAssociation,
cree_le: mockUpdatedAssociation.cree_le.toISOString(),
creeLe: mockUpdatedAssociation.creeLe.toISOString(),
mis_a_jour_le: mockUpdatedAssociation.mis_a_jour_le.toISOString(),
});
expect(prisma.association.update).toHaveBeenCalledTimes(1);
Expand Down
28 changes: 14 additions & 14 deletions satsquare/src/app/api/associations/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe("API Routes: Associations", () => {
{
id: 1,
nom: "Association 1",
adresse_eclairage: "123 Street",
adresseEclairage: "123 Street",
valide: 1,
est_confirme: true,
estConfirme: true,
logo_url: "http://example.com/logo.png",
cree_le: new Date(),
creeLe: new Date(),
mis_a_jour_le: new Date(),
},
];
Expand All @@ -44,7 +44,7 @@ describe("API Routes: Associations", () => {
expect(body).toEqual(
mockAssociations.map((association) => ({
...association,
cree_le: association.cree_le.toISOString(),
creeLe: association.creeLe.toISOString(),
mis_a_jour_le: association.mis_a_jour_le.toISOString(),
}))
);
Expand All @@ -55,11 +55,11 @@ describe("API Routes: Associations", () => {
{
id: 1,
nom: "Test Association",
adresse_eclairage: "123 Street",
adresseEclairage: "123 Street",
valide: 1,
est_confirme: true,
estConfirme: true,
logo_url: "http://example.com/logo.png",
cree_le: new Date(),
creeLe: new Date(),
mis_a_jour_le: new Date(),
},
];
Expand All @@ -78,7 +78,7 @@ describe("API Routes: Associations", () => {
expect(body).toEqual(
mockAssociations.map((association) => ({
...association,
cree_le: association.cree_le.toISOString(),
creeLe: association.creeLe.toISOString(),
mis_a_jour_le: association.mis_a_jour_le.toISOString(),
}))
);
Expand All @@ -104,21 +104,21 @@ describe("API Routes: Associations", () => {
method: "POST",
body: JSON.stringify({
nom: "Association Test",
adresse_eclairage: "123 Test Street",
adresseEclairage: "123 Test Street",
valide: 1,
est_confirme: true,
estConfirme: true,
logo_url: "http://example.com/logo.png",
}),
});

const mockAssociation = {
id: 1,
nom: "Association Test",
adresse_eclairage: "123 Test Street",
adresseEclairage: "123 Test Street",
valide: 1,
est_confirme: true,
estConfirme: true,
logo_url: "http://example.com/logo.png",
cree_le: new Date(),
creeLe: new Date(),
mis_a_jour_le: new Date(),
};

Expand All @@ -132,7 +132,7 @@ describe("API Routes: Associations", () => {
expect(response.status).toBe(201);
expect(body).toEqual({
...mockAssociation,
cree_le: mockAssociation.cree_le.toISOString(),
creeLe: mockAssociation.creeLe.toISOString(),
mis_a_jour_le: mockAssociation.mis_a_jour_le.toISOString(),
});
expect(prisma.association.create).toHaveBeenCalledTimes(1);
Expand Down
4 changes: 2 additions & 2 deletions satsquare/src/app/api/event/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("API Routes: Evenements", () => {
commence_a: new Date(requestData.commence_a),
termine_a: new Date(requestData.termine_a),
EvenementsQuiz: [{ id: 1 }, { id: 2 }],
cree_le: new Date(),
creeLe: new Date(),
mis_a_jour_le: new Date(),
};

Expand All @@ -59,7 +59,7 @@ describe("API Routes: Evenements", () => {
...mockNewEvent,
commence_a: mockNewEvent.commence_a.toISOString(),
termine_a: mockNewEvent.termine_a.toISOString(),
cree_le: mockNewEvent.cree_le.toISOString(),
creeLe: mockNewEvent.creeLe.toISOString(),
mis_a_jour_le: mockNewEvent.mis_a_jour_le.toISOString(),
});
expect(prisma.evenement.create).toHaveBeenCalledTimes(1);
Expand Down
4 changes: 2 additions & 2 deletions satsquare/src/app/api/events/[id]/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("API Routes: Evenements", () => {
...requestData,
commence_a: new Date(requestData.commence_a),
termine_a: new Date(requestData.termine_a),
cree_le: new Date(),
creeLe: new Date(),
mis_a_jour_le: new Date(),
};

Expand All @@ -58,7 +58,7 @@ describe("API Routes: Evenements", () => {
...mockUpdatedEvent,
commence_a: mockUpdatedEvent.commence_a.toISOString(),
termine_a: mockUpdatedEvent.termine_a.toISOString(),
cree_le: mockUpdatedEvent.cree_le.toISOString(),
creeLe: mockUpdatedEvent.creeLe.toISOString(),
mis_a_jour_le: mockUpdatedEvent.mis_a_jour_le.toISOString(),
});
expect(prisma.evenement.update).toHaveBeenCalledTimes(1);
Expand Down
Loading

0 comments on commit 1f715a4

Please sign in to comment.