Skip to content

Commit

Permalink
Merge pull request #26 from JarodCouprie/feat/sirh_swagger
Browse files Browse the repository at this point in the history
Feat/sirh swagger
  • Loading branch information
TheoRoblin authored Sep 2, 2024
2 parents d2aef7f + 9335d18 commit 04ee019
Show file tree
Hide file tree
Showing 9 changed files with 633 additions and 73 deletions.
6 changes: 0 additions & 6 deletions .idea/jsLibraryMappings.xml

This file was deleted.

8 changes: 3 additions & 5 deletions api-server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#MINIO_PORT=9000
#MINIO_USE_SSL=false
#MINIO_REGION=eu-west-1
#MINIO_ACCESS_KEY=iHmA43LQkS23AYmhbtRK
#MINIO_SECRET_KEY=GVmxeDPREQZvNCimm03OMxvPtVpOrwEtqOyZLWol
#PC MAISON
#MINIO_ACCESS_KEY=PocckwfAMBZ8ZCfAYiom
#MINIO_SECRET_KEY=2BbG0VQNz0n3nYQJ23ptDVqyB0tdwaht1M55TAcO
#MINIO_ACCESS_KEY=HfHQdNRNGexTknt6JFhq
#MINIO_SECRET_KEY=Eg8uv3EwYMlGnvOZb5Yo1tMj9sdbCvaPZ7QIsUPm

296 changes: 243 additions & 53 deletions api-server/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"minio": "^8.0.1",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.11.0",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1",
"winston": "^3.14.2",
"zod": "^3.23.8"
}
Expand Down
14 changes: 7 additions & 7 deletions api-server/src/common/model/Expense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ExpenseStatus } from "../enum/ExpenseStatus";
import { ExpenseType } from "../enum/ExpenseType";

export class Expense {
id: string;
id: number;
type: ExpenseType;
amount: number;
motivation: string;
Expand All @@ -11,23 +11,23 @@ export class Expense {
status: ExpenseStatus;
id_owner: number;
fileKey?: string;
id_validator: number;
justification: string;
id_validator?: number;
justification?: string;
validator_firstname?: string;
validator_lastname?: string;
validated_at?: Date;

constructor(
id: string,
id: number,
type: ExpenseType,
amount: number,
motivation: string,
created_at: Date,
facturation_date: Date,
status: ExpenseStatus,
ownerId: number,
id_validator: number,
justification: string,
id_validator?: number,
justification?: string,
validator_firstname?: string,
validator_lastname?: string,
validated_at?: Date,
Expand All @@ -38,7 +38,7 @@ export class Expense {
this.amount = amount;
this.motivation = motivation;
this.created_at = created_at;
this.facturation_date = created_at;
this.facturation_date = facturation_date;
this.status = status || ExpenseStatus.WAITING;
this.id_owner = ownerId;
this.fileKey = fileKey;
Expand Down
21 changes: 21 additions & 0 deletions api-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import team from "./resources/team/TeamController.js";
import userProfile from "./resources/userProfile/UserProfileController.js";
import cors from "cors";
import helmet from "helmet";
import swaggerjsdoc from "swagger-jsdoc";
import swaggerUi from "swagger-ui-express";

dotenv.config();

Expand Down Expand Up @@ -47,4 +49,23 @@ if (process.env.NODE_ENV !== "test") {
});
}

const swaggerOptions = {
swaggerDefinition: {
openapi: "3.0.0",
info: {
title: "API SIRH",
description: "API de gestion des données de l'application SIRH",
},
servers: [
{
url: "http://localhost:5000/",
},
],
},
apis: ["./src/resources/**/*.ts"],
};

const swaggerDocs = swaggerjsdoc(swaggerOptions);
app.use("/api-doc", swaggerUi.serve, swaggerUi.setup(swaggerDocs));

export default app;
Loading

0 comments on commit 04ee019

Please sign in to comment.