1
0
forked from PGL/Clyde

Finished RestApi

This commit is contained in:
Debucquoy Anthony 2023-12-07 23:27:23 +01:00
parent 5c4e981b16
commit e52b9270b7
Signed by: tonitch
GPG Key ID: A78D6421F083D42E

View File

@ -11,63 +11,114 @@ servers:
paths:
/ping:
get:
summary: Test if the api is up.
summary: Vérifie l'état de l'api.
responses:
default:
description: Standard response to ping
description: Retourne pong
content:
text/plain:
schema:
type: string
example: pong
/requests:
post:
summary: Faire une demande
tags:
- Student
responses:
'201':
description: Demande envoyée
/users:
get:
summary: Listere les utilisateurs
summary: Liste les utilisateurs
tags:
- SI
security:
- bearer: []
parameters:
- in: query
name: type
required: false
schema:
type: string
enum: [teacher, student, secretary]
responses:
default:
description: Success
'200':
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
'401':
$ref: '#/components/responses/UnauthorizedError'
/user: # registration
/user:
get:
summary: Récupére ses informations
tags:
- Users
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: "#/components/schemas/User"
post:
summary: Créer un utilisateur
tags:
- users
- Users
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
LastName:
type: string
FirstName:
type: string
Email:
type: string
Address:
$ref: "#/components/schemas/Address"
BirthDate:
type: string
description: Follow the iso 8601 ("YYYY-MM-DD")
example:
{
"LastName": "Doe" ,
"FirstName": "John",
"Email": "John.Doe@example.com",
"Address": {
"Address": "Rue de Tounais 42",
"Country": "BE"},
"BirthDate": "1941-02-22",
}
responses:
'200':
'201':
description: User created
'401':
$ref: '#/components/responses/UnauthorizedError'
patch:
summary: modifier ses informations
tags:
- users
- Users
security:
- bearer: []
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User'
responses:
'200':
description: Informaitions modifiées
'201':
description: Informations modifiées
'401':
$ref: '#/components/responses/UnauthorizedError'
/user/{mat}:
get:
summary: get user's info
summary: Récupérer les informations d'un utilisateur
tags:
- Admin
responses:
'200':
description: User found
description: Utilisateur trouvé
content:
application/json:
schema:
@ -85,65 +136,56 @@ paths:
- Admin
security:
- bearer: []
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User'
responses:
'200':
description: Informaitions modifiées
'201':
description: Informations modifiées
'401':
$ref: '#/components/responses/UnauthorizedError'
/users/requests:
get:
summary: Lister les requetes d'utilisateurs
/course:
post:
summary: Créer un nouveau cours
tags:
- Courses
- Secretariat
security:
- bearer: []
tags:
- Secretaria
- SI
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
courses:
type: array
items:
type: string
responses:
'200':
description: Liste les requètes
/user/{mat}/validate/{id}:
patch:
summary: Valider un utilisateur
tags:
- Secretaria
- SI
security:
- bearer: []
parameters:
- name: mat
in: path
description: matricule de l'utilisateur
required: true
schema:
type: integer
- name: id
in: path
description: Identifiant de la demande
required: true
schema:
type: integer
- name: answer
in: header
description: valide l'utilisateur ou non
schema:
type: boolean
responses:
'200':
description: Informaitions modifiées
'201':
description: Nouveau cours crée
'401':
$ref: '#/components/responses/UnauthorizedError'
/courses/{id}:
get:
summary: Voir les informations sur un cours*
summary: Voir les informations sur un cours
tags:
- Courses
responses:
'202':
description: success
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Course'
parameters:
- name: id
in: path
@ -154,49 +196,107 @@ paths:
summary: Suprimer un cours
tags:
- Courses
- Secretaria
- Secretariat
security:
- bearer: []
responses:
'202':
description: success
'201':
description: Success
'401':
$ref: '#/components/responses/UnauthorizedError'
patch:
summary: Changer les options du cours
tags:
- Secretaria
- Secretariat
- Courses
security:
- bearer: []
parameters:
- name: professeur
in: header
required: true
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
responses:
'202':
description: Bien ouej
'201':
description: Cours modifié
'401':
$ref: '#/components/responses/UnauthorizedError'
/cursus:
post:
summary: Créer un nouveau cours
summary: Créer un nouveau cursus
tags:
- cursus
security:
- bearer: []
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
responses:
'202':
description: success
'201':
description: Nouveau cursus crée
'401':
$ref: '#/components/responses/UnauthorizedError'
/cursus/{id}:
get:
summary: Voir les informations sur un cursus
tags:
- cursus
responses:
'202':
description: success
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Cursus'
parameters:
- name: id
in: path
@ -210,29 +310,49 @@ paths:
security:
- bearer: []
responses:
'202':
description: success
'201':
description: Success
'401':
$ref: '#/components/responses/UnauthorizedError'
patch:
summary: Changer les options du cursus
tags:
- cursus
security:
- bearer: []
requestBody:
require: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
responses:
'202':
description: Bien ouej
/courses:
post:
summary: Créer un nouveau cours
tags:
- Courses
- Secretaria
security:
- bearer: []
responses:
'202':
description: success
'201':
description: Cours modifié
'401':
$ref: '#/components/responses/UnauthorizedError'
components:
@ -244,54 +364,81 @@ components:
User:
type: object
properties:
RegNo:
regNo:
type: integer
Photo:
photo:
type: object
LastName:
lastName:
type: string
FirstName:
firstName:
type: string
Email:
email:
type: string
Address:
address:
$ref: "#/components/schemas/Address"
BirthDate:
birthDate:
type: string
description: Follow the iso 8601 ("YYYY-MM-DD")
StaffMember:
type: boolean
example:
{
"RegNo": 42,
"LastName": "Doe" ,
"FirstName": "John",
"Email": "John.Doe@example.com",
"Address": {
"Address": "Rue de Tounais 42",
"Country": "BE"},
"BirthDate": "1941-02-22",
"StaffMember": true,
"regNo": 42,
"lastName": "Doe" ,
"firstName": "John",
"email": "John.Doe@example.com",
"address": {
"address": "Rue de Tounais 42",
"country": "BE"},
"birthDate": "1941-02-22",
"staffMember": true,
}
Address:
type: object
properties:
Address:
address:
type: string
Country:
country:
type: string
description: Follow the ISO-3166-1 alpha-2 standard.
example:
{
"Address": "Rue de Tounais 42",
"Country": "BE"
"address": "Rue de Tounais 42",
"country": "BE"
}
Course:
type: object
properties:
id:
type: integer
name:
type: string
credits:
type: integer
faculty:
type: string
teachers:
type: object
$ref: '#/components/schemas/User'
assistants:
type: array
items:
$ref: '#/components/schemas/User'
example:
{
"id": 42,
"name": "Math pour l'info",
"credits": 11,
"faculty": "science",
"Teacher": ,
"Assistants": [ ]
}
Cursus:
type: object
properties:
Id:
id:
type: integer
Courses:
name:
type: string
courses:
type: array
items:
type: string
@ -302,4 +449,4 @@ components:
}
responses:
UnauthorizedError:
description: Access token is missing or invalid
description: Permission non accordée