Skip to content

VidalGuilherme/nlw-certification-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NLW Expert - Trilha JAVA

This repository contains a simple project built using Java and Spring Boot. The aim of this repository is to practice and share a simple API using Java Spring.

Installation

  1. Clone the repository:
$ git clone [email protected]:VidalGuilherme/nlw-certification-java.git
  1. Install dependencies with Maven
  2. Run with docker-compose (docker-compose up -d)

Usage

  1. Start the application with Maven
  2. The API will be accessible at http://localhost:8080/

Database

The project uses PostgresSQL as the database. Spring boot to automatically load my database schema when I start it up.

spring.jpa.generate-ddl=true

Seeds

You can also populate your database with pre-made seeds, located in "/resourcers/seeds" by running "CreateSeed.java"

API Endpoints

The API provides the following endpoints:

QUESTIONS

GET /questions - Retrieve a list of all questions.
POST /questions - Register a new question.
Body:
{
	"technology": "React",
	"description": "Qual dos seguintes frameworks é uma alternativa ao React?",
	"alternatives": [
		{
			"description": "Preact",
			"isCorrect": true
		},
		{
			"description": "Angular",
			"isCorrect": false
		},
		{
			"description": "Vue",
			"isCorrect": false
		},
		{
			"description": "Svelte",
			"isCorrect": false
		}
	]
}
PUT /questions/{id} - Alter an existing question.
{
	"technology": "React",
	"description": "Qual dos seguintes frameworks é uma alternativa ao React?",
	"alternatives": [
		{
			"description": "Preact",
			"isCorrect": true
		},
		{
			"description": "Angular",
			"isCorrect": false
		},
		{
			"description": "Vue 3",
			"isCorrect": false
		},
		{
			"description": "Svelte",
			"isCorrect": false
		}
	]
}
DELETE /questions/{id} - Delete an existing questions.
GET /questions/technology/{technology} - Retrieve a list of questions filtered by technology

CERTIFICATIONS

GET /certifications - Retrieve a list of all certifications.
POST /certifications - Register a new certification.
Body:
{
	"technology": "Angular",
	"questionsId": [
		"c916f454-07bb-4dfd-b126-642d289974ce",
        "c916f454-07bb-4dfd-b126-642d289974ce",
        "c916f454-07bb-4dfd-b126-642d289974ce"
	]
}
PUT /certifications/{id} - Alter an existing certification.
Body:
{
	"technology": "Angular",
	"questionsId": [
		"c916f454-07bb-4dfd-b126-642d289974ce",        
        "c916f454-07bb-4dfd-b126-642d289974ce"
	]
}
DELETE /certifications/{id} - Delete an existing certification.
GET /certifications/technology/{technology} - Retrieve a list of certifications filtered by technology

STUDENTS

POST /students/has_certification - Check if student has certification in the technology.
Body:
{
	"email":"[email protected]",
	"technology":"JAVA"
}
POST /students/certification/answer - Record a student's responses for certification of a given technology.
Body:
{
	"email":"[email protected]",
	"technology":"JAVA",
	"questionsAnswers": [
		{
			"questionId": "c5f02721-6dc3-4fa6-b46d-6f2e8dca9c66",
			"alternativeId": "98f6891b-5f14-4b8e-bb87-46456a2610d4"
		},
		{
			"questionId": "b0ec9e6b-721c-43c7-9432-4d0b6eb15b01",
			"alternativeId": "9da03a4e-3c8d-4a32-87e1-9898938435c2"
		},
		{
			"questionId": "f85e9434-1711-4e02-9f9e-7831aa5c743a",
			"alternativeId": "e4dbf524-0a54-428a-b57c-853996fc8e19"
		}
	]
}

Docker

You can run a database for this project with Docker by running the following command:

$ docker-compose up -d

To install Docker locally you can click here.

About

Projeto desenvolvido Rocketseat NLW Expert Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages