Skip to content

DevDario/costsweb-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CostsWeb Backend

Desafio

Backend Infrastructure for Costs-Web Project, A minimal Project Manager System

Technologies

Good Practices Applied

  • SOLID, DRY, YAGNI, KISS
  • API STATEFULL (using session-based authentication)
  • Queries With Spring Data JPA
  • DI(Dependency Injection)
  • Error Treatments
  • Automatic API docs Generation with Swagger OpenAPI 3

How to Run

  • First you need to clone this to your machine
  git clone https://github.com/DevDario/costsweb-backend
  • Then access it
  cd costsweb-backend
  • Now you can build the project:
$ ./mvnw clean package
  • and then run it:
$ java -jar target/costswebapi-0.0.1-SNAPSHOT.jar

You can access the API here: localhost:8081.
And you can see Swagger running right here localhost:8081/swagger-ui.html

API Endpoints

  1. Operations(CRUD) with Projects
  2. Operations(CRUD) with Project Services

1. Operations(CRUD) with Projects

Note: I've used httpie to perform the above requests in the CLI

  • Create a new Project
$ http POST :8081/project/new name="project1" budget=1000 usedBudget:0.0 category:"DEVELOPMENT" deadline:"2024-10-14T00:00:00.000+00:00"

[
  {
    "id": 1,
	"name": "project1",
	"budget": 1000.0,
	"usedBudget": 0.0,
	"category": "DEVELOPMENT",
	"createdAt": "2024-10-14T00:00:00.000+00:00",
	"deadline": "2024-10-20T00:00:00.000+00:00",
	"services": []
  }
]
  • List all Projects
$ http GET :8081/project/all

[
  {
    "id": 1,
	"name": "project1",
	"budget": 1000.0,
	"usedBudget": 0.0,
	"category": "DEVELOPMENT",
	"createdAt": "2024-10-14T00:00:00.000+00:00",
	"deadline": "2024-10-20T00:00:00.000+00:00",
	"services": []
  }
]
  • Update a Project
$ http PUT :8081/project/edit/1 name="project1" budget=2000 usedBudget:0.0 category:"PLANNING" deadline:"2024-10-14T00:00:00.000+00:00"

[
  {
    "id": 1,
	"name": "project1",
	"budget": 2000.0,
	"usedBudget": 0.0,
	"category": "PLANNING",
	"createdAt": "2024-10-14T00:00:00.000+00:00",
	"deadline": "2024-10-20T00:00:00.000+00:00",
	"services": []
  }
]
  • Delete a Project
http DELETE :8081/project/del/1

[ ]

2. Operations(CRUD) with Project Services

  • Add(Create) a new service to a project
$ http POST :8081/project/1/services/new name="design" budget="500"

[
  {
    "id": 1,
	"name": "project1",
	"budget": 500.0,
	"usedBudget": 500.0,
	"category": "DEVELOPMENT",
	"createdAt": "2024-10-14T00:00:00.000+00:00",
	"deadline": "2024-10-20T00:00:00.000+00:00",
	"services": [
	    {
	        "id":1,
	        "name":"design",
	        "budget":500.0,
	        "description":""
	    }
	]
  }
]
  • List all services from a project
$ http GET :8081/project/1/service/services

[
    {
	    "id":1,
	    "name":"design",
	    "budget":500.0,
	    "description":""
	}
]
  • List all services from all projects
$ http GET :8081/service/all

[
    {
	    "id":1,
	    "name":"design",
	    "budget":500.0,
	    "description":""
	}
]
  • Delete a service from a project
http DELETE :8081/project/1/service/services/1

[ ]