Skip to content

IvanHayel/modsen-crud-api

Repository files navigation

MODSEN

πŸš€ Test task - Meetup API

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. GitHub HitCount GitHub

Table of Contents
  1. Task Description
  2. Getting Started
  3. API Usage
  4. Demo

πŸ“„ Task Description

πŸ“ Task

Development of CRUD REST API for working with Events.

The application must be accompanied by a README.md file with instructions for project startup.

πŸ“ Main Technologies

Database Postgresql
Backend Java Spring

πŸ“ Special Requirements

Using pure Hibernate (Spring Data JPA wrapper not allowed)

πŸ“ Additional Technologies

  1. Integration or unit tests.

  2. Database migration (Liquibase or Flyway).

  3. Ability to run from docker-compose.

  4. Ability to filter and sort Events.

  5. Using environment variables.


βš™οΈ Getting Started

⏩ The Easiest Way ⏩

API already deployed on PAAS Heroku:

πŸ‹ Start with Docker

  • Clone the repository
git clone https://github.com/IvanHayel/modsen-crud-api.git
  • Use docker-compose
docker-compose up

πŸ¦– Local Startup with Gradle

Java version 17+ is required.

  • Clone the repository
git clone https://github.com/IvanHayel/modsen-crud-api.git
  • Create Postgres Database

Example:

CREATE DATABASE "modsen-api"
    WITH 
    OWNER = postgres
    ENCODING = 'UTF8'
    LC_COLLATE = 'English_World.1252'
    LC_CTYPE = 'English_World.1252'
    TABLESPACE = pg_default
    CONNECTION LIMIT = -1;
  • Set up environment variables

DB_URL - JDBC url for Postgres database.

DB_USERNAME - database username

DB_PASSWORD - database password

  • Run Gradle
gradle clean build bootRun

You can also use the gradle wrapper: ./gradlew


πŸ”₯ API Usage

⚠️ Attention! Date and time in API is valid only in ISO 8601 format! ⚠️

πŸ’  Endpoints

HTTP METHOD URL QUERY PARAMETERS TEMPLATE DESCRIPTION
GET /api/v1/events sortedBy: id (default), theme, organizer, start, place - not required
direction: asc (default), desc - not required
theme: {any} - not required
description: {any} - not required
organizer: {any} - not required
place: {any} - not required
start: {Date/time in ISO 8601} - not required
none Getting all Events with the ability to filter and sort.
GET /api/v1/events/{id} none none Getting an Event by id.
GET /api/v1/events/search term: {any} - required none Full text search for all Events.
POST /api/v1/events none post-template Creating a new Event.
PUT /api/v1/events none put-template Updating existing Event.
DELETE /api/v1/events/{id} none none Deleting Event by id.

πŸͺ„ Demo

Insomnia used for demonstration.

Get all events

all

Get all events with restrictions

all-restrictions

Get event by id

by-id

Full text search

search

Create new event

create

Update existing event

update

Delete event

delete