All Projects → mariazevedo88 → travels-api

mariazevedo88 / travels-api

Licence: MIT license
API for Travels Management - UFLA Comp Jr/20 anniversary event

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to travels-api

travels-java-api
An API for travel management. It is built with Java, Spring Boot, and Spring Framework. A toy-project to serve as a theoretical basis for the Medium series of articles I wrote about Java+Spring.
Stars: ✭ 139 (+531.82%)
Mutual labels:  restful-api, api-service, medium-article, http-rest-api, api-restful, java11, java-11
cubic
📦 Easy to scale, zero-config, real-time focused app platform for node.js
Stars: ✭ 16 (-27.27%)
Mutual labels:  restful-api
medium-toc
Easily create a table of contents for your Medium articles in just one click. ✨
Stars: ✭ 33 (+50%)
Mutual labels:  medium-article
Aliexpress-API
An Personal API For Fetching Product Details On Aliexpress.com
Stars: ✭ 60 (+172.73%)
Mutual labels:  api-service
yametrikapy
Python library for Yandex Metrika API
Stars: ✭ 20 (-9.09%)
Mutual labels:  api-service
Pbbl
A thread-safe ByteBuffer pool that allows for the automatic reuse of ByteBuffers, which can be over 30x faster than having to allocate a new ByteBuffer when needed.
Stars: ✭ 32 (+45.45%)
Mutual labels:  java-11
android dialer replacement
Android dialer replacement sample app
Stars: ✭ 69 (+213.64%)
Mutual labels:  medium-article
grapevine
Fast, unopinionated, embeddable, minimalist web framework for .NET
Stars: ✭ 72 (+227.27%)
Mutual labels:  restful-api
liuye
柳叶清单开放 API 文档
Stars: ✭ 32 (+45.45%)
Mutual labels:  api-service
susel
Super charge the module aware service loader in Java 11
Stars: ✭ 21 (-4.55%)
Mutual labels:  java11
sanic-currency-exchange-rates-api
This is a self hosted, free, open source Python Currency Exchange Rate API fork.
Stars: ✭ 20 (-9.09%)
Mutual labels:  restful-api
MediumUnlimited
Android App written with Flutter/Dart to navigate medium.com without limitations.
Stars: ✭ 28 (+27.27%)
Mutual labels:  medium-article
ecommerce api
E-commerce by Django Rest Framework
Stars: ✭ 156 (+609.09%)
Mutual labels:  restful-api
symfony-todo-backend
This is the result of all the videos that were created in the series that i published on the playlist. LINK BELOW
Stars: ✭ 172 (+681.82%)
Mutual labels:  restful-api
node-server-template
This is Node.js server tidy template / boilerplate with Express (with asyncified handlers, custom error handler) framework and MongoDb. The server use ES6 and above. On different branches you can see different techniques' and technologies' usage, such as Kafka, nodemailer, file download... You also can find postman collections.
Stars: ✭ 116 (+427.27%)
Mutual labels:  restful-api
apex-rest-route
A simple framework for building Restful API on Salesforce
Stars: ✭ 75 (+240.91%)
Mutual labels:  restful-api
CQRSAndMediator-Microservice
A microservice architecture template which implements the CQRS and Mediator patterns
Stars: ✭ 86 (+290.91%)
Mutual labels:  medium-article
SpringsScala
Sample Projects for Creating Springs Web services in Scala
Stars: ✭ 16 (-27.27%)
Mutual labels:  restful-api
ownNoteEditor
JavaFX editor for the ownNote files locally stored in ownCloud folder
Stars: ✭ 25 (+13.64%)
Mutual labels:  java11
project-3-crm
⭐crm 客户关系管理系统模板⭐一个不错的后台管理种子项目,拥有自由设置角色自由分配权限🔑的权限管理功能,三员管理多员管理均可,前端antd vue admin后端spring-boot-api-seedling 拥有完善的功能。文档包含需求文档,设计文档和测试文档等。同时配置了travis,拥有集成测试和自动构建的功能。
Stars: ✭ 128 (+481.82%)
Mutual labels:  restful-api

travels-api

