Skip to content
Gabriel Lima edited this page Jul 3, 2025 · 2 revisions

EAP: Architecture Specification and Prototype

ClarityQuest is a Collaborative Q&A platform, aiming to help you answer all your questions about a wide range of topics while giving you the opportunity to provide knowledge to people in need!

A7: Web Resources Specification

This artifact presents an overview of the web resources we aim to implement in the vertical prototype for ClarityQuest, organized into modules. It also includes the permissions used in the modules to establish the conditions of access to resources. Web resources are specified using the OpenAPI standard.

1. Modules

Module Name Description
M01 Authentication and Individual Profile Web resources associated with user authentication and individual profile management. Includes the following system features: login/logout, registration, credential recovery, view and edit personal profile information.
M02 Q&A Web resources associated with questions and their related answers and comments. Includes the following system features: question view list and search, posts edit and delete posts, upvote and downvote.
M03 Profiles Web resources associated with user profiles. Includes the following system features: view user details, list user questions, list user answers, list user comments, view and edit followed topics, view and edit followed questions.
M04 Notifications Web resources associated with notifications, specifically: view notification, list notifications.
M05 User Administration Web resources associated with user management, specifically: view and search users, delete or block user accounts, view and change user information, and view system access details for each user.
M06 Static Pages Web resources with static content are associated with this module: Home, About, Contacts, FAQ and Main Features.

2. Permissions

Permission Name Description
BLOCK Blocked Blocked users without access to view or create content.
PUB Public Users without privileges.
REG Regular/Clarifiers Registered users that have functional access to all content. They may search and view content, interact and add comments/answers to questions and create questions.
OWN Owners/Questioners Users that own information (e.g., own questions, own answers, own comments).
MOD Moderator System moderators. They may remove content and block users from accessing all content.
ADMIN Administrator System administrators. They may change and remove all content, including changing user details and removing or blocking users from accessing all content.

3. OpenAPI Specification

The following OpenAPI specification in YAML format was created in order to describe the web resources that will be present in the Vertical Prototype.

openAPI

openapi: 3.0.0
info:
  version: "1.0"
  title: LBAW ClarityQuest Web API
  description: Web Resources Specification (A7) for our Collaborative Q&A Web App
    - ClarityQuest
servers:
  - url: http://lbaw24125.fe.up.pt/24125
    description: Production server
externalDocs:
  description: Find more info here.
  url: https://gitlab.up.pt/lbaw/lbaw2425/lbaw24125/-/wikis/home
tags:
  - name: "M01: Authentication and Individual Profile"
  - name: "M02: Q&A"
  - name: "M03: Profiles"
  - name: "M04: Notifications"
  - name: "M05: User Administration"
  - name: "M06: Static Pages"
paths:
  /:
    get:
      operationId: R601
      summary: "R601: Home Page"
      description: "Display the homepage. Access: PUB"
      tags:
        - "M06: Static Pages"
      responses:
        "200":
          description: Ok. Homepage displayed successfully.
  /about:
    get:
      operationId: R602
      summary: "R602: About Us Page"
      description: "Display about us information. Access: PUB"
      tags:
        - "M06: Static Pages"
      responses:
        "200":
          description: Ok. About page displayed successfully.
  /contacts:
    get:
      operationId: R603
      summary: "R603: Contacts Page"
      description: "Display contact information. Access: PUB"
      tags:
        - "M06: Static Pages"
      responses:
        "200":
          description: Ok. Contact page displayed successfully.
  /search:
    get:
      operationId: R604
      summary: "R604: Search"
      description: "Perform a search across the platform. Access: PUB"
      tags:
        - "M06: Static Pages"
      parameters:
        - in: query
          name: q
          schema:
            type: string
          required: true
          description: Search query
      responses:
        "200":
          description: Ok. Search results retrieved successfully.
  /main-features:
    get:
      operationId: R605
      summary: "R605: Main Features Page"
      description: "Display main features of the platform. Access: PUB"
      tags:
        - "M06: Static Pages"
      responses:
        "200":
          description: Ok. Main features page displayed successfully.
  /admin:
    get:
      operationId: R501
      summary: "R501: Admin Dashboard"
      description: "Display admin dashboard. Access: ADMIN"
      tags:
        - "M05: User Administration"
      responses:
        "200":
          description: Ok. Admin dashboard displayed successfully.
        "403":
          description: Forbidden. Admin access required.
  /login:
    get:
      operationId: R101
      summary: "R101: Show Login Form"
      description: "Display login form. Access: PUB"
      tags:
        - "M01: Authentication and Individual Profile"
      responses:
        "200":
          description: Ok. Show Login UI
    post:
      operationId: R102
      summary: "R102: Authenticate User"
      description: "Process login credentials. Access: PUB"
      tags:
        - "M01: Authentication and Individual Profile"
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
              required:
                - email
                - password
      responses:
        "302":
          description: Redirect after authentication
          headers:
            Location:
              schema:
                type: string
  /logout:
    post:
      operationId: R103
      summary: "R103: Logout User"
      description: "Process user logout. Access: REG"
      tags:
        - "M01: Authentication and Individual Profile"
      responses:
        "302":
          description: Redirect after logout
          headers:
            Location:
              schema:
                type: string
  /register:
    get:
      operationId: R104
      summary: "R104: Show Registration Form"
      description: "Display user registration form. Access: PUB"
      tags:
        - "M01: Authentication and Individual Profile"
      responses:
        "200":
          description: Ok. Show Registration UI
    post:
      operationId: R105
      summary: "R105: Register New User"
      description: "Process user registration. Access: PUB"
      tags:
        - "M01: Authentication and Individual Profile"
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:
                  type: string
                email:
                  type: string
                  format: email
                password:
                  type: string
                password_confirmation:
                  type: string
              required:
                - name
                - email
                - password
                - password_confirmation
      responses:
        "302":
          description: Redirect after registration
          headers:
            Location:
              schema:
                type: string
  /profile:
    get:
      operationId: R106
      summary: "R106: View My Profile"
      description: "Display authenticated user profile. Access: REG"
      tags:
        - "M01: Authentication and Individual Profile"
      responses:
        "200":
          description: Ok. Show User Profile
  /profile/edit:
    get:
      operationId: R107
      summary: "R107: Show Profile Edit Form"
      description: "Display profile editing form. Access: REG"
      tags:
        - "M01: Authentication and Individual Profile"
      responses:
        "200":
          description: Ok. Show Profile Edit UI
  "/users/{id}":
    get:
      operationId: R301
      summary: "R301: View Public User Profile"
      description: "Display public profile of a user. Access: PUB"
      tags:
        - "M03: Profiles"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Ok. Show Public User Profile
        "404":
          description: User not found
    patch:
      operationId: R108
      summary: "R108: Update User Profile"
      description: "Update user profile information. Access: REG"
      tags:
        - "M01: Authentication and Individual Profile"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:
                  type: string
                email:
                  type: string
                  format: email
              required:
                - name
                - email
      responses:
        "302":
          description: Redirect after profile update
    delete:
      operationId: R109
      summary: "R109: Delete User Account"
      description: "Permanently delete user account. Access: REG"
      tags:
        - "M01: Authentication and Individual Profile"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: User account deleted successfully
  
  "/posts/{id}":
    post:
      operationId: R201
      summary: "R201: Vote on Post"
      description: "Submit a vote (up or down) for a post. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                vote_type:
                  type: string
                  enum:
                    - up
                    - down
      responses:
        "200":
          description: Vote registered successfully
        "302":
          description: Redirect after voting
          headers:
            Location:
              schema:
                type: string
  /followed-questions:
    get:
      operationId: R202
      summary: "R202: Get Followed Questions"
      description: "Retrieve a users followed questions. Access: REG"
      tags:
        - "M02: Q&A"
      responses:
        "200":
          description: Ok. Followed questions retrieved successfully.
        "401":
          description: Unauthorized. Authentication required.
  /my-questions:
    get:
      operationId: R203
      summary: "R203: Get My Questions"
      description: "Retrieve users own questions. Access: REG"
      tags:
        - "M02: Q&A"
      responses:
        "200":
          description: Ok. Users questions retrieved successfully.
        "401":
          description: Unauthorized. Authentication required.
  /questions/create:
    get:
      operationId: R204
      summary: "R204: Show Question Create Form"
      description: "Display form to create a new question. Access: REG"
      tags:
        - "M02: Q&A"
      responses:
        "200":
          description: Ok. Question create form displayed.
        "401":
          description: Unauthorized. Authentication required.
    post:
      operationId: R205
      summary: "R205: Create Question"
      description: "Create a new question. Access: REG"
      tags:
        - "M02: Q&A"
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                title:
                  type: string
                content:
                  type: string
                tags:
                  type: array
                  items:
                    type: string
              required:
                - title
                - content
      responses:
        "201":
          description: Question created successfully.
        "302":
          description: Redirect after question creation
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
  /questions/{id}:
    get:
      operationId: R206
      summary: "R206: Show Question Details"
      description: "Retrieve details of a specific question. Access: PUB"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Ok. Question details retrieved successfully.
    post:
      operationId: R207
      summary: "R207: Follow Question"
      description: "Follow a specific question. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Question followed successfully.
        "302":
          description: Redirect after following question
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
    delete:
      operationId: R208
      summary: "R208: Delete Question"
      description: "Delete a specific question. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Question deleted successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to delete this question.
    patch:
      operationId: R209
      summary: "R209: Update Question"
      description: "Update a specific question. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                title:
                  type: string
                content:
                  type: string
              required:
                - title
                - content
      responses:
        "200":
          description: Question updated successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to update this question.
  /questions/{id}/tags:
    post:
      operationId: R210
      summary: "R210: Add Tag to Question"
      description: "Add a tag to a specific question. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                tag_id:
                  type: integer
              required:
                - tag_id
      responses:
        "200":
          description: Tag added to question successfully.
        "302":
          description: Redirect after adding tag
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to add tags.
  /questions/{id}/tags/remove:
    post:
      operationId: R211
      summary: "R211: Remove Tag from Question"
      description: "Remove a specific tag from a question. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                tag:
                  type: string
      responses:
        "200":
          description: Tag removed successfully
        "302":
          description: Redirect after tag removal
          headers:
            Location:
              schema:
                type: string
  /my-answers:
    get:
      operationId: R212
      summary: "R212: Get My Answers"
      description: "Retrieve users own answers. Access: REG"
      tags:
        - "M02: Q&A"
      responses:
        "200":
          description: Ok. Users answers retrieved successfully.
        "401":
          description: Unauthorized. Authentication required.
  /answers:
    put:
      operationId: R213
      summary: "R213: Create Answer"
      description: "Create a new answer. Access: REG"
      tags:
        - "M02: Q&A"
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                question_id:
                  type: integer
                content:
                  type: string
              required:
                - question_id
                - content
      responses:
        "201":
          description: Answer created successfully.
        "302":
          description: Redirect after answer creation
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
  /answers/{id}:
    delete:
      operationId: R214
      summary: "R214: Delete Answer"
      description: "Delete a specific answer. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Answer deleted successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to delete this answer.
    patch:
      operationId: R215
      summary: "R215: Update Answer"
      description: "Update a specific answer. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                content:
                  type: string
              required:
                - content
      responses:
        "200":
          description: Answer updated successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to update this answer.
  /answers/{id}/correct:
    post:
      operationId: R216
      summary: "R216: Mark Answer as Correct"
      description: "Mark an answer as correct for a question. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Answer marked as correct successfully.
        "302":
          description: Redirect after marking answer as correct
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to mark this answer.
  /comments:
    put:
  operationId: R217
  summary: "R217: Create Comment"
  description: "Create a new comment. Access: REG"
  tags:
    - "M02: Q&A"
  requestBody:
    required: true
    content:
      application/x-www-form-urlencoded:
        schema:
          type: object
          properties:
            content:
              type: string
            related_id:
              type: integer
            related_type:
              type: string
              enum:
                - question
                - answer
          required:
            - content
            - related_id
            - related_type
  responses:
    "201":
      description: Comment created successfully.
    "302":
      description: Redirect after comment creation
      headers:
        Location:
          schema:
            type: string
    "401":
      description: Unauthorized. Authentication required.
  /comments/{id}:
    delete:
      operationId: R218
      summary: "R218: Delete Comment"
      description: "Delete a specific comment. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Comment deleted successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to delete this comment.
    patch:
      operationId: R219
      summary: "R219: Update Comment"
      description: "Update a specific comment. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                content:
                  type: string
              required:
                - content
      responses:
        "200":
          description: Comment updated successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to update this comment.
  /followed-tags:
    get:
      operationId: R220
      summary: "R220: Get Followed Tags"
      description: "Retrieve users followed tags. Access: REG"
      tags:
        - "M02: Q&A"
      responses:
        "200":
          description: Ok. Followed tags retrieved successfully.
        "401":
          description: Unauthorized. Authentication required.
  /tags:
    put:
      operationId: R221
      summary: "R221: Create Tag"
      description: "Create a new tag. Access: ADMIN"
      tags:
        - "M02: Q&A"
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:
                  type: string
              required:
                - name
      responses:
        "201":
          description: Tag created successfully.
        "302":
          description: Redirect after tag creation
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
  /tags/{id}:
    get:
      operationId: R222
      summary: "R222: Show Tag Details"
      description: "Retrieve tag details. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Ok. Tag details retrieved successfully.
        "401":
          description: Unauthorized. Authentication required.
    delete:
      operationId: R223
      summary: "R223: Delete Tag"
      description: "Delete a specific tag. Access: ADMIN"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Tag deleted successfully.
        "401":
          description: Unauthorized. Authentication required.
    patch:
      operationId: R224
      summary: "R224: Update Tag"
      description: "Update a specific tag. Access: ADMIN"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:
                  type: string
              required:
                - name
      responses:
        "200":
          description: Tag updated successfully.
        "401":
          description: Unauthorized. Authentication required.
    post:
      operationId: R225
      summary: "R225: Follow Tag"
      description: "Follow a specific tag. Access: REG"
      tags:
        - "M02: Q&A"
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Tag followed successfully.
        "302":
          description: Redirect after following tag
          headers:
            Location:
              schema:
                type: string
        "401":
          description: Unauthorized. Authentication required.
  /notifications:
    get:
      operationId: R401
      summary: "R401: Get User Notifications"
      description: "Fetch a list of notifications for the authenticated user. Access: REG"
      tags:
        - "M04: Notifications"
      responses:
        "200":
          description: A list of notifications retrieved successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to view notifications.
  /notifications/{id}:
    delete:
      operationId: R402
      summary: "R402: Delete Notification"
      description: "Delete a specific notification for the authenticated user. Access: REG"
      tags:
        - "M04: Notifications"
      parameters:
        - in: path
          name: id
          required: true
          description: "ID of the notification to be deleted"
          schema:
            type: integer
      responses:
        "204":
          description: Notification deleted successfully.
        "401":
          description: Unauthorized. Authentication required.
        "403":
          description: Forbidden. User not authorized to delete this notification.
        "404":
          description: Notification not found.

A8: Vertical prototype

The Vertical Prototype aimed to implement most of the high priority features defined by the proposed user stories in ER. In this report we will mention all of the features we were actually able to implement, as well as the implemented web resources.

1. Implemented Features

1.1. Implemented User Stories

For the ClarityQuest system, consider the user stories that are presented in the following sections.

1.1.1. Guest
Identifier Name Priority Implementation Status
US01 Sign-in high Fully Implemented
US02 Sign-up high Fully Implemented
US03 Recover Password high Not Implemented (framework need)

Table 2: Visitor user stories

1.1.2. User
Identifier Name Priority Implementation Status
US11 See Home high Fully Implemented
US12 See About high Fully Implemented
US13 Consult Main Features high Fully Implemented
US14 Consult Contacts high Fully Implemented
US15 Search high Fully Implemented
US16 View Question details high Fully Implemented
US17 See Latest Questions high Fully Implemented
US18 See Top Questions high Fully Implemented
US19 Browse by tag high Fully Implemented
US110 Browse by text high Fully Implemented
US111 Browse by full match high Fully Implemented
US112 Contextual Error Messages high Fully Implemented
US113 Contextual Help high Fully Implemented
US114 Placeholders in form inputs high Fully Implemented
US115 View User Profiles high Fully Implemented

Table 3: User user stories

1.1.3. Clarifier
Identifier Name Priority Implementation Status
US21 View Personal Feed high Fully Implemented
US22 Post Question high Fully Implemented
US23 Post Answer high Fully Implemented
US24 Vote on Questions high Fully Implemented
US25 Vote on Answers high Fully Implemented
US26 Comment on Questions high Fully Implemented
US27 Comment on Answers high Fully Implemented
US28 View My Questions high Fully Implemented
US29 View My Answers high Fully Implemented
US210 Follow Question high Fully Implemented
US211 Follow Tags high Fully Implemented
US212 Edit Answer high Fully Implemented
US213 Delete Answer high Fully Implemented
US214 Edit Comment high Fully Implemented
US215 Delete Comment high Fully Implemented
US217 Get Notifications when a question is answered high Fully Implemented
US218 Edit Profile high Fully Implemented
US219 Profile Picture Support high Fully Implemented
US220 View Personal Notifications high Fully Implemented
US221 Delete Account high Fully Implemented
US222 View Personal Profile high Fully Implemented

Table 4: Clarifier user stories

1.1.4. Questioner
Identifier Name Priority Implementation Status
US31 Edit question high Fully Implemented
US32 Delete question high Fully Implemented
US33 Mark answers as correct high Fully Implemented
US34 Edit question tags high Fully Implemented
US36 Get Notifications when a question is answered high Fully Implemented

Table 5: Questioner user stories

1.1.5. Moderator
Identifier Name Priority Implementation Status
US41 Delete comments high Fully Implemented
US42 Edit question tags medium Fully Implemented

Table 6: Moderator user stories

1.1.6 Administrator
Identifier Name Priority Description
US51 Delete answers high Fully Implemented
US52 Remove questions high Fully Implemented
US53 Delete Account high Fully Implemented
US54 Block/Unblock User Accounts high Fully Implemented
US55 Manage tags high Fully Implemented
US56 Administrator Accounts high Fully Implemented
US57 Administer User Accounts high Fully Implemented
US58 Create User Accounts high Not Implemented

Table 7: Administrator user stories

1.2. Implemented Web Resources

Module M01: Authentication and Individual Profile

Web Resource Reference URL
R101: Show Login Form /login
R102: Authenticate User /login
R103: Logout User /logout
R104: Show Registration Form /register
R105: Register New User /register
R106: View My Profile /profile
R107: Show Profile Edit Form /profile/edit
R108: Update User Profile /users/{id}
R109: Delete User Account /users/{id}

Module M02: Q&A

Web Resource Reference URL
R201: Vote on Post /posts/{id}
R202: Get Followed Questions /followed-questions
R203: Get My Questions /my-questions
R204: Show Question Create Form /questions/create
R205: Create Question /questions/create
R206: Show Question Details /questions/{id}
R207: Follow Question /questions/{id}
R208: Delete Question /questions/{id}
R209: Update Question /questions/{id}
R210: Add Tag to Question /questions/{id}/tags
R211: Remove Tag from Question /questions/{id}/tags/remove
R212: Get My Answers /my-answers
R213: Create Answer /answers
R214: Delete Answer /answers/{id}
R215: Update Answer /answers/{id}
R216: Mark Answer as Correct /answers/{id}/corect
R217: Create Comment /comments
R218: Delete Comment /comments/{id}
R219: Update Comment /comments/{id}
R220: Get Followed Tags /followed-tags
R221: Create Tag /tags
R222: Show Tag Details /tags/{id}
R223: Delete Tag /tags/{id}
R224: Update Tag /tags/{id}
R225: Follow Tag /tags/{id}

Module M03: Profiles

Web Resource Reference URL
R301: View Public User Profile /users/{id}

Module M04: Notifications

Web Resource Reference URL
R401: Get User Notifications /notifications
R402: Delete Notification /notifications/{id}

Module M05: User Administration

Web Resource Reference URL
R501: Admin Dashboard /admin

Module M06: Static Pages

Web Resource Reference URL
R601: Home Page /
R602: About Us Page /about
R603: Contacts Page /contacts
R604: Search /search
R605: Main Features Main Page /main-features

2. Prototype

Instructions to Upload and Run the Docker Image

  1. Login to GitLab Docker Registry
   docker login gitlab.up.pt:5050
  1. Upload the Docker Image
   ./upload_image.sh
  1. Run the Remote Image on a Local Machine
   docker run -d --name lbaw2425 -p 8001:80 gitlab.up.pt:5050/lbaw/lbaw2425/lbaw24125

Credentials to test all features:

Administrator

Moderator

Clarifier

Code version submission available at: https://github.com/gablm/feup_lbaw_clarityquest/tree/EAP?ref_type=tags

Revision history

Changes made to the previous delivery (EBD).

1. Atomization of Some Transactions

TRAN13 was atomized into TRAN131 and TRAN132 for more a logical implementation. We had:

Transaction TRAN13
Description Edits the tags associated with a question.
Justification As editing the tags involved deleting every tag associated with the question and inserting the new list, REPEATABLE READ is needed to ensure consistency.
Isolation level REPEATABLE READ

SQL Code

BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;

DELETE FROM PostTag WHERE post_id = (SELECT post_id FROM Question WHERE id = $1);

FOREACH tag_id IN ARRAY $2
LOOP
    INSERT INTO PostTag (post_id, tag_id) VALUES ((SELECT post_id FROM Question WHERE id = $1), tag_id);
END LOOP;

END TRANSACTION;

Now we have:

Transaction TRAN131
Description Adds a tag to a question.
Justification By using REPEATABLE READ, we ensure that the set of rows read by the transaction remains stable. This prevents phantom reads.
Isolation level REPEATABLE READ

SQL Code

BEGIN TRANSACTION;

INSERT INTO tags (name)
VALUES ($tagName)
ON CONFLICT (name) DO NOTHING;

INSERT INTO post_tag (post_id, tag_id)
SELECT q.post_id, t.id
FROM questions q, tags t
WHERE q.id = $questionId AND t.name = $tagName;

END TRANSACTION;
Transaction TRAN132
Description Removes a tag from a question.
Justification By using REPEATABLE READ, we ensure that the set of rows read by the transaction remains stable. This prevents phantom reads.
Isolation level REPEATABLE READ

SQL Code

BEGIN TRANSACTION;

-- Detach the tag from the question
DELETE FROM post_tag
WHERE post_id = (SELECT post_id FROM questions WHERE id = $questionId)
AND tag_id = (SELECT id FROM tags WHERE name = $tagName);

END TRANSACTION;

2. Renaming tables to the Laravel standard

All our table names were singular. They are now plural to match the Laravel standard, allowing for an easier Model creation.

3. Populating the DB again with more realistic data

Our data from the previous populate were large, but automated and random. We added a smaller, more realistic db for this delivery.

4. Changing some ON UPDATE/ON DELETE behaviors on SQL.

Changed ON UPDATE/ON DELETE behaviors

votes :

  • user_id -> on delete cascade

reports :

  • user_id -> may be null + on delete set null
  • post_id -> on delete cascade

5. Changes to the users table needed for OAuth API in artifacts A9/10.

Added fields:

  • remember_token
  • google_token
  • x_token

Changed fields:

  • password can now be NULL

6. Changed the priority of U216 and US35 to medium

Individual Vote Notifications may lead to spam and will be reconsidered in the next delivery.


GROUP24125, 25/11/2024