Skip to content
marhcouto edited this page Mar 5, 2022 · 1 revision

EAP: Architecture Specification and Prototype

Project vision.

A7: Web Resources Specification

1. Overview

M01: Authentication and Profile Web resources related to user Authentication and account management, such as login/logout features, registration, profile editing and others.
M02: Questions and Users Web resources related to the search, filtering and listing of questions and users in the system.
M03: Post Review Web resources associated with the evaluation of questions and answers in the website, such as upvotes or marks (marking/saving a post)
M04: Post Management Web resources linked to the management of posts (questions and answers), which include draft management, publication and edition of answers and questions, etc.
M05: User Management Web resources connected to the management of user accounts such as banning users or sending specific notifications (administrator and moderator operations)
M06: Static Pages Web resources related to static pages of the system such as About, Contact, etc.

2. Permissions

The following table shows the different permission levels used in the API.

VIS Visitor Unauthenticated users
USR User Authenticated users
OWN Owner User that owns the resource
MOD Moderator System moderators (ban priveliges and other higher functions)
ADM Admins System administrators

3. OpenAPI Specification

This sections includes the complete API specification in OpenAPI, as well as the link to the YAML file.

openapi: 3.0.0

info:
    version: '1.0'
    title: 'LBAW UNI-versal Web API'
    description: 'Web resources specification (A7) for UNI-versal'

servers:
    - url: http://lbaw-prod.fe.up.pt
      description: Production server

externalDocs: 
    description: Find more info here.
    url: https://git.fe.up.pt/lbaw/lbaw2122/lbaw2106/-/wikis/home

tags: 
    - name: 'M01: Authentication and Profile'
    - name: 'M02: Questions and Users'
    - name: 'M03: Post review'
    - name: 'M04: Post management'
    - name: 'M05: User management'
    - name: 'M06: Static Pages'

paths:

    #-------------------- M01 --------------------

    # login
    /login:
        get:
            operationId: R101
            summary: 'R101: Login Form'
            description: 'Provide login form. Access: VIS'
            tags:
              - 'M01: Authentication and Profile'

            responses:
              '200':
                description: 'Ok. Show login form UI.'


        post:
            operationId: R102
            summary: 'R102: Login Action'
            description: 'Login to the website. Access: VIS' 
            tags: 
            - 'M01: Authentication and Profile'

            requestBody:
                required: True
                content:
                    application/x-www-form-urlencoded:
                        schema:
                            type: object
                            properties:
                                password:
                                    type: string
                                email:
                                    type: string
                            required:
                                - inputPassword
                                - inputEmail
            responses:
                '302':
                    description: 'Redirect after login'
                    headers:
                      Location:
                        schema:
                          type: string
                        examples:
                          302Success:
                              description: 'Ok. Redirect to Home Page'
                              value: '/'
                          302Error:
                              description: 'Failed Authentication. Redirect to login form.'
                              value: '/login'


    /logout:
        post:
            operationId: R102
            summary: 'R102: Logout Action'
            description: 'Logout the current authenticated user. Access: USR'
            tags:
                - 'M01: Authentication and Profile'
            responses:
                '302':
                    description: 'Redirect after processing logout.'
                    headers:
                        Location:
                          schema:
                            type: string
                          examples:
                              302Success:
                                  description: 'Successful logout. Redirect to homepage.'
                                  value: '/'


    /register:
        get:
            operationId: R104
            summary: 'R104: Signup Form'
            description: 'Provide signup form. Access: VIS'
            tags:
              - 'M01: Authentication and Profile'
            responses:
              '200':
                description: 'Ok. Show sign-up form UI.'

        post:
            operationId: R105
            summary: 'R105: Signup Action'
            description: 'Signup to the website'
            tags:
                - 'M01: Authentication and Profile'
            
            requestBody:
                    required: True
                    content:
                        application/x-www-form-urlencoded:
                            schema:
                                type: object
                                properties:
                                    name:
                                        type: string
                                    password:
                                        type: string
                                    email:
                                        type: string
                                required:
                                    - name
                                    - password
                                    - email
            responses:
                '302':
                    description: 'Redirect after processing signup credentials.'
                    headers:
                      Location:
                        schema:
                          type: string
                        examples:
                            302Success:
                                description: 'Successful credential insertion. Redirect to e-mail confirmation notice.'
                                value: '/email/verify'
                            302Error: 
                                description: 'Failed credential insertion. Redirect to signup form'
                                value: '/register'



    /email/verify:
        get:
            operationId: R105
            summary: 'R105: Email verification notice'
            description: 'Provide email verification notice. Access: USR'
            tags:
                - 'M01: Authentication and Profile'
            responses:
              '200':
                description: 'Ok. Show email verification notice UI.'

       

    
    /users/{id}/profile:

        get:
            operationId: R106
            summary: 'R106: View user profile'
            description: 'Show the individual user profile. Access: USR'
            tags:
                - 'M01: Authentication and Profile'

            parameters:
              - in: path
                name: id
                schema:
                    type: integer
                required: true

            responses:
                '200':
                  description: 'Ok. Show profile UI.'
        post:
            operationId: R108
            summary: 'R108: Edit Profile Action'
            description: 'Processes the new user edition form submission. Access: USR'
            tags:
                - 'M01: Authentication and Profile'
            
            parameters:
              - in: path
                name: id
                schema:
                    type: integer
                required: true

            requestBody:
                required: true
                content:
                  application/x-www-form-urlencoded:
                    schema:
                        type: object
                        properties:
                            name:
                                type: string
                            picture:
                                type: string
                                format: binary
                            email:
                                type: string
                            role:
                                type: string
                            faculty:
                                type: string
                            area:
                                type: string


            responses:
              '302':
                description: 'Redirect after processing the user new information.'
                headers:
                    Location:
                      schema:
                          type: string
                      examples:
                          302Success:
                            description: 'Successful profile edition. Redirect to user profile.'
                            value: '/users/{id}/profile'
                          302Failure:
                            description: 'Failed to edit. Redirect to user profile.'
                            value: '/users/{id}/profile'
    
    /users/{id}/profile/edit:
        get: 
            operationId: R107
            summary: 'R107: View user profile edit form'
            description: 'Show the individual user profile edition form. Access: USR'
            tags:
                - 'M01: Authentication and Profile'

            parameters:
              - in: path
                name: id
                schema:
                    type: integer
                required: true

            responses:
                '200':
                  description: 'Ok. Show profile edition form UI.'


    /user/{id}/notifications:

      get: 
            operationId: R108
            summary: 'R108: View notifications'
            description: "Show the user's notifications. Access: USR"
            tags:
                - 'M01: Authentication and Profile'

            parameters:
              - in: path
                name: id
                schema:
                    type: integer
                required: true

            responses:
                '200':
                  description: 'Ok. Show notifications.'
        
# -------------------- M02 --------------------

    /topics/{topic_name}:
      get:
        operationId: R201
        summary: 'R201: Get Topic Page'
        description: 'Show the page where questions of a certain topic are listed. Access: USR'
        tags: 
          - 'M02: Questions and Users'

        parameters: 
          - in: path
            name: id
            schema:
                type: integer
            required: true  

        responses:
          '200':
            description: 'Ok. Show Topic UI'

    /search:
      get:
        operationId: R202
        summary: 'R202: Get Search Question Results'
        description: 'Load the questions most relevant for a given search. Access: USR'
        tags:
          - 'M02: Questions and Users'

        parameters:
          - in: query
            name: query
            description: 'String to use for full-text search'
            schema:
              type: string
            required: true

        responses:
          '302':
            description: 'Redirect after processing the information.'
            headers:
                Location:
                  schema:
                      type: string
                  examples:
                      302Success:
                        description: 'Redirect to search questions.'
                        value: '/search/questions'
    
    /search/{search-input}/questions/:
      get:
        operationId: R203
        summary: 'R203: Get Search User Results'
        description: 'Load the Users most relevant for a given search. Access: USR'
        tags:
          - 'M02: Questions and Users'

        parameters:
          - in: query
            name: query
            description: 'String to use for full-text search'
            schema:
              type: string
            required: true

        responses:
          '200':
            description: 'Ok. Show questions search results UI'

    /search/{search-input}/users/:
      get:
        operationId: R204
        summary: 'R204: Get Search Question Results'
        description: 'Load the users most relevant for a given search. Access: USR'
        tags:
          - 'M02: Questions and Users'

        parameters:
          - in: query
            name: query
            description: 'String to use for full-text search'
            schema:
              type: string
            required: true

        responses:
          '200':
            description: 'Ok. Show user search results UI'
          

    /search/{search-input}/users/filtered:
      get:
        operationId: R205
        summary: 'R205: Filter User Results'
        description: 'Filter the users by a given parameter. Acess: USR'
        tags:
          - 'M02: Questions and Users'

        parameters:
          - in: query
            name: filteringParameter
            schema:
              type: string
            required: true
        
        responses:
          '200':
            description: 'Ok. Show user search results UI with filtered users'
    

    /search/{search-input}/questions/filtered:
      get:
        operationId: R206
        summary: 'R206: Filter Questions Results'
        description: 'Filter and sort the questions by different parameters. Acess: USR'
        tags:
          - 'M02: Questions and Users'

        parameters:
          - in: query
            name: filteringParameter
            schema:
              type: string
            required: true
          - in: query
            name: sortingParameter
            schema:
              type: string
            required: true
          - in: query
            name: topic
            schema:
              type: string
            required: true
        
        responses:
          '200':
            description: 'Ok. Show user search results UI with filtered questions'
    
    #-------------------- M03 --------------------
  
    /question/{id}/upvote:

      post:
        operationId: R301
        summary: 'R301: Upvote post'
        description: 'Authenticated user upvotes the current post rating'
        tags: 
            - 'M03: Post review'

        parameters:
          - in: path
            name: id
            schema:
              type: integer
            required: true
          - in: path
            name: post_id
            schema:
              type: integer
            required: true
        
        responses:
          '200':
            description: 'Upvote action was successful.'

    /question/{id}/bookmark:
        
        post:
            operationId: R302
            summary: 'R303: Bookmark post'
            description: 'Authenticated user bookmarks the current post'
            tags: 
                - 'M03: Post review'

            parameters:
              - in: path
                name: id
                schema:
                  type: integer
                required: true
              - in: query
                name: id_USRer
                schema:
                  type: integer
                required: true
            
            responses:
              '200':
                description: 'Bookmarking was successful.'
  

#-------------------- M04 --------------------#
    
    /questions/create:

        get:
            operationId: R401
            summary: 'R401: Create question'
            description: 'Show the question creation form page. Access: USR'
            tags:
            - 'M04: Post management'

            responses:
              '200':
                description: 'Ok. Show question form'

        post:
            operationId: R402
            summary: 'R402: Question creating action'
            description: 'Processes the creation of a new question. Access: USR' 
            tags: 
            - 'M04: Post management'

            requestBody:
                required: True
                content:
                    application/x-www-form-urlencoded:
                        schema:
                            type: object
                            properties:
                                author:
                                    type: string
                                tag:
                                    type: string
                                title:
                                    type: string
                                body:
                                    type: string
                                topic:
                                    type: string
                                files:
                                    type: array
                                    items:
                                        type: integer
                                        format: binary 
                                images: 
                                    type: array
                                    items: 
                                        type: integer
                                        format: binary 
                                
                            required:
                                - title
                                - body
                                - topic
            responses:
                '302':
                    description: 'Redirect after processing the new question information'
                    headers:
                        Location:
                            schema:
                                type: string
                            examples:
                                302Success:
                                    description: 'Sucessfull question creation. Redirected to the question page.'
                                    value: '/question/{id}'
                                302Error:
                                    description: 'Failed question creation. Redirected to the question creation form page.'
                                    value: '/questions/create'
        
    /question/{id}:

        get:
            operationId: R403
            summary: 'R403: View question'
            description: 'Show the question. Access: USR'
            tags:
            - 'M04: Post management'

            responses:
              '200':
                description: 'Ok. Show question'



    /question/{id}/answer:

        post:
            operationId: R404
            summary: 'R404: Answer to a question'
            description: 'Processes the creation of a new answer. Access: USR' 
            tags: 
            - 'M04: Post management'
            requestBody:
                required: True
                content:
                    application/x-www-form-urlencoded:
                        schema:
                            type: object
                            properties:
                                author:
                                    type: string
                                body:
                                    type: string
                                files:
                                    type: string
                                    format: binary
                            
                            required:
                                - body
                                - author                                
            responses:
                '302':
                    description: 'Redirect after publishing the new answer'
                    headers:
                        Location:
                            schema:
                                type: string
                            examples:
                                301Success:
                                    description: 'Sucessfull answer creation. Redirected to the specific question page.'
                                    value: '/question/{id}'
                                301Error:
                                    description: 'Failed answer creation. Redirected to the specific question page.'
                                    value: '/question/{id}'


    /post/{id}/delete:

        delete:
            operationId: R405
            summary: 'R405: Answer deletion action'
            description: 'Processes the deletion of a answer. Access: OWN' 
            tags: 
            - 'M04: Post management'

            parameters:
              - in: path
                name: id
                schema:
                  type: integer
                required: true


            responses:
                '302':
                    description: 'Redirect after deleting the answer'
                    headers:
                        Location:
                            schema:
                                type: string
                            examples:
                                302Success:
                                    description: 'Sucessfull deletion. Redirected to the specific question page.'
                                    value: 'question/{id}'
                                302Error:
                                    description: 'Failed deletion. Redirected to the specific answer page.'
                                    value: 'question/{id}'


    /user/{id}/drafts:

        get:
            operationId: R406
            summary: 'R406: View drafts'
            description: 'Show drafts page. Access: OWN'
            tags:
            - 'M04: Post management'
            responses:
              '200':
                description: 'Ok. Show drafts'


    /user/{id}/drafts/{id_draft}:

        delete:
            operationId: R407
            summary: 'R407: Draft deleting action'
            description: 'Processes the deletion of a draft. Access: OWN' 
            tags: 
            - 'M04: Post management'

            parameters:
              - in: path
                name: id
                schema:
                  type: integer
                required: true
              - in: path
                name: id_draft
                schema:
                  type: integer
                required: true

            responses:
                '302':
                    description: 'Redirect after deleting the draft'
                    headers:
                        Location:
                            schema:
                                type: string
                            examples:
                                302Success:
                                    description: 'Sucessfull deletion. Redirected to the specific topic page.'
                                    value: '/user/{id}/drafts'
                                302Error:
                                    description: 'Failed deletion. Redirected to the specific topic page.'
                                    value: '/user/{id}/drafts'

        get:
            operationId: R408
            summary: 'R408: Import chosen draft'
            description: 'Import the data from the selected draft. Access: OWN'
            tags:
            - 'M04: Post management'

            parameters:
              - in: path
                name: id
                schema:
                  type: integer
                required: true
              - in: path
                name: id_draft
                schema:
                  type: integer
                required: true
                
            responses:
                '200':
                  description: 'Redirect after choosing the draft'
                  headers:
                        Location:
                            schema:
                                type: string
                            examples:
                                302Success:
                                    description: 'Sucessfull loading draft. Redirected to the question creation page.'
                                    value: '/questions/create'
                                302Error:
                                    description: 'Failed to load draft. Redirected to the drafts page.'
                                    value: '/user/{id}/drafts'
          



      #-------------------- M05 --------------------

    /moderator/{id}:

      get:
          operationId: R501
          summary: 'R501: Moderator View'
          description: 'Show the moderator page. Access: MOD'
          tags:
              - 'M05: User management'

          parameters:
              - in: path
                name: id
                schema:
                    type: integer
                required: true

          responses:
              '200':
                  description: 'Ok. Show moderator page.'



    /user/{id}/ban:
        delete:
            operationId: R502
            summary: 'R502: Ban USRer'
            description: 'Processes the USRer banning request. Access: MOD'
            tags:
                - 'M05: User management'

            parameters:
            - in: path
              name: id
              schema:
                type: integer
              required: true

            responses:
              '302':
                description: 'Redirect after USRer banning.'
                headers:
                  Location:
                    schema:
                      type: string
                    examples:
                      302Success:
                        description: 'Successful banning. Redirect to home page.'
                        value: '/'
                      302Failure:
                        description: "Failed to ban. Redirect to USRer's profile page."
                        value: 'user/{id}/profile'

    /systemNotifications:

        get:
            operationId: R503
            summary: 'R504: Access system notification page'
            description: 'Accesses the system notification page. Access: ADM'
            tags:
              - 'M05: User management'

            responses:
              '200':
                  description: 'Ok. Show moderator page.'
          
        post:
            operationId: R504
            summary: 'R504: Generate system notification'
            description: 'Processes the system notification request. Access: ADM'
            tags:
                - 'M05: User management'
            
            requestBody:
                required: true
                content:
                    application/x-www-form-urlencoded:
                        schema:
                            type: object
                            properties:
                                title:
                                    type: string
                                body:
                                    type: string
                            required:
                                - title
                                - body

            responses:
                '302':
                    description: 'Redirect after processing system notification creation request.'
                    headers:
                        Location:
                          schema:
                            type: string
                          examples:
                                302Success:
                                    description: 'Successful system notification creation. Redirect to home page.'
                                    value: '/'
                                302Error: 
                                    description: 'Failed credential insertion. Redirect to home page'
                                    value: '/systemNotifications'

    /user/{id}/promote:
        
        post:
            operationId: R505
            summary: 'R505: Promote USRer to moderator'
            description: 'Processes the promotion of a USRer to moderator. Access: MOD'
            tags:
                - 'M05: User management'
            
            requestBody:
                required: true
                content:
                    application/x-www-form-urlencoded:
                        schema:
                            type: object
                            properties:
                                USRerName:
                                    type: string
                                yourPassword:
                                    type: string
                            required:
                                - USRerName
                                - yourPassword
                                - repeatYourPassword

            responses:
                '302':
                    description: 'Redirect after processing system notification creation request.'
                    headers:
                        Location:
                          schema:
                            type: string
                          examples:
                                302Success:
                                    description: 'Successful promotion. Redirect to profile page.'
                                    value: '/user/{id}'
                                302Error: 
                                    description: 'Failed promotion. Redirect to profile page'
                                    value: '/user/{id}'

              


  # -------------------- M06 --------------------


    /about:
      get:
        operationId: R601
        summary: 'R601: About/Faq'
        description: 'Show the about/faq page. Access: VIS'
        tags:
          - 'M06: Static Pages'

        responses:
          '200':
            description: 'Ok. Show About/Faq UI'

    /:
      get:
        operationId: R602
        summary: 'R602: Home'
        description: 'Show the home page. Access: VIS'
        tags:
          - 'M06: Static Pages'
        
        responses:
          '200':
            description: 'Ok. Show Home Page UI'
    
    /contact:
      get:
        operationId: R603
        summary: 'R603: Contact'
        description: 'Show contact page. Access: VIS'
        tags:
          - 'M06: Static Pages'

        responses:
          '200':
            description: 'Ok. Show Home Page UI'



...

A8: Vertical prototype

Brief presentation of the artefact goals.

1. Implemented Features

1.1. Implemented User Stories

Identify the user stories that were implemented in the prototype.

User Story reference Name Priority Description
US01 Consult Contacts high As a user, I want to have access to the contacts of the personnel responsible for the website
US02 See Home high As a user, I want to be able to access the home page, in order to get an overview of the website
US03 See About high As a user, I want to be able to access the about page, so that I can get more concrete information on the websites origins, motives, functionalities and its creators
US04 Access topics high As a user, I want to access each Topic's section, which are organized accordingly into areas, so that I can see the questions related to that topic
US05 Search high As a user, I want to be able to search for threads/questions or users and get a result matching my expectations
US06 Order medium As a user, I want to change the way the threads are ordered in a result page, sorting them according to date, relevance, etc
US10 Sign-In high As a visitor, I want to be able to authenticate into the system, so that I can access the features reserved to my user account type.
US11 Sign-up high As a visitor, I want to be able to create an account, validated through University credentials or access token, so I can participate in the forum
US20 Post questions high As a member, I want to be able to post my own questions/start my own threads in the forum, under the correct sections, so that I other forum members can help me and answer theme
US21 Post answers high As a member, I want to be able to comment/answer other people's questions/threads, so that I can help them get the answer they were looking forum
US22 Logout high As a member, I want to be able to logout of my account, so that other members can log-in in my device
US23 Check my questions high As a member, I want to check the questions I posted in the past, so I can review them easily
US25 Edit my profile medium As a member, I want to be able to see and edit my profile, so I can change my information as I see fit
US30 Remove own posts high As a member, I want to be able to remove my own posts, in case I made a mistake or regretted posting them
US32 Edit post high As a author, I want to be able to edit my own post, so that I can correct any mistakes made or reformulate my question in any way, between other reasons

...

1.2. Implemented Web Resources

Identify the web resources that were implemented in the prototype.

Module M01: Authentication and Individual Profile

Web Resource Reference URL
R101: Login Form get/login
R102: Login Action post/login
R103: Logout Action post/logout
R104: Signup Form get/register
R105: Signup Action post/register
R107: View user profile get/users/{id}/profile
R108: Edit Profile Action put/users/{id}
R109: View USer Profile Edit Form get/users/{id}/profile/edit

Module M02: Questions and Users

Web Resource Reference URL
R201: Get Topic Page get/topics/{topic_name}
R202: Get Search Question Results get/search/{search_input}/questions/
R203: Get Search Users Results get/search/{search_input}/users/
R204: Get Search Results Page get/search
R205: Filter User Results get/search/{search_input}/users/filtered
R206: Filter Question Results get/search/{search_input}/questions/filtered

Module M03: Post review

Web Resource Reference URL
R301: Upvote post post/question/{id}/upvote
R302: Downvote post post/question/{id}/downvote

Module M04: Post Management

Web Resource Reference URL
R401: Create question get/questions/create
R402: Question creating action post/questions/create
R403: View question get/question/{id}
R404: Answer to a question post/question/{id}/answer}
R405: Answer deletion action post/{id}/delete

Module M05: User management

| Web Resource Reference | URL |

Module M06: Static Pages

Web Resource Reference URL
R601: About/Faq get/about
R602: Home get/home
R603: Contact get/contact

2. Prototype

The protoype is available at http://lbaw2106.lbaw.fe.up.pt/ The code is available at https://git.fe.up.pt/lbaw/lbaw2122/lbaw2106

admin user: up201906086@up.pt admin pass: 1234


Revision history

After spending some time thinking about what were the most important features, we decided to lower the priority of some of our plans for the website, mainly in the moderator module.


GROUP2106, 03/01/2022

Clone this wiki locally