Skip to content

Pasteblock backend for two differentes mobile apps. An online marketplace where constructor professionals can offer their services to final clients.

Notifications You must be signed in to change notification settings

Tomohiko10615/pasteblock

Repository files navigation

Pasteblock - Backend

This project provided the backend for two differentes mobile apps. The platform is intended to be used as an online marketplace where constructor professionals can offer their services to final clients. Service providers can register, fill their profiles and get job opportunities, while normal users can browse profiles, contact and hire proffesionals. It features a system where both sides can track their own historial activity inside the platform and rate themselves mutually for each concluded service.

Schema

Pasteblock Schema

Stack

This project was done using Spring Framework (Spring Boot, Spring Data JPA, Spring Security, Thymeleaf) The main Java app was hosted on Heroku, while the MySQL database was hosted in an Amazon RDS instance and photos were uploaded to Amazon S3.

Spring Spring Hibernate AWS Heroku MySQL Git Eclipse

Control Panel

It was done with Thymeleaf and bootstrap. Only users with an admin role have enough permissions.

Control Panel

Admins are able to monitor the activy in the application an also have access to statistics.

Logged-in

Contracts

API endpoints

This is not a comprehensive list. There are just some remarkable endpoints.

Login

Type: POST

/api/login

Request Body

Required: application/json

Schema

{
    email *string
    password *string
}

Example value

{
    "email: "jtejada@gmail.com",
    "password": "MyPassword01840"
}

Responses:

Code Description
200 Returns application/json
401 Returns application/json

If login was successful returns success = true along user data (if role is client also returns client only data):

Schema

{
    successful* boolean
    email string
    nombre string
    clienteId int
    distrito string
    distritoId int
    token string
    JWTtoken string
}

Example value

{
    "JWTtoken": "eyJhbGciOiJIUzUxMiJ9.eyJhdXR9mnJpdGllcyI6IltdIiwic3ViIjoianRlamFkYUBib2xzYWRlaWRlYXMuY29tIn0.BtPAFSLaRtqFlFEZwivJW8rbviK_jZ6hKObqfOqBu3hkWvyyL_7XvbvQsYEnmkhZCoNIYdHyrLfGwsXdmQTj6Q",
    "distrito": "Villa el Salvador",
    "distritoId": 42,
    "clienteId": 3,
    "success": true,
    "nombre": "Justo",
    "email": "jtejada@gmail.com",
    "token": "ExponentPushToken[rgFB-WIo5OY372osTohuPe]"
}

If login was unsuccessful returns success = false:

Schema

{
    success *boolean
}

Example value

{
    "success": false
}

Update Push Notification Token

It updates the push notification token of a logged in user if the token of the device is different from the one stored in the database.

Type: POST

/api/token

Request Body

Required: application/json

Responses:

Code Description
201 Returns true, indicating the token was successfully updated

List constructor professionals

It lists all available constructor professionals for a determined service and district, and also sorts them by various criteria.

Type: GET

/api/listar/{servicioId}/{distritoId}

Parameters:

Name Description
servicioId required path Id of the service
distritoId required path Id of the district
criterio query Order criteria, default is reputacion. It can also be numero_trabajos_culminados or fecha_de_registro
orden required query Order of the list. 0 for ASC, and 1 for DESC
inicio required query Select which one would be the first result. Used to limit the number of results
total required query Select the total number of results

Responses:

Code Description
200 Returns a list a professionals

Send push notifications

It sends push notifications to mobile devices whenever a client or a professional sends a message to each other. It also updates a message in the database.

Type: POST

/api/enviar

Request Body

Required: application/json

Responses:

Code Description
201 Returns true indicating the message was updated

About

Pasteblock backend for two differentes mobile apps. An online marketplace where constructor professionals can offer their services to final clients.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published