add swagger au projet
This commit is contained in:
parent
a3dd5ad63d
commit
8e79f08a4b
|
@ -1,7 +1,13 @@
|
|||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
experimental: {
|
||||
appDir: true, // tu l’as sûrement déjà
|
||||
// 👇 on active le support de pages (cohabitation possible)
|
||||
legacyBrowsers: false, // (optionnel mais conseillé)
|
||||
},
|
||||
// 👇 important si tu as déplacé dans /src
|
||||
pageExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,9 +11,13 @@
|
|||
"dependencies": {
|
||||
"@prisma/client": "^6.6.0",
|
||||
"next": "15.3.0",
|
||||
"next-swagger-doc": "^0.4.1",
|
||||
"prisma": "^6.6.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"react-dom": "^19.0.0",
|
||||
"swagger-jsdoc": "^6.2.8",
|
||||
"swagger-ui-express": "^5.0.1",
|
||||
"yarn": "^1.22.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3",
|
||||
|
@ -21,6 +25,7 @@
|
|||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/swagger-ui-react": "^5.18.0",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.3.0",
|
||||
"tailwindcss": "^4",
|
||||
|
|
|
@ -42,6 +42,7 @@ model Formation {
|
|||
fo_miniature Bytes?
|
||||
fo_teaser String?
|
||||
fo_date_publication DateTime @default(now())
|
||||
fo_desactive Boolean @default(false)
|
||||
fo_video Video[]
|
||||
commandeFormation CommandeFormation[]
|
||||
achat Achat[]
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { getAchatById } from "@/methods/achatMethods";
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/achats/{id}:
|
||||
* get:
|
||||
* tags :
|
||||
* - achats
|
||||
* summary: Filtre les achats avec l'identifiant de l'utilisateur
|
||||
* description: Filtre sur l'identifiant de l'utilisateur
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* description: ID de l'utilisateur
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Retourn les achats de l'utilisateur
|
||||
*/
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
context: { params: { id: string } }
|
||||
) {
|
||||
const { id } = context.params
|
||||
|
||||
const result = await getAchatById(id)
|
||||
return NextResponse.json(result, { status: 200 })
|
||||
}
|
|
@ -2,6 +2,32 @@ import { NextResponse } from 'next/server'
|
|||
import { createAchat,getAllAchat } from '@/methods/achatMethods'
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/achats:
|
||||
* post:
|
||||
* tags:
|
||||
* - achats
|
||||
* summary: Crée un achat
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* idUtilisateur:
|
||||
* type: integer
|
||||
* idFormation:
|
||||
* type: integer
|
||||
* required:
|
||||
* - idUtilisateur
|
||||
* - idFormation
|
||||
* responses:
|
||||
* 201:
|
||||
* description: achat créé
|
||||
*/
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = await request.json()
|
||||
const{idUtilisateur,idFormation} = body
|
||||
|
@ -10,6 +36,19 @@ export async function POST(request: Request) {
|
|||
return NextResponse.json(result, { status: 201 })
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/achats:
|
||||
* get:
|
||||
* tags :
|
||||
* - achats
|
||||
* summary: Lister les achats
|
||||
* description: Retourne l'ensemble des achats
|
||||
* responses:
|
||||
* 200:
|
||||
* description: liste des achats
|
||||
*/
|
||||
export async function GET(){
|
||||
const result = await getAllAchat()
|
||||
return NextResponse.json(result, { status: 200 })
|
||||
|
|
|
@ -2,6 +2,35 @@ import { NextResponse } from 'next/server'
|
|||
import { createFormation,deleteFormation,getAllFormation } from '@/methods/formationMethods'
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/formations:
|
||||
* post:
|
||||
* tags:
|
||||
* - formations
|
||||
* summary: Crée une formations
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* titre:
|
||||
* type: string
|
||||
* description:
|
||||
* type: string
|
||||
* prix :
|
||||
* type : string
|
||||
* required:
|
||||
* - titre
|
||||
* - description
|
||||
* - prix
|
||||
* responses:
|
||||
* 201:
|
||||
* description: formation créé
|
||||
*/
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = await request.json()
|
||||
const{titre,description,prix} = body
|
||||
|
@ -10,11 +39,48 @@ export async function POST(request: Request) {
|
|||
return NextResponse.json(result, { status: 201 })
|
||||
}
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/formations:
|
||||
* get:
|
||||
* tags :
|
||||
* - formations
|
||||
* summary: Lister toutes les formations
|
||||
* description: Retourne l'ensemble des formations
|
||||
* responses:
|
||||
* 200:
|
||||
* description: liste des formations
|
||||
*/
|
||||
|
||||
export async function GET(){
|
||||
const result = await getAllFormation()
|
||||
return NextResponse.json(result, { status: 200 })
|
||||
}
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/formations:
|
||||
* delete:
|
||||
* tags :
|
||||
* - formations
|
||||
* summary: delete une formations
|
||||
* description: delete une formations
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: number
|
||||
* required:
|
||||
* - id
|
||||
* responses:
|
||||
* 200:
|
||||
* description: liste des formations
|
||||
*/
|
||||
|
||||
export async function DELETE(request : Request){
|
||||
const body = await request.json()
|
||||
const {id } = body
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import swaggerSpec from '@/lib/swaggerConfig';
|
||||
|
||||
export async function GET() {
|
||||
return Response.json(swaggerSpec);
|
||||
}
|
||||
|
||||
|
|
@ -4,6 +4,36 @@ import { createUserMethod,deleteUser,getAllUser } from '@/methods/userMethods'
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/users:
|
||||
* post:
|
||||
* tags:
|
||||
* - utilisateurs
|
||||
* summary: Crée un utilisateur
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* name:
|
||||
* type: string
|
||||
* prenom:
|
||||
* type: string
|
||||
* email:
|
||||
* type: string
|
||||
* required:
|
||||
* - name
|
||||
* - prenom
|
||||
* - email
|
||||
* responses:
|
||||
* 201:
|
||||
* description: utilisateur créé
|
||||
*/
|
||||
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = await request.json()
|
||||
const { name, prenom,email } = body
|
||||
|
@ -17,13 +47,48 @@ export async function POST(request: Request) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/users:
|
||||
* get:
|
||||
* tags :
|
||||
* - utilisateurs
|
||||
* summary: Lister les utilisateurs
|
||||
* description: Retourne l'ensemble des utilisateurs
|
||||
* responses:
|
||||
* 200:
|
||||
* description: liste des utilisateurs
|
||||
*/
|
||||
|
||||
|
||||
export async function GET() {
|
||||
const user = await getAllUser()
|
||||
return NextResponse.json(user, { status: 200 })
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/users:
|
||||
* delete:
|
||||
* tags :
|
||||
* - utilisateurs
|
||||
* summary: delete un utilisateur
|
||||
* description: delete un utilisateur
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: number
|
||||
* required:
|
||||
* - id
|
||||
* responses:
|
||||
* 200:
|
||||
* description: suppression de l'utilisateur
|
||||
*/
|
||||
|
||||
export async function DELETE(request : Request){
|
||||
const param = await request.json()
|
||||
|
|
|
@ -1,6 +1,35 @@
|
|||
import { NextResponse } from 'next/server'
|
||||
import { createVideo, getAllVideo} from '@/methods/videoMethods'
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/videos:
|
||||
* post:
|
||||
* tags:
|
||||
* - videos
|
||||
* summary: Crée une videos
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* idForm:
|
||||
* type: interger
|
||||
* titre:
|
||||
* type: string
|
||||
* description :
|
||||
* type : string
|
||||
* required:
|
||||
* - titre
|
||||
* - idForm
|
||||
* - prix
|
||||
* responses:
|
||||
* 201:
|
||||
* description: formation créé
|
||||
*/
|
||||
export async function POST(request: Request) {
|
||||
const body = await request.json()
|
||||
const{idForm,titre,description} = body
|
||||
|
@ -9,6 +38,20 @@ export async function POST(request: Request) {
|
|||
return NextResponse.json(result, { status: 201 })
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/videos:
|
||||
* get:
|
||||
* tags :
|
||||
* - videos
|
||||
* summary: Lister les videos
|
||||
* description: Retourne l'ensemble des videos
|
||||
* responses:
|
||||
* 200:
|
||||
* description: liste des videos
|
||||
*/
|
||||
|
||||
export async function GET(){
|
||||
const result = await getAllVideo()
|
||||
return NextResponse.json(result,{status : 200})
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
'use client';
|
||||
|
||||
import SwaggerUI from 'swagger-ui-react';
|
||||
import 'swagger-ui-react/swagger-ui.css';
|
||||
|
||||
export default function SwaggerPage() {
|
||||
return (
|
||||
<div style={{ height: '100vh' }}>
|
||||
<SwaggerUI url="/api/swagger" />
|
||||
</div>
|
||||
);
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -142,7 +142,8 @@ exports.Prisma.FormationScalarFieldEnum = {
|
|||
fo_prix: 'fo_prix',
|
||||
fo_miniature: 'fo_miniature',
|
||||
fo_teaser: 'fo_teaser',
|
||||
fo_date_publication: 'fo_date_publication'
|
||||
fo_date_publication: 'fo_date_publication',
|
||||
fo_desactive: 'fo_desactive'
|
||||
};
|
||||
|
||||
exports.Prisma.VideoScalarFieldEnum = {
|
||||
|
|
|
@ -2779,6 +2779,7 @@ export namespace Prisma {
|
|||
fo_miniature: Uint8Array | null
|
||||
fo_teaser: string | null
|
||||
fo_date_publication: Date | null
|
||||
fo_desactive: boolean | null
|
||||
}
|
||||
|
||||
export type FormationMaxAggregateOutputType = {
|
||||
|
@ -2789,6 +2790,7 @@ export namespace Prisma {
|
|||
fo_miniature: Uint8Array | null
|
||||
fo_teaser: string | null
|
||||
fo_date_publication: Date | null
|
||||
fo_desactive: boolean | null
|
||||
}
|
||||
|
||||
export type FormationCountAggregateOutputType = {
|
||||
|
@ -2799,6 +2801,7 @@ export namespace Prisma {
|
|||
fo_miniature: number
|
||||
fo_teaser: number
|
||||
fo_date_publication: number
|
||||
fo_desactive: number
|
||||
_all: number
|
||||
}
|
||||
|
||||
|
@ -2819,6 +2822,7 @@ export namespace Prisma {
|
|||
fo_miniature?: true
|
||||
fo_teaser?: true
|
||||
fo_date_publication?: true
|
||||
fo_desactive?: true
|
||||
}
|
||||
|
||||
export type FormationMaxAggregateInputType = {
|
||||
|
@ -2829,6 +2833,7 @@ export namespace Prisma {
|
|||
fo_miniature?: true
|
||||
fo_teaser?: true
|
||||
fo_date_publication?: true
|
||||
fo_desactive?: true
|
||||
}
|
||||
|
||||
export type FormationCountAggregateInputType = {
|
||||
|
@ -2839,6 +2844,7 @@ export namespace Prisma {
|
|||
fo_miniature?: true
|
||||
fo_teaser?: true
|
||||
fo_date_publication?: true
|
||||
fo_desactive?: true
|
||||
_all?: true
|
||||
}
|
||||
|
||||
|
@ -2936,6 +2942,7 @@ export namespace Prisma {
|
|||
fo_miniature: Uint8Array | null
|
||||
fo_teaser: string | null
|
||||
fo_date_publication: Date
|
||||
fo_desactive: boolean
|
||||
_count: FormationCountAggregateOutputType | null
|
||||
_avg: FormationAvgAggregateOutputType | null
|
||||
_sum: FormationSumAggregateOutputType | null
|
||||
|
@ -2965,6 +2972,7 @@ export namespace Prisma {
|
|||
fo_miniature?: boolean
|
||||
fo_teaser?: boolean
|
||||
fo_date_publication?: boolean
|
||||
fo_desactive?: boolean
|
||||
fo_video?: boolean | Formation$fo_videoArgs<ExtArgs>
|
||||
commandeFormation?: boolean | Formation$commandeFormationArgs<ExtArgs>
|
||||
achat?: boolean | Formation$achatArgs<ExtArgs>
|
||||
|
@ -2981,9 +2989,10 @@ export namespace Prisma {
|
|||
fo_miniature?: boolean
|
||||
fo_teaser?: boolean
|
||||
fo_date_publication?: boolean
|
||||
fo_desactive?: boolean
|
||||
}
|
||||
|
||||
export type FormationOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"fo_id" | "fo_titre" | "fo_description" | "fo_prix" | "fo_miniature" | "fo_teaser" | "fo_date_publication", ExtArgs["result"]["formation"]>
|
||||
export type FormationOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"fo_id" | "fo_titre" | "fo_description" | "fo_prix" | "fo_miniature" | "fo_teaser" | "fo_date_publication" | "fo_desactive", ExtArgs["result"]["formation"]>
|
||||
export type FormationInclude<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
|
||||
fo_video?: boolean | Formation$fo_videoArgs<ExtArgs>
|
||||
commandeFormation?: boolean | Formation$commandeFormationArgs<ExtArgs>
|
||||
|
@ -3006,6 +3015,7 @@ export namespace Prisma {
|
|||
fo_miniature: Uint8Array | null
|
||||
fo_teaser: string | null
|
||||
fo_date_publication: Date
|
||||
fo_desactive: boolean
|
||||
}, ExtArgs["result"]["formation"]>
|
||||
composites: {}
|
||||
}
|
||||
|
@ -3385,6 +3395,7 @@ export namespace Prisma {
|
|||
readonly fo_miniature: FieldRef<"Formation", 'Bytes'>
|
||||
readonly fo_teaser: FieldRef<"Formation", 'String'>
|
||||
readonly fo_date_publication: FieldRef<"Formation", 'DateTime'>
|
||||
readonly fo_desactive: FieldRef<"Formation", 'Boolean'>
|
||||
}
|
||||
|
||||
|
||||
|
@ -9653,7 +9664,8 @@ export namespace Prisma {
|
|||
fo_prix: 'fo_prix',
|
||||
fo_miniature: 'fo_miniature',
|
||||
fo_teaser: 'fo_teaser',
|
||||
fo_date_publication: 'fo_date_publication'
|
||||
fo_date_publication: 'fo_date_publication',
|
||||
fo_desactive: 'fo_desactive'
|
||||
};
|
||||
|
||||
export type FormationScalarFieldEnum = (typeof FormationScalarFieldEnum)[keyof typeof FormationScalarFieldEnum]
|
||||
|
@ -9816,6 +9828,13 @@ export namespace Prisma {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Boolean'
|
||||
*/
|
||||
export type BooleanFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Boolean'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Float'
|
||||
*/
|
||||
|
@ -9948,6 +9967,7 @@ export namespace Prisma {
|
|||
fo_miniature?: BytesNullableFilter<"Formation"> | Uint8Array | null
|
||||
fo_teaser?: StringNullableFilter<"Formation"> | string | null
|
||||
fo_date_publication?: DateTimeFilter<"Formation"> | Date | string
|
||||
fo_desactive?: BoolFilter<"Formation"> | boolean
|
||||
fo_video?: VideoListRelationFilter
|
||||
commandeFormation?: CommandeFormationListRelationFilter
|
||||
achat?: AchatListRelationFilter
|
||||
|
@ -9961,6 +9981,7 @@ export namespace Prisma {
|
|||
fo_miniature?: SortOrderInput | SortOrder
|
||||
fo_teaser?: SortOrderInput | SortOrder
|
||||
fo_date_publication?: SortOrder
|
||||
fo_desactive?: SortOrder
|
||||
fo_video?: VideoOrderByRelationAggregateInput
|
||||
commandeFormation?: CommandeFormationOrderByRelationAggregateInput
|
||||
achat?: AchatOrderByRelationAggregateInput
|
||||
|
@ -9978,6 +9999,7 @@ export namespace Prisma {
|
|||
fo_miniature?: BytesNullableFilter<"Formation"> | Uint8Array | null
|
||||
fo_teaser?: StringNullableFilter<"Formation"> | string | null
|
||||
fo_date_publication?: DateTimeFilter<"Formation"> | Date | string
|
||||
fo_desactive?: BoolFilter<"Formation"> | boolean
|
||||
fo_video?: VideoListRelationFilter
|
||||
commandeFormation?: CommandeFormationListRelationFilter
|
||||
achat?: AchatListRelationFilter
|
||||
|
@ -9991,6 +10013,7 @@ export namespace Prisma {
|
|||
fo_miniature?: SortOrderInput | SortOrder
|
||||
fo_teaser?: SortOrderInput | SortOrder
|
||||
fo_date_publication?: SortOrder
|
||||
fo_desactive?: SortOrder
|
||||
_count?: FormationCountOrderByAggregateInput
|
||||
_avg?: FormationAvgOrderByAggregateInput
|
||||
_max?: FormationMaxOrderByAggregateInput
|
||||
|
@ -10009,6 +10032,7 @@ export namespace Prisma {
|
|||
fo_miniature?: BytesNullableWithAggregatesFilter<"Formation"> | Uint8Array | null
|
||||
fo_teaser?: StringNullableWithAggregatesFilter<"Formation"> | string | null
|
||||
fo_date_publication?: DateTimeWithAggregatesFilter<"Formation"> | Date | string
|
||||
fo_desactive?: BoolWithAggregatesFilter<"Formation"> | boolean
|
||||
}
|
||||
|
||||
export type VideoWhereInput = {
|
||||
|
@ -10470,6 +10494,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
fo_video?: VideoCreateNestedManyWithoutFormationInput
|
||||
commandeFormation?: CommandeFormationCreateNestedManyWithoutFormationInput
|
||||
achat?: AchatCreateNestedManyWithoutFormationInput
|
||||
|
@ -10483,6 +10508,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
fo_video?: VideoUncheckedCreateNestedManyWithoutFormationInput
|
||||
commandeFormation?: CommandeFormationUncheckedCreateNestedManyWithoutFormationInput
|
||||
achat?: AchatUncheckedCreateNestedManyWithoutFormationInput
|
||||
|
@ -10495,6 +10521,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
fo_video?: VideoUpdateManyWithoutFormationNestedInput
|
||||
commandeFormation?: CommandeFormationUpdateManyWithoutFormationNestedInput
|
||||
achat?: AchatUpdateManyWithoutFormationNestedInput
|
||||
|
@ -10508,6 +10535,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
fo_video?: VideoUncheckedUpdateManyWithoutFormationNestedInput
|
||||
commandeFormation?: CommandeFormationUncheckedUpdateManyWithoutFormationNestedInput
|
||||
achat?: AchatUncheckedUpdateManyWithoutFormationNestedInput
|
||||
|
@ -10521,6 +10549,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
}
|
||||
|
||||
export type FormationUpdateManyMutationInput = {
|
||||
|
@ -10530,6 +10559,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
}
|
||||
|
||||
export type FormationUncheckedUpdateManyInput = {
|
||||
|
@ -10540,6 +10570,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
}
|
||||
|
||||
export type VideoCreateInput = {
|
||||
|
@ -11070,6 +11101,11 @@ export namespace Prisma {
|
|||
not?: NestedBytesNullableFilter<$PrismaModel> | Uint8Array | null
|
||||
}
|
||||
|
||||
export type BoolFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | BooleanFieldRefInput<$PrismaModel>
|
||||
not?: NestedBoolFilter<$PrismaModel> | boolean
|
||||
}
|
||||
|
||||
export type VideoListRelationFilter = {
|
||||
every?: VideoWhereInput
|
||||
some?: VideoWhereInput
|
||||
|
@ -11104,6 +11140,7 @@ export namespace Prisma {
|
|||
fo_miniature?: SortOrder
|
||||
fo_teaser?: SortOrder
|
||||
fo_date_publication?: SortOrder
|
||||
fo_desactive?: SortOrder
|
||||
}
|
||||
|
||||
export type FormationAvgOrderByAggregateInput = {
|
||||
|
@ -11118,6 +11155,7 @@ export namespace Prisma {
|
|||
fo_miniature?: SortOrder
|
||||
fo_teaser?: SortOrder
|
||||
fo_date_publication?: SortOrder
|
||||
fo_desactive?: SortOrder
|
||||
}
|
||||
|
||||
export type FormationMinOrderByAggregateInput = {
|
||||
|
@ -11128,6 +11166,7 @@ export namespace Prisma {
|
|||
fo_miniature?: SortOrder
|
||||
fo_teaser?: SortOrder
|
||||
fo_date_publication?: SortOrder
|
||||
fo_desactive?: SortOrder
|
||||
}
|
||||
|
||||
export type FormationSumOrderByAggregateInput = {
|
||||
|
@ -11144,6 +11183,14 @@ export namespace Prisma {
|
|||
_max?: NestedBytesNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type BoolWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | BooleanFieldRefInput<$PrismaModel>
|
||||
not?: NestedBoolWithAggregatesFilter<$PrismaModel> | boolean
|
||||
_count?: NestedIntFilter<$PrismaModel>
|
||||
_min?: NestedBoolFilter<$PrismaModel>
|
||||
_max?: NestedBoolFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type FormationScalarRelationFilter = {
|
||||
is?: FormationWhereInput
|
||||
isNot?: FormationWhereInput
|
||||
|
@ -11579,6 +11626,10 @@ export namespace Prisma {
|
|||
set?: Uint8Array | null
|
||||
}
|
||||
|
||||
export type BoolFieldUpdateOperationsInput = {
|
||||
set?: boolean
|
||||
}
|
||||
|
||||
export type VideoUpdateManyWithoutFormationNestedInput = {
|
||||
create?: XOR<VideoCreateWithoutFormationInput, VideoUncheckedCreateWithoutFormationInput> | VideoCreateWithoutFormationInput[] | VideoUncheckedCreateWithoutFormationInput[]
|
||||
connectOrCreate?: VideoCreateOrConnectWithoutFormationInput | VideoCreateOrConnectWithoutFormationInput[]
|
||||
|
@ -12015,6 +12066,11 @@ export namespace Prisma {
|
|||
not?: NestedBytesNullableFilter<$PrismaModel> | Uint8Array | null
|
||||
}
|
||||
|
||||
export type NestedBoolFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | BooleanFieldRefInput<$PrismaModel>
|
||||
not?: NestedBoolFilter<$PrismaModel> | boolean
|
||||
}
|
||||
|
||||
export type NestedBytesNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: Uint8Array | BytesFieldRefInput<$PrismaModel> | null
|
||||
in?: Uint8Array[] | null
|
||||
|
@ -12025,6 +12081,14 @@ export namespace Prisma {
|
|||
_max?: NestedBytesNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedBoolWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | BooleanFieldRefInput<$PrismaModel>
|
||||
not?: NestedBoolWithAggregatesFilter<$PrismaModel> | boolean
|
||||
_count?: NestedIntFilter<$PrismaModel>
|
||||
_min?: NestedBoolFilter<$PrismaModel>
|
||||
_max?: NestedBoolFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedStringFilter<$PrismaModel = never> = {
|
||||
equals?: string | StringFieldRefInput<$PrismaModel>
|
||||
in?: string[]
|
||||
|
@ -12306,6 +12370,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
commandeFormation?: CommandeFormationCreateNestedManyWithoutFormationInput
|
||||
achat?: AchatCreateNestedManyWithoutFormationInput
|
||||
}
|
||||
|
@ -12318,6 +12383,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
commandeFormation?: CommandeFormationUncheckedCreateNestedManyWithoutFormationInput
|
||||
achat?: AchatUncheckedCreateNestedManyWithoutFormationInput
|
||||
}
|
||||
|
@ -12363,6 +12429,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
commandeFormation?: CommandeFormationUpdateManyWithoutFormationNestedInput
|
||||
achat?: AchatUpdateManyWithoutFormationNestedInput
|
||||
}
|
||||
|
@ -12375,6 +12442,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
commandeFormation?: CommandeFormationUncheckedUpdateManyWithoutFormationNestedInput
|
||||
achat?: AchatUncheckedUpdateManyWithoutFormationNestedInput
|
||||
}
|
||||
|
@ -12500,6 +12568,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
fo_video?: VideoCreateNestedManyWithoutFormationInput
|
||||
achat?: AchatCreateNestedManyWithoutFormationInput
|
||||
}
|
||||
|
@ -12512,6 +12581,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
fo_video?: VideoUncheckedCreateNestedManyWithoutFormationInput
|
||||
achat?: AchatUncheckedCreateNestedManyWithoutFormationInput
|
||||
}
|
||||
|
@ -12539,6 +12609,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
fo_video?: VideoUpdateManyWithoutFormationNestedInput
|
||||
achat?: AchatUpdateManyWithoutFormationNestedInput
|
||||
}
|
||||
|
@ -12551,6 +12622,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
fo_video?: VideoUncheckedUpdateManyWithoutFormationNestedInput
|
||||
achat?: AchatUncheckedUpdateManyWithoutFormationNestedInput
|
||||
}
|
||||
|
@ -12604,6 +12676,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
fo_video?: VideoCreateNestedManyWithoutFormationInput
|
||||
commandeFormation?: CommandeFormationCreateNestedManyWithoutFormationInput
|
||||
}
|
||||
|
@ -12616,6 +12689,7 @@ export namespace Prisma {
|
|||
fo_miniature?: Uint8Array | null
|
||||
fo_teaser?: string | null
|
||||
fo_date_publication?: Date | string
|
||||
fo_desactive?: boolean
|
||||
fo_video?: VideoUncheckedCreateNestedManyWithoutFormationInput
|
||||
commandeFormation?: CommandeFormationUncheckedCreateNestedManyWithoutFormationInput
|
||||
}
|
||||
|
@ -12691,6 +12765,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
fo_video?: VideoUpdateManyWithoutFormationNestedInput
|
||||
commandeFormation?: CommandeFormationUpdateManyWithoutFormationNestedInput
|
||||
}
|
||||
|
@ -12703,6 +12778,7 @@ export namespace Prisma {
|
|||
fo_miniature?: NullableBytesFieldUpdateOperationsInput | Uint8Array | null
|
||||
fo_teaser?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
fo_date_publication?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
fo_desactive?: BoolFieldUpdateOperationsInput | boolean
|
||||
fo_video?: VideoUncheckedUpdateManyWithoutFormationNestedInput
|
||||
commandeFormation?: CommandeFormationUncheckedUpdateManyWithoutFormationNestedInput
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "prisma-client-122a4d41568f65eb65f023f60595462dfeea2d65365357e490376c9300fbddbf",
|
||||
"name": "prisma-client-92cb5c5a904849943d80d941f6ca4ba7ca32ac58daa69f6474ab463b839afab2",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"browser": "index-browser.js",
|
||||
|
|
|
@ -42,6 +42,7 @@ model Formation {
|
|||
fo_miniature Bytes?
|
||||
fo_teaser String?
|
||||
fo_date_publication DateTime @default(now())
|
||||
fo_desactive Boolean @default(false)
|
||||
fo_video Video[]
|
||||
commandeFormation CommandeFormation[]
|
||||
achat Achat[]
|
||||
|
|
|
@ -142,7 +142,8 @@ exports.Prisma.FormationScalarFieldEnum = {
|
|||
fo_prix: 'fo_prix',
|
||||
fo_miniature: 'fo_miniature',
|
||||
fo_teaser: 'fo_teaser',
|
||||
fo_date_publication: 'fo_date_publication'
|
||||
fo_date_publication: 'fo_date_publication',
|
||||
fo_desactive: 'fo_desactive'
|
||||
};
|
||||
|
||||
exports.Prisma.VideoScalarFieldEnum = {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import swaggerJSDoc from 'swagger-jsdoc';
|
||||
|
||||
|
||||
const options = {
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'Mon API',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
// 👇 Assure-toi d’avoir le bon chemin, avec .ts si tu es en TypeScript
|
||||
apis: ['./src/app/api/**/*.ts'],
|
||||
};
|
||||
|
||||
const swaggerSpec = swaggerJSDoc(options);
|
||||
export default swaggerSpec;
|
|
@ -12,4 +12,17 @@ export async function createAchat(idUtilisateur : number, idFormation : number){
|
|||
|
||||
export async function getAllAchat(){
|
||||
return await prisma.achat.findMany()
|
||||
}
|
||||
|
||||
export async function getAchatById( id: string){
|
||||
return await prisma.achat.findFirst(
|
||||
{where : {
|
||||
ac_utilisateur : parseInt(id)
|
||||
},select : {
|
||||
ac_formation : true,
|
||||
ac_date_achat : true,
|
||||
ac_id : true
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
|
@ -15,7 +15,11 @@ export async function getAllUser(){
|
|||
include : {
|
||||
achat :{
|
||||
include : {
|
||||
formation : true
|
||||
formation : {
|
||||
include : {
|
||||
fo_video : true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api-doc/react-swagger.js"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue