Coder Social home page Coder Social logo

peepo-eats-api's Introduction

java spring mysql

license open issues closed issues

Peepo Eats API

peepo-eats-api is a Spring Boot API made for a fictitious Peepo Eats food delivery service.

Requirements

  • Java 17
  • Maven
  • MySQL

Installation

git clone https://github.com/AlexIchenskiy/peepo-eats-api.git

cd peepo-eats-api

mvn spring-boot:run

Contribution

Any pull requests are more than welcome. For some major changes, please open an issue to discuss what would you like to change in detail.

License

MIT

peepo-eats-api's People

Contributors

alexichenskiy avatar

Stargazers

 avatar

Watchers

 avatar

peepo-eats-api's Issues

US 1: As a user, I want to register in the app

- I want to be able to create an account.

[POST] /user/register

Requirements:

  • User table should store user data (first name, last name, email, username, password, address (optional))
  • Password must contain at least one number and one letter and be at least 7 characters long and no longer than 60 characters
  • firstname, lastname and username must be at least 2 characters long and no longer than 60 characters
  • Every user must have default role USER and (optional) COURIER, OWNER or EMPLOYEE
  • Password must be encrypted using BCrypt
  • termsaccepted must be true to create an account
  • JWT token that expires after one hour must be returned

REQUEST

{
    "firstname": "Alex",
    "lastname": "Ichenskyi",
    "email": "[email protected]",
    "username": "aichenskyi",
    "password": "password1",
    "role": "USER",
    "address": "Peepo Square",
    "termsaccepted": true
}

RESPONSE

201 CREATED

{
    "token": 
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM
        NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyf
        Q.tD_fYmY_hscATzFyPDYFsqm8HDiY5GM5kkDR8U0USAs"
}

400 BAD REQUEST

  • If termsaccepted is false or any field does not meet the requirements

409 CONFLICT

  • If user already exists

US 4: As a user, I want to manage my preferences

- I want to be able to see, add and delete my food preferences.

Requirements:

  • Get user data from JWT

[GET] /user/preferences

Requirements:

  • Return list of all user preferences

RESPONSE

200 OK

[
    {
         "name": "CHINESE"
    },
    {
         "name": "INDIAN"
    },
    ...
]

204 NO CONTENT

  • If no present preferences

[POST] /user/preferences

Requirements:

  • Add preferences to user profile

REQUEST

[
    {
         "name": "UKRAINIAN"
    },
    ...
]

RESPONSE

202 ACCEPTED

400 BAD REQUEST

  • If preference name is invalid

[DELETE] /user/preferences

Requirements:

  • Delete user preferences by name

REQUEST

[
    {
         "name": "RUSSIAN"
    },
    ...
]

RESPONSE

202 ACCEPTED

400 BAD REQUEST

  • If preference name is invalid or the preference does not exist

US 2: As a user, I want to login in the app

- I want to be able to login in the app.

[POST] /user/login

Requirements:

  • Username/email and password should be valid
  • JWT token that expires after one hour must be returned

REQUEST

{
    "email": "[email protected]",
    "password": "password1"
}

RESPONSE

202 ACCEPTED

{
    "token": 
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM
        NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyf
        Q.tD_fYmY_hscATzFyPDYFsqm8HDiY5GM5kkDR8U0USAs"
}

400 BAD REQUEST

  • If credentials are invalid

US 3: As a user, I want to manage my account

- I want to be able to get and change my account information with the possibility to delete my account.

Requirements:

  • Get user data from JWT

[GET] /user

RESPONSE

200 OK

{
    "firstname": "Alex",
    "lastname": "Ichenskyi",
    "email": "[email protected]",
    "username": "aichenskyi",
    "address": "Peepo Square"
}

[POST] /user

Requirements:

  • Replace user data with provided fields
  • All fields are optional, but at least one must be present

REQUEST

{
    "firstname": "Alex",
    "lastname": "Ichenskyi",
    "email": "[email protected]",
    "username": "aichenskyi",
    "address": "Peepo Street"
}

RESPONSE

202 ACCEPTED

400 BAD REQUEST

  • If provided data is empty or invalid

[DELETE] /user

Requirements:

  • Delete user from a database

RESPONSE

202 ACCEPTED

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.