Uma API em Java e Spring Framework para gerenciamento de viagens.

Como a API deve funcionar?

Nossa API deve criar, atualizar, deletar e listar viagens. Além disso, deve calcular estatísticas sobre as viagens criadas. A API terá os seguintes endpoints:

POST/api-travels/travels: cria uma viagem. 

Body:

{ "id": 1, "orderNumber": "220788", "amount": "22.88", "startDate": "2019-09-11T09:59:51.312Z", "endDate": "2019-09-21T21:05:06.500Z", "type": "RETURN" }

Where:

id: número único da viagem; orderNumber: número de identificação da viagem no sistema. amount: valor da transação; deve ser uma String de tamanho arbitrário que pode ser parseada como um BigDecimal; startDate: data de início da viagem no formato ISO 8601 YYYY-MM-DDThh:mm:ss.sssZ no timezone local. endDate: data de fim da viagem no formato ISO 8601 YYYY-MM-DDThh:mm:ss.sssZ no timezone local. Pode ser nulo se a viagem é só de ida. type: se a viagem é somente de ida (ONE-WAY), ida e volta (RETURN) ou múltiplos destinos (MULTI-CITY).

Deve retornar com body vazio com um dos códigos a seguir:

  • 201: caso a viagem seja criada com sucesso.
  • 400: caso o JSON seja inválido.
  • 422: se qualquer um dos campos não for parseável ou se a data de início for mais ao futuro que a data final.
  • 500: erro no servidor (são raros)

PUT/api-travels/travels/{id}: atualiza uma viagem.

Body:

{ "orderNumber": "220788", "amount": "50.50", "startDate": "2019-09-11T09:59:51.312Z", "endDate": "2019-09-21T21:05:06.500Z", "type": "RETURN" }

Deve ser enviado o objeto que será modificado. O retorno deve ser o próprio objeto modificado.

{ "id": 1, "orderNumber": "220788", "amount": "50.50", "startDate": "2019-09-11T09:59:51.312Z", "endDate": "2019-09-21T21:05:06.500Z", "type": "RETURN" }

A resposta deve conter os códigos a seguir:

  • 200: em caso de sucesso.
  • 400: caso o JSON seja inválido.
  • 404: caso tentem atualizar um registro que não existe.
  • 422: se qualquer um dos campos não for parseável (JSON mal formatado).

GET/api-travels/travels: retorna todas as viagens criadas.

Deve retornar uma lista de viagens.

{ "id": 1, "orderCode": "220788", "amount": "22.88", "initialDate": "2019-09-11T09:59:51.312Z", "finalDate": "2019-09-21T21:05:06.500Z", "type": "RETURN" }, { "id": 2, "orderCode": "300691", "amount": "120.0", "initialDate": "2019–10–25T16:18:30.541Z", "type": "ONE-WAY" }

A resposta deve conter os códigos a seguir:

  • 200: caso exista viagens cadastradas
  • 404: caso não exista viagens criadas.

DELETE/api-travels/travels: remove todas as viagens.

Deve aceitar uma requisição com body vazio e retornar 204.

GET/api-travels/statistics: retorna estatísticas básicas sobre as viagens criadas.

{ "sum": "142.88", "avg": "71.44", "max": "120.0", "min": "22.88", "count": "2" }

Em que: sum: um BigDecimal especificando a soma total das viagens criadas. avg: um BigDecimal especificando a média dos valores das viagens criadas. max: um BigDecimal especificando o maior valor dentre as viagens criadas. min: um BigDecimal especificando o menor valor dentre as viagens criadas. count: um long especificando o número total de viagens.

Todos os campos que são BigDecimal devem ter apenas duas casas decimais, por exemplo: 15.385 deve ser retornado como 15.39.

Testes

  • Para executar o teste unitário, o comando executado deve ser:
mvn test
  • Para executar todos os testes (incluindo o de integração), o comando executado deve ser:
mvn integration-test

Execução

Para rodar a API via .jar:

java -jar travels-api-2.0.1.jar --spring.profiles.active=dev

ou

mvn spring-boot:run -Dspring.profiles.active=dev

Por default, a API está disponível no endereço http://localhost:8080/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].