Git Product home page Git Product logo

twitter-app's Introduction

Twitter-app

Twitter Clone using Java 17, Spring Boot, MYSQL, Liquibase, JWT, Gradle. Application is using JWT token to authenticate and authorize users.

This project is always updated with new features.

About the project

We have three main classes - User, Tweet and Subscription.

User class represents user in this application. User can register, create, update, delete, get tweets.

We have 2 types of authority: USER and ADMIN.

User can have roles 2 roles - ROLE_USER and ROLE_ADMIN, or 1 - ROLE_USER or ROLE_ADMIN.

Tweet class represents tweet in this application. Tweet can be created by user. Only authenticated user can create tweets. You can check the time when a tweet was created or updated by looking at the createdTimestamp or updatedTimestamp.

Subscription class represents subscribe/unsubscribe fuction betwen users in this application.

Diagram database

Explore Rest APIs

AUTH requests

  • Register:

POST -> "/api/v1/auth/register"

Request parameters: NONE

Request body:

{
    "name" : "Ivan Ivanov",
    "password" : "1",
    "email" : "[email protected]",
    "role" :{
    "authority" : "ROLE_USER" (by default 'ROLE_USER')
}
}

Authenticated: NONE

  • Login:

POST -> "/api/v1/auth/login"

Request parameters: NONE

Request body:

{
    "name" : "Ivan Ivanov",
    "password" : "1"
}

Authenticated: NONE

  • Refresh:

POST -> "/api/v1/auth/refresh"

Request parameters: NONE

Request body:

{
    "refreshtoken": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJPbGVnIFpodWsiLCJpZCI6MywiaWF0IjoxNjk1NTg5MDk2LCJleHAiOjE2OTU1OTI2OTZ9.nK5pZjZS5cuMWq6e8A0UQX_awtSGf8eHGWHypso0NmYkkGna-CXZVbPnQkQsFkeWktONXdGN2WNtQv5mYKIgTA"
}

Authenticated: NONE

USER requests

  • Get user by id:

GET -> "/api/v1/accounts/{id}"

Request parameters: NONE

Request body: NONE

Authenticated: USER, ADMIN

ROLE requests

  • Get all roles:

GET -> "/api/v1/roles""

Request parameters: NONE

Request body: `NONE

Authenticated: ADMIN

  • Create new role:

GET -> "/api/v1/roles/create""

Request parameters: NONE

Request body:

{
    "authority" : "NEW_ROLE"
}

Authenticated: ADMIN

TWEET requests

  • Get tweet by id:

GET -> "/api/v1/tweets/{id}"

Request parameters: NONE

Request body: NONE

Authenticated: USER, ADMIN

  • Get user's tweets:

GET -> "/api/v1/tweets/list"

Request parameters: NONE

Request body:

{
    "page" : "1",
    "limit" : 10
}

Authenticated: USER, ADMIN

  • Create a new tweet:

POST -> "/api/v1/tweets/create"

Request parameters: NONE

Request body:

{
    "id" : "5",
    "message" : "my new tweet"
}

Authenticated: USER, ADMIN

  • Update tweet:

PUT -> "/api/v1/tweets"

Request parameters: NONE

Request body:

{
    "id" : "5",
    "message" : "i want to change my tweet"
}

Authenticated: USER, ADMIN

  • Delete tweet:

DELETE -> "/api/v1/tweets/{id}"

Request parameters: NONE

Request body:

{
    "id" : "5"
}

Authenticated: USER, ADMIN

SUBSCRIPTION requests

  • Subscribe user:

POST -> "/api/v1/subscriptions/subscribe"

Request parameters: NONE

Request body:

{
    "followerId" : "3"
}

Authenticated: USER, ADMIN

  • Unsubscribe user:

POST -> "/api/v1/subscriptions/unsubscribe"

Request parameters: NONE

Request body:

{
    "followerId" : "2"
}

Authenticated: USER, ADMIN

twitter-app's People

Contributors

maxim471 avatar maximrom00 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.