From 95888a46003c299e2294ba9d5114afb8935f5106 Mon Sep 17 00:00:00 2001 From: Debucquoy Anthony Date: Thu, 14 Dec 2023 13:57:06 +0100 Subject: [PATCH] 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 Co-authored-by: Debucquoy Reviewed-on: https://git.herisson.ovh/PGL/Clyde/pulls/12 Reviewed-by: Wal --- Documents/proto/general/openapi.yaml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml index 7a4cf3a..95b6d36 100644 --- a/Documents/proto/general/openapi.yaml +++ b/Documents/proto/general/openapi.yaml @@ -44,8 +44,7 @@ paths: name: type required: false schema: - type: string - enum: [teacher, student, secretary] + $ref: '#components/schemas/Roles' responses: '200': description: OK @@ -98,6 +97,8 @@ paths: BirthDate: type: string description: Follow the iso 8601 ("YYYY-MM-DD") + Role: + $ref: "#/components/schemas/Roles" example: { "LastName": "Doe" , @@ -107,6 +108,7 @@ paths: "Address": "Rue de Tournais 42", "Country": "BE"}, "BirthDate": "1941-02-22", + "Role": "student" } responses: '201': @@ -253,7 +255,8 @@ paths: faculty: type: string teachers: - $ref: '#/components/schemas/User' + type: integer + description: Teacher's identifier assistants: type: array items: @@ -809,6 +812,8 @@ components: birthDate: type: string description: Follow the iso 8601 ("YYYY-MM-DD") + role: + $ref: '#/components/schemas/Roles' example: { "regNo": 42, @@ -819,7 +824,7 @@ components: "address": "Rue de Tournais 42", "country": "BE"}, "birthDate": "1941-02-22", - "staffMember": true, + "role": "student" } Address: type: object @@ -878,6 +883,9 @@ components: "id": 42, "courses": ['Math', 'Info'] } + Roles: + type: string + enum: [teacher, student, secretary] Article: type: object properties: