Adding role to users (#12)

A user is defined by it's role and should be defined in it's setter and
getter

Closes #8

Co-authored-by: Anthony Debucquoy <debucquoy.anthony@gmail.com>
Co-authored-by: Debucquoy <debucqquoy.anthony@gmail.com>
Reviewed-on: #12
Reviewed-by: Wal <karpinskiwal@gmail.com>
This commit is contained in:
Debucquoy Anthony 2023-12-14 13:57:06 +01:00
parent f0f60de12f
commit 95888a4600

View File

@ -44,8 +44,7 @@ paths:
name: type name: type
required: false required: false
schema: schema:
type: string $ref: '#components/schemas/Roles'
enum: [teacher, student, secretary]
responses: responses:
'200': '200':
description: OK description: OK
@ -98,6 +97,8 @@ paths:
BirthDate: BirthDate:
type: string type: string
description: Follow the iso 8601 ("YYYY-MM-DD") description: Follow the iso 8601 ("YYYY-MM-DD")
Role:
$ref: "#/components/schemas/Roles"
example: example:
{ {
"LastName": "Doe" , "LastName": "Doe" ,
@ -107,6 +108,7 @@ paths:
"Address": "Rue de Tournais 42", "Address": "Rue de Tournais 42",
"Country": "BE"}, "Country": "BE"},
"BirthDate": "1941-02-22", "BirthDate": "1941-02-22",
"Role": "student"
} }
responses: responses:
'201': '201':
@ -253,7 +255,8 @@ paths:
faculty: faculty:
type: string type: string
teachers: teachers:
$ref: '#/components/schemas/User' type: integer
description: Teacher's identifier
assistants: assistants:
type: array type: array
items: items:
@ -809,6 +812,8 @@ components:
birthDate: birthDate:
type: string type: string
description: Follow the iso 8601 ("YYYY-MM-DD") description: Follow the iso 8601 ("YYYY-MM-DD")
role:
$ref: '#/components/schemas/Roles'
example: example:
{ {
"regNo": 42, "regNo": 42,
@ -819,7 +824,7 @@ components:
"address": "Rue de Tournais 42", "address": "Rue de Tournais 42",
"country": "BE"}, "country": "BE"},
"birthDate": "1941-02-22", "birthDate": "1941-02-22",
"staffMember": true, "role": "student"
} }
Address: Address:
type: object type: object
@ -878,6 +883,9 @@ components:
"id": 42, "id": 42,
"courses": ['Math', 'Info'] "courses": ['Math', 'Info']
} }
Roles:
type: string
enum: [teacher, student, secretary]
Article: Article:
type: object type: object
properties: properties: