JCL

FEUP/DEI & INESC TEC

User Tools

Site Tools


teach:lbaw:medialib:a08

Vertical prototype (A8)

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.

The implementation is based on the LBAW Framework and include work on all layers of the architecture of the solution to implement: user interface, business logic and data access. The prototype includes the implementation of pages of visualization, insertion, edition and removal of information; the control of permissions in the access to the implemented pages; and a presentation of error and success messages.

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 Sign-in high As an Visitor, I want to authenticate into the system, so that I can access privileged information
US02 Sign-up high As Visitor, I want to register myself into the system, so that I can authenticate myself into the system
US11 Home page high As an User, I want to access home page, so that I can see a brief website's presentation
US12 About page high As an User, I want to access the about page, so that I can see a complete website's description
US13 Services page high As an User, I want to access the services page, so that I can see the website's services
US14 FAQ page high As an User, I want to access the FAQ page, so that I can see Frequently Asked Questions
US15 Contact page high As an User, I want to access contact page, so that I can see the contacts
US27 Profile high As a Reader, I want to change my information, so that I can keep it updated (e.g. changing the password)

1.2. Implemented Web Resources

The web resources that were implemented in the prototype are described in the next section.

Module M01: Authentication and Individual Profile

Module M05: User Administration and Static pages

2. Prototype

The prototype is available at http://medialib18.lbaw-prod.fe.up.pt/

Credentials:

  • admin user: admin@fe.up.pt/password
  • regular user: userx@fe.up.pt/password

The code is available at https://git.fe.up.pt/lbaw/medialib/tree/proto


3. An old FAQ

Not to be included in the A8.
See the new Guides as advised elsewhere!

What is the structure of a typical web resource in Laravel?

Read thoroughly the readme created for the project: Laravel Code Structure. It contains the basics to understand how Laravel works.

What are the best resources to learn Laravel?

The Laravel's documentation is really detailed and meticulous, so if you want to learn more about the framework, the basics and main architecture concepts, my suggestion is to first visit the documentation. Don't forget to read the documentation for the version used by your project, which should be 5.8.

Nevertheless, if you don't want to read documentation and prefer to go right ahead to the practice, take a look at Laracasts and Laravel Tutorials, which feature several tutorials on pretty much everything regarding Laravel.

How to integrate the interfaces with Laravel?

  • To integrate the interfaces, it's necessary to consider three concepts: Views, Routes and Controllers.
  • Since the web resources - A7 - were created following a RESTful approach, you can quickly create your controllers. Check this section to better understand how resource controllers work with Laravel: Resource Controllers
  • Now you can register the resourceful route, assigning it to the controller created.
  • Taking into account this information, now it's possible to integrate the interface, by creating the corresponding views, that usually are mapped to the CRUD actions created.

How to integrate the SQL code with Laravel?

  • You can use the file seed.sql to add the SQL code created in the A6 into the project's database, as explained in the base project README.
  • If you prefer to use another approach, you can use the container pgAdmin, by accessing it through http://localhost:5050, and execute the code directly through the interface.
  • The next step is to create the models, following the Laravel conventions and accordingly to your tables and respective relationships.
  • After that, you have to check if your table names comply with Laravel's conventions. If not, check the section "Table names" to solve the problem. From now on, all references to the table must be to the name defined in the database (for example, when validating a request).

How to catch query exceptions?

To properly catch exceptions due to custom constraints, which are not easily validated with Eloquent's rules, it's possible to wrap the queries within a try…catch block. For example, constraints errors throw a QueryException, so one way to catch them is to do the following:

try {
    // SQL query, transaction, etc
} catch(\Illuminate\Database\QueryException $qe) {
    // Catch the specific exception and handle it (returning the view with the parsed errors, p.e)
} catch (\Exception $e) {
    // Handle unexpected errors
}

LBAW

[MediaLibrary]

teach/lbaw/medialib/a08.txt · Last modified: 02/04/2020 12:02 by Correia Lopes