## III. Architecture Specification and Prototype (EAP) ### A7: Web Resources Documentation The architecture of the web application to develop is documented indicating the catalogue of resources and the properties of each resource, including: references to the graphical interfaces, and the format of JSON responses. This page presents the documentation for DigitalPrime, including the following operations over data: create, read, update, and delete. This specification adheres to the OpenAPI standard using YAML. 1. Overview An overview of the web application to implement is presented in this section, where the modules are identified and briefly described. The web resources associated with each module are detailed in the individual documentation of each module. | | | | -------- | -------- | |M01: Authentication and Edition of Buyer Information | Web resources associated with the buyer, admin and superadmin authentication and edition of informations about the buyer, includes the following system features: login/logout, registration, credential recovery and edit address and credit information . | |M02: Products| Web resources associated with products, includes the following system features: product list and search, view and edit product details, and delete products.| |M03: Shopping Cart and Wishlist| Web resources associated with cart and wishlist products, includes the following system features: list products in both cart and wishlist, add and remove products from both cart and wishlist.| |M04: Reviews and Q&A | Web resources associated with reviews, questions and answers, includes the following system features: add review, get product review and delete reviews; ask and anwser questions.| |M05: Cupons| Web resources associated with cupons, includes the following system features: list valid cupons, adds new cupons.| |M06: Pages| Get the static pages of the website.| 2. Permissions This section defines the permissions used in the modules to establish the conditions of access to resources. |||| |-- | -- | -- | |PUB|Public| User withou privileges| |BYR |Buyer |Logged-in user| |RWR |Reviewer |Buyer that has boughth an specific item to be able to review it| |ADM |Admin |Administrator| |SADM |SuperAdmin |Administrator that can edit other administrators| 3. OpenAPI Specification This section includes the complete API specification in OpenAPI (YAML). Additionally there is a link to the OpenAPI YAML file in the group's repository. Also included is a link to the Swagger generated documentation (for easy navigation). [DigitalPrime OpenAPI specification in git.](/api/a7_openapi.yaml) [DigitalPrime OpenAPI specification in Swagger.](https://app.swaggerhub.com/apis/Sardinha/DigitalPrime/1.0-oas3) ```yaml openapi: 3.0.0 info: version: 1.0-oas3 title: 'LBAW 2173 DigitalPrime' description: 'Web Resources Specification (A7) for DigitalPrime' servers: - url: 'http://lbaw2173-piu.lbaw-prod.fe.up.pt/api' description: Production Server externalDocs: description: Find more info here. url: 'https://git.fe.up.pt/lbaw/lbaw2021/lbaw2173/-/wikis/' tags: - name: 'M01: Authentication and Edition of Buyer Information' - name: 'M02: Products' - name: 'M03: Shopping Cart and Wishlist' - name: 'M04: Reviews and Q&A' - name: 'M05: Cupons' - name: 'M06: Pages' paths: /login: get: operationId: R101 summary: 'R101: Login Form' description: 'Provide login form. Access: PUB' tags: - 'M01: Authentication and Edition of Buyer Information' responses: '200': description: 'Ok. Show [UI09](http://lbaw2173-piu.lbaw-prod.fe.up.pt/loginreg.html)' post: operationId: R102 summary: 'R102: Login Action' description: 'Processes the login form submission. Access: PUB' tags: - 'M01: Authentication and Edition of Buyer Information' requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: username: type: string password: type: string required: - username - password responses: '302': description: 'Redirect after processing the login credentials.' headers: Location: schema: type: string examples: 302Success: description: 'Successful authentication.' value: '/mainpage' 302Error: description: 'Failed authentication. Redirect to login form.' value: '/login' /logout: post: operationId: R103 summary: 'R103: Logout Action' description: 'Logout the current authenticated used. Access: BYR, RWR, ADM, SADM' tags: - 'M01: Authentication and Individual Profile' responses: '302': description: 'Redirect after processing logout.' headers: Location: schema: type: string examples: 302Success: description: 'Successful logout. Redirect to mainpage.' value: '/mainpage' /register: get: operationId: R104 summary: 'R104: Register Form' description: 'Provide new user registration form. Access: PUB' tags: - 'M01: Authentication and Edition of Buyer Information' responses: '200': description: 'Ok. Show [UI09](http://lbaw2173-piu.lbaw-prod.fe.up.pt/loginreg.html)' post: operationId: R105 summary: 'R105: Register Action' description: 'Processes the new user registration form submission. Access: PUB' tags: - 'M01: Authentication and Edition of Buyer Information' requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: email: type: string user: type: string password: type: string confirmPassword: type: string required: - email - user - password - confirmPassword responses: '302': description: 'Redirect after processing the new user information.' headers: Location: schema: type: string examples: 302Success: description: 'Successful registration.' value: '/mainpage' 302Error: description: 'Failed registration. Redirect to registration form.' value: '/login' /api/products: get: operationId: R201 summary: 'R202: Search Product API' description: 'Searches for products and returns the results as JSON. Access: PUB.' tags: - 'M02: Products' parameters: - in: query name: query description: String to use for full-text search schema: type: string required: false - in: query name: item description: Category of the product schema: type: string required: false - in: query name: promotion description: Boolean if has promotion associated schema: type: boolean required: false responses: '200': description: Success content: application/json: schema: type: array items: type: object properties: id: type: string name: type: string price: type: string description: type: string quantity: type: string discount: type: string example: - id: 1 name: Macbook Pro price: 1500 description: The state of the art tecnology for apple fans! quantity: 20 discount: no - id: 15 name: IPhone X price: 599.99 description: Comemorating ten years of the first IPhone!!! quantity: 5 discount: 100 /api/cart/{buyer_id}: get: operationId: R301 summary: 'R301: View buyers cart' description: 'Show the individual buyer cart. Access: BYR' tags: - 'M03: Shopping Cart and Wishlist' parameters: - in: path name: buyer_id schema: type: integer required: true responses: '200': description: Success content: application/json: schema: type: array items: type: object properties: id: type: string name: type: string price: type: string description: type: string quantity: type: string discount: type: string example: - id: 1 name: Macbook Pro price: 1500 description: The state of the art tecnology for apple fans! quantity: 20 discount: no - id: 15 name: IPhone X price: 599.99 description: Comemorating ten years of the first IPhone!!! quantity: 5 discount: 100 /mainpage: get: operationId: R601 summary: 'R601: Main page' description: 'Provide main site page. Access: PUB' tags: - 'M06: Pages' responses: '200': description: 'Ok. Show [UI01](http://lbaw2173-piu.lbaw-prod.fe.up.pt)' ``` ### A8: Vertical prototype The Vertical Prototype includes the implementation of two or more user stories (the simplest) and aims to validate the architecture presented, also serving to gain familiarity with the technologies used in the project. ### 1. Implemented Features #### 1.1. Implemented User Stories The user stories that were implemented in the prototype are described in the following table. |User Story reference|Name|Priority|Description| |-- | -- | -- | -- | | US01 | Search Items | high | As a user, I want to search the items I am interested in, so that I can find them. | | US02 | See the Desired Item | high | As a user, I want to see the items I am interested in, so that I can check the information provided about them. | | US12 | Sign-up | high | As a guest, I want to register myself into the system, so that I can authenticate myself into the system | #### 1.2. Implemented Web Resources The web resources that were implemented in the prototype are described in the next section. #### Module M01: Authentication and Edition of Buyer Information |Web Resource Reference|URL| |-- | -- | |R103: Register Form|[/register](http://lbaw2173-piu.lbaw-prod.fe.up.pt/register)| |R104: Register Action|POST /register| #### Module M02: Products |Web Resource Reference|URL| |-- | -- | #### Module M03: Shopping Cart and Wishlist |Web Resource Reference|URL| |-- | -- | #### Module M04: Reviews and Q&A |Web Resource Reference|URL| |-- | -- | #### Module M05: Cupons |Web Resource Reference|URL| |-- | -- | #### Module M06: Pages |Web Resource Reference|URL| |-- | -- | |R601: Contacts, FAQ's and Map|[/contactsfaq](http://lbaw2173-piu.lbaw-prod.fe.up.pt/contactsfaq)| |R602: 404 || ### 2. Prototype The prototype is available at The code is available at https://git.fe.up.pt/lbaw/lbaw2021/lbaw2173 ### GROUP2173, 06/05/2021 * Diogo Filipe Martins, [up201806280@fe.up.pt](mailto:up201806280@fe.up.pt) * Emanuel Trigo, [up201605389@fe.up.pt](mailto:up201605389@fe.up.pt) * Iohan Sardinha, [up201801011@fe.up.pt](mailto:up201801011@fe.up.pt) * Muriel Pinho, [up201700132@g.uporto.pt](mailto:up201700132@g.uporto.pt)