diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..0f031a1 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,77 @@ +--- +kind: pipeline +type: docker +name: test + +steps: + - name: Backend-Tests + image: eclipse-temurin:21 + workspace: backend/ + commands: + - echo "Backend CI Test TODO" + - name: FrontEnd-Tests + image: node:lts-alpine + workspace: frontend/ + commands: + - echo "Frontend CI Test TODO" + +--- +kind: pipeline +type: docker +name: build + +depends_on: + - test + +steps: + - name: Backend-build + image: eclipse-temurin:21 + workspace: backend/ + commands: + - echo "Backend CI build TODO" + - name: FrontEnd-build + image: node:lts-alpine + workspace: frontend/ + commands: + - echo "Frontend CI build TODO" + +--- +kind: pipeline +type: exec +name: deploy + +depends_on: + - build + +server: + host: + from_secret: host + user: + from_secret: user + ssh_key: + from_secret: ssh_key + +plateform: + os: linux + arch: amd64 + +trigger: + branch: + - master + event: + - push + +steps: + - name: deploy frontend + commands: + - cd frontend + - npm run build + - install -d "dist/" "$HOME/dist" + - name: deploy backend + commands: + - echo "deploying backend TODO" +--- +kind: signature +hmac: 3c5387c57626f0946636d82b97fad0daaf09dbb5f02f201791363ff33cc0bb82 + +... diff --git a/Documents/proto/general/openapi.yaml b/Documents/proto/general/openapi.yaml index 95b6d36..4354257 100644 --- a/Documents/proto/general/openapi.yaml +++ b/Documents/proto/general/openapi.yaml @@ -18,6 +18,10 @@ tags: description: Scientifics articles extension's endpoints - name: Ext (Schedule) description: Schedule extension's endpoints + - name: Ext (Student Registration) + description: Student Registration's endpoints + - name: Ext (Messaging) + description: Messaging extension's endpoints paths: /ping: @@ -31,6 +35,662 @@ paths: schema: type: string example: pong + # Messaging + + /forum: + get: + summary: get list of available forum + security: + - bearer: [] + tags: + - Ext (Messaging) + - Forum + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + required: + - id + - name + - owner + properties: + id: + type: integer + name: + type: string + owner: + type: integer + description: user id of the teacher + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: Create a new forum + security: + - bearer: [] + tags: + - Ext (Messaging) + - Forum + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + courseId: + type: integer + responses: + '201': + description: User created + '401': + $ref: '#/components/responses/UnauthorizedError' + /forum/{forumId}: + parameters: + - name: forumId + in: path + description: Id of the forum + required: true + schema: + type: integer + get: + summary: get informations about a forum + tags: + - Ext (Messaging) + - Forum + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + required: + - id + - name + - owner + properties: + id: + type: integer + name: + type: string + owner: + type: integer + description: user id of the teacher + topics: + type: array + items: + type: object + properties: + id: + type: integer + name: + type: string + autor: + type: integer + description: user Id + registered: + description: List of registered user only if have the authorisation to view + type: array + items: + type: integer + description: userId + '401': + $ref: '#/components/responses/UnauthorizedError' + delete: + summary: remove the forum + security: + - bearer: [] + tags: + - Ext (Messaging) + - Forum + responses: + '201': + description: Forum deleted + '401': + $ref: '#/components/responses/UnauthorizedError' + /forum/{forumId}/topic: + parameters: + - name: forumId + in: path + description: Id of the forum + required: true + schema: + type: integer + get: + summary: list topics of a forum + tags: + - Ext (Messaging) + - Forum + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + required: + - id + - name + - author + properties: + id: + type: integer + name: + type: string + author: + type: integer + description: user id of the author + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: create a new topic in the forum + tags: + - Ext (Messaging) + - Forum + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + subject: + type: string + content: + type: integer + responses: + '201': + description: post created + '401': + $ref: '#/components/responses/UnauthorizedError' + /forum/{forumId}/topic/{topicId}: + parameters: + - name: forumId + in: path + description: Id of the forum + required: true + schema: + type: integer + - name: topicId + in: path + description: Id of the topic + required: true + schema: + type: integer + get: + summary: get info about a topic + tags: + - Ext (Messaging) + - Forum + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + required: + - id + - name + - author + - locked + properties: + id: + type: integer + name: + type: string + author: + type: integer + description: user id of the author + locked: + type: boolean + description: define if the topic is locked to new responses or not + '401': + $ref: '#/components/responses/UnauthorizedError' + delete: + summary: delete a topic + security: + - bearer: [] + tags: + - Ext (Messaging) + - Forum + responses: + '201': + description: Topic deleted + '401': + $ref: '#/components/responses/UnauthorizedError' + /forum/{forumId}/topic/{topicId}/response: + parameters: + - name: forumId + in: path + description: Id of the forum + required: true + schema: + type: integer + - name: topicId + in: path + description: Id of the topic + required: true + schema: + type: integer + get: + summary: list responses of a topic + tags: + - Ext (Messaging) + - Forum + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: integer + author: + type: integer + description: user id of the author + content: + type: string + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: create a new response + tags: + - Ext (Messaging) + - Forum + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + content: + type: integer + responses: + '201': + description: Message posted + '401': + $ref: '#/components/responses/UnauthorizedError' + /forum/{forumId}/topic/{topicId}/response/{responseId}: + parameters: + - name: forumId + in: path + description: Id of the forum + required: true + schema: + type: integer + - name: topicId + in: path + description: Id of the topic + required: true + schema: + type: integer + - name: responseId + in: path + description: Id of the response + required: true + schema: + type: integer + get: + summary: get info on a response + tags: + - Ext (Messaging) + - Forum + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + required: + - id + - author + - content + properties: + id: + type: integer + author: + type: string + content: + type: integer + '401': + $ref: '#/components/responses/UnauthorizedError' + delete: + summary: delete a response + tags: + - Ext (Messaging) + - Forum + responses: + '201': + description: Message deleted + '401': + $ref: '#/components/responses/UnauthorizedError' + + /discussion: + get: + summary: get list of available discussions + tags: + - Ext (Messaging) + - discussion + responses: + '201': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: integer + name: + type: string + users: + type: array + items: + type: integer + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: create a new discussion + tags: + - Ext (Messaging) + - discussion + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + users: + type: array + description: id of users + items: + type: integer + responses: + '201': + description: Discussion created + '401': + $ref: '#/components/responses/UnauthorizedError' + /discussion/{id}: + parameters: + - name: id + in: path + description: Id of the discussion + required: true + schema: + type: integer + get: + summary: get info on a discussion + tags: + - Ext (Messaging) + - discussion + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + required: + - id + - name + - users + properties: + id: + type: integer + name: + type: string + users: + type: integer + description: user ids of participants + '401': + $ref: '#/components/responses/UnauthorizedError' + /discussion/{id}/msg: + parameters: + - name: id + in: path + description: Id of the discussion + required: true + schema: + type: integer + get: + summary: list messages in a discussion + tags: + - Ext (Messaging) + - discussion + responses: + '200': + description: Ok + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: integer + datetime: + type: integer + author: + type: integer + content: + type: string + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: post a new message in a discussion + tags: + - Ext (Messaging) + - discussion + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: string + description: message content + responses: + '201': + description: Message sent + '401': + $ref: '#/components/responses/UnauthorizedError' + /discussion/{id}/msg/{msgId}: + parameters: + - name: id + in: path + description: Id of the discussion + required: true + schema: + type: integer + - name: msgId + in: path + description: Id of the message + required: true + schema: + type: integer + get: + summary: get info about message + tags: + - Ext (Messaging) + - discussion + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + id: + type: integer + datetime: + type: integer + author: + type: integer + content: + type: string + '401': + $ref: '#/components/responses/UnauthorizedError' + delete: + summary: delete a message + security: + - bearer: [] + tags: + - Ext (Messaging) + - discussion + responses: + '201': + description: Message deleted + '401': + $ref: '#/components/responses/UnauthorizedError' + + + /appointment: + get: + summary: list appointments + tags: + - Ext (Messaging) + - appointment + parameters: + - name: type + in: query + required: false + schema: + type: string + enum: [open, closed] + responses: + '200': + description: Ok + content: + text/calendar: + schema: + type: string + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: integer + teacher: + type: integer + student: + type: integer + date: + type: integer + status: + type: string + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: create a new appointment + tags: + - Ext (Messaging) + - appointment + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + content: + type: integer + datetime: + type: integer + to: + type: integer + description: user id of the person to request to + responses: + '201': + description: Appointment created + '401': + $ref: '#/components/responses/UnauthorizedError' + /appointment/{id}: + parameters: + - name: id + in: path + description: Id of the appointment + required: true + schema: + type: integer + get: + summary: get info on an appointment + tags: + - Ext (Messaging) + - appointment + responses: + '200': + description: Ok + content: + text/calendar: + schema: + type: string + application/json: + schema: + type: object + properties: + id: + type: integer + teacher: + type: integer + student: + type: integer + date: + type: integer + status: + type: string + '401': + $ref: '#/components/responses/UnauthorizedError' + post: + summary: Accept, decline or propose a new schedule for the appointment + tags: + - Ext (Messaging) + - appointment + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + action: + type: string + enum: [accept, refuse, propose] + data: + type: object + description: context dependant response (can be null) + responses: + '201': + description: Done + '401': + $ref: '#/components/responses/UnauthorizedError' + +# general /users: get: summary: list all users @@ -44,7 +704,7 @@ paths: name: type required: false schema: - $ref: '#components/schemas/Roles' + $ref: '#/components/schemas/Roles' responses: '200': description: OK @@ -377,7 +1037,141 @@ paths: description: Cursus modified '401': $ref: '#/components/responses/UnauthorizedError' + + /Requests/{type}: + get: + summary: Give an array of every requests of the specified type + tags : + - Requests + - SI + - Ext (Student Registration) + responses : + '200': + description : OK + content : + application/json : + schema : + type : array + items : + allOf: + - type : object + properties : + id : + type : integer + - oneOf : + - $ref : '#/components/schemas/RRRequest' + - $ref : '#/components/schemas/SSRequest' + - $ref : '#/components/schemas/UnRegRequest' + - $ref : '#/components/schemas/ExempRequest' + - $ref : '#/components/schemas/RegRequest' + discriminator: + propertyName : type + parameters: + - name: type + in: path + description: type of the request + required: true + schema: + type: integer + post : + summary: create a request + tags : + - Requests + - Guest + - Student + - Ext (Student Registration) + security: + - bearer: [] + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + oneOf: + - $ref : '#/components/schemas/RRRequest' + - $ref : '#/components/schemas/SSRequest' + - $ref : '#/components/schemas/UnRegRequest' + - $ref : '#/components/schemas/ExempRequest' + - $ref : '#/components/schemas/RegRequest' + discriminator: + propertyName : type + responses: + '201': + description: New request created + '401': + $ref : '#/components/responses/UnauthorizedError' + + /Requests/{type}/{id}: + parameters: + - name: type + in: path + description: type of the request + required: true + schema: + type: integer + + - name : id + in : path + description: id of the selected Request + required : true + schema : + type : integer + + get : + summary : Get all the data composing a request + tags : + - Requests + - SI + - Teacher + - Ext (Student Registration) + responses : + '200': + description : OK + content : + application/json : + schema : + allOf: + - type : object + properties : + id : + type : integer + - oneOf : + - $ref : '#/components/schemas/RRRequest' + - $ref : '#/components/schemas/SSRequest' + - $ref : '#/components/schemas/UnRegRequest' + - $ref : '#/components/schemas/ExempRequest' + - $ref : '#/components/schemas/RegRequest' + discriminator: + propertyName : type + + patch: + summary: Change the state of request + tags: + - Requests + - SI + - Teacher + - Ext (Student Registration) + security: + - bearer: [] + requestBody: + required : true + content: + application/x-www-form-urlencoded: + schema: + oneOf : + - $ref : '#/components/schemas/RRRequest' + - $ref : '#/components/schemas/SSRequest' + - $ref : '#/components/schemas/UnRegRequest' + - $ref : '#/components/schemas/ExempRequest' + - $ref : '#/components/schemas/RegRequest' + discriminator: + propertyName : type + responses: + '201': + description: State modified + '401': + $ref: '#/components/responses/UnauthorizedError' /lesson: post: @@ -777,6 +1571,7 @@ paths: summary: get a list of article's data tags: - Users + - Guest - Ext (scientific articles) responses: '200': @@ -886,6 +1681,84 @@ components: Roles: type: string enum: [teacher, student, secretary] + + RegRequest: + type : object + properties: + Name : + type: string + Firstname : + type : string + Address : + $ref: "#/components/schemas/Address" + Email: + type : string + BirthDate: + type : string + description: Follow the iso 8601 ("YYYY-MM-DD") + Cursus: + type : integer + description : ID of a specific cursus + Photo: + type : string + description: Path of the picture that the user uploaded + + IdentityCard: + type : string + description: Path of the picture of the user's identity card + Degree: + type : string + description: Path of the pdf containing the user's degree + Certificate: + type : string + description: Path of the pdf containing the user's admission certificate (optionnal) + ForeignerCertificate: + type : string + description: Path of the pdf containing the user's foreigner certificate (optionnal) + State: + type : string + + + RRRequest: + type : object + properties : + RegNo : + type : integer + NewCursusid : + type : integer + State : + type : string + + + SSRequest: + type : object + properties : + RegNo : + type : integer + Amount : + type : integer + Document : + type : string + description : justification document for a scholarship + + UnRegRequest : + type : object + properties : + RegNo : + type : integer + State : + type : string + + ExempRequest : + type : object + properties : + RegNo : + type : integer + Courseid : + type : integer + State : + type : string + Article: type: object properties: @@ -1018,10 +1891,7 @@ components: "displayMode": "grid", "UserId": 12 } + responses: UnauthorizedError: description: Unauthorized access or missing bearer - - - - diff --git a/Documents/proto/messaging_extension/ERD.md b/Documents/proto/messaging_extension/ERD.md new file mode 100644 index 0000000..0a4108c --- /dev/null +++ b/Documents/proto/messaging_extension/ERD.md @@ -0,0 +1,87 @@ +# Entity relational diagram + +## Messaging extension + +```mermaid +%%{init: { "er": {"fontSize": 25, "stroke": "black" }}}%% +erDiagram + +%% General +Users + +%% Messages +Discussions{ + Integer id PK + String name +} + +Messages{ + Integer id PK + Integer response FK "Messages" + String content +} + +Discussions ||--o{ Messages: "" +Discussions ||--o{ Users: "" + +Messages o|--o{ Messages: "answers" + +%% Forums +Forums{ + Integer id PK + String name + Integer course FK "Course" +} + +Topics{ + Integer id PK + String subject + String content + Boolean locked +} +Answers{ + Integer id PK + String content + Boolean anonymous + TimeStamp creation_time +} + +Polls{ + Integer id PK + enum PollType +} +Options{ + Integer id PK + String name +} + +Forums ||--o{ Users: "Registered" +Forums ||--|| Teacher: "Owner" +Forums ||--o{ Topics: "" +Forums ||--o{ Polls: "" + +Topics ||--|| Teacher: "Author" +Topics ||--|| Users: "Author" +Topics ||--o{ Answers: "" + +Polls ||--o{ Options: "" + +Options ||--o{ Votes : "" + +Votes }o--|| Users: "Voter" + + +%% Appointments +Teacher +Appointments{ + Integer id PK + Integer teacher FK "Teacher" + TIME sent_time + enum Status +} + +Appointments ||--|| Users: "" + +``` + +Debucquoy Anthony diff --git a/Documents/proto/messaging_extension/Makefile b/Documents/proto/messaging_extension/Makefile index cf0e6b4..7ba3e31 100644 --- a/Documents/proto/messaging_extension/Makefile +++ b/Documents/proto/messaging_extension/Makefile @@ -11,8 +11,9 @@ extension_messagerie.pdf:use_case_messagerie.tex extension_messagerie.bbl extens use_case_messagerie.tex: use_case_messagerie.uml plantuml -tlatex:nopreamble use_case_messagerie.uml -image: use_case_messagerie.uml interaction_diagram.uml +image: use_case_messagerie.uml interaction_diagram.uml class.uml plantuml $^ + mmdc -i ERD.md -o ERD.png extension_messagerie.bbl: extension_messagerie.bcf biber extension_messagerie @@ -24,6 +25,7 @@ clean: latexmk -C rm -f use_case_messagerie.tex rm -f extension_messagerie.{bbl,run.xml} + rm -f class.tex run: extension_messagerie.pdf xdg-open $< diff --git a/Documents/proto/messaging_extension/class.uml b/Documents/proto/messaging_extension/class.uml new file mode 100644 index 0000000..48ef5b9 --- /dev/null +++ b/Documents/proto/messaging_extension/class.uml @@ -0,0 +1,86 @@ +@startuml +title Class diagram for Messaging extension + +package Messages { + class Message{ + content: String + response: Message + respond(User, String) + } + class Discussion{ + name: String + users: ArrayList + invite(User) + sendMessage(User, String) + } + Discussion *-- Message +} + +package Forums { + class Forum{ + name: String + Owner: Teacher + Registered: ArrayList + {static} createForum(Course): Forum + createTopic(String): Topic + createPoll(String, PollType, ArrayList