Skip to content

tito1984/CRUD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple CRUD

A simple CRUD with posts and comments with one-to-many association and unit ant integration test

Badges

Static Badge Static Badge

Authors

Application Properties

To run this project, you will need to add the following variables.

For MySQL

spring.datasource.url

spring.datasource.username

spring.datasource.password

spring.jpa.properties.hibernate.dialect

For H2 database

spring.datasource.username

spring.datasource.password

Deployment

Just clone the repository and change the application.properties values from your own.

You can use MySql and H2 databases at your choise

To start project just type this into the terminal

  mvnw spring-boot:run

Features

  • 2 Entities Publications and Comments
  • One-to-many relation between them
  • Repository and Service interfaces
  • Pagination for Publications
  • Individual Controllers for each entity
  • Unit and integration test for both Entities

API Reference

Get all publications

  GET /api/publications
Parameter Type Description
pageNo int Page number, default value '0'
pageSize int Page size, default value '10'
sortBy string Page number, default value 'id'
sortDir string Page number, default value 'asc'

Get publication

  GET /api/publications/${id}
Parameter Type Description
id long Required. Id of item to fetch

Create publication

  POST /api/publications

Body

Parameter Type Description
title string Required. publication title
description string Required. publication description
content string Required. publication content

Edit publication

  PUT /api/publications/${id}
Parameter Type Description
id long Required. Id of item to fetch

Body

Parameter Type Description
title string Required. publication title
description string Required. publication description
content string Required. publication content

Delete publication

  DELETE /api/publications/${id}
Parameter Type Description
id long Required. Id of item to fetch

Get all comments from publication

  GET /api/publications/{publicationId}/comments
Parameter Type Description
publicationId long Required. Id of publication

Get publication

  GET /api/publications/{publicationId}/comments/{id}
Parameter Type Description
id long Required. Id of comment to fetch
publicationId long Required. Id of publication

Create publication

  POST /api/publications/{publicationId}/comments
Parameter Type Description
publicationId long Required. Id of publication

Body

Parameter Type Description
name string Required. publication name
email string Required. publication email
body string Required. publication body

Edit publication

  PUT /api/publications/{publicationId}/comments/{id}
Parameter Type Description
id long Required. Id of comment to fetch
publicationId long Required. Id of publication

Body

Parameter Type Description
name string Required. publication name
email string Required. publication email
body string Required. publication body

Delete publication

  DELETE /api/publications/{publicationId}/comments/{id}
Parameter Type Description
id long Required. Id of comment to fetch
publicationId long Required. Id of publication

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages