Giter VIP home page Giter VIP logo

clean-architecture-library's Introduction

Solution Architecture

aws-architecture

Endpoints

[POST] Realizar login

URL: /auth Request:

{
  "document": "29737520009",
  "password": "FN57akyScx"
}

Response:

{
  "token": "jwt token"
}

[POST] Realizar cadastro de cliente (pelo app)

URL: /user Request:

{
  "name": "Joao da Silva",
  "document": "29737520009",
  "password": "FN57akyScx"
}

Response:

{
  "id": "uuidv4"
}

[POST] Realizar cadastro de cliente (pelo site = funcionario cadastrando alguem)

URL: /admin/user Headers: Authentication Request:

{
  "name": "Joao da Silva",
  "document": "29737520009"
}

Response:

{
  "id": "uuidv4",
  "password": "FN57akyScx"
}

[PUT] Atualizar senha cliente

URL: /user Headers: Authentication Request:

{
  "currentPassword": "FN57akyScx",
  "newPassword": "FN57akyScx222"
}

Response:

200 OK

[GET] Buscar livros

URL: /book Request:

/book?page=0 /book?page=0&search=nome_livro

Response:

[
  {
    "id": "uuidv4",
    "title": "A Cabana",
    "status": "RENTED | AVAILABLE",
    "returnDate": "2024-04-17T20:19:57.164Z"
  }
]

[GET] Buscar detalhes de um livro (cliente)

URL: /book/{id} Request:

/book/cedw123123

Response:

{
  "id": "uuidv4",
  "title": "A Cabana",
  "description": "Bla bla bla",
  "author": "Fulano de tal",
  "status": "RENTED | AVAILABLE",
  "returnDate": "2024-04-17T20:19:57.164Z"
}

[GET] Buscar detalhes de um livro (atendente)

URL: /book/{id} Headers: Authentication Request:

/book/cedw123123

Response: Obs: objeto user, rentDate e returnDate vem null caso status seja AVAILABLE

{
  "id": "uuidv4",
  "title": "A Cabana",
  "description": "Bla bla bla",
  "author": "Fulano de tal",
  "status": "RENTED | AVAILABLE",
  "rentDate": "2024-04-17T20:19:57.164Z",
  "returnDate": "2024-04-17T20:19:57.164Z",
  "user": {
    "name": "Joao da Silva",
    "document": "29737520009"
  }
}

[POST] Realizar reserva de um livro (cliente)

URL: /rent Headers: Authentication Request:

{
  "bookId": "uuidv4"
}

Response:

{
  "returnDate": "2024-04-17T20:19:57.164Z"
}

[POST] Realizar reserva de um livro (atendente)

URL: /rent Headers: Authentication Obs: o endpoint eh o mesmo, a diferenca eh que aqui mandamos o token no header, e na api devemos validar se tem token e se o portador do token eh do tipo atendente Request:

{
  "userDocument": "29737520009",
  "bookId": "uuidv4"
}

Response:

{
  "returnDate": "2024-04-17T20:19:57.164Z"
}

[GET] Visualizar meus alugueis (cliente)

URL: /rent Headers: Authentication Request:

/rent?page=0

Response:

[
  {
    "id": "uuidv4",
    "bookTitle": "A Cabana",
    "status": "RENTED | AVAILABLE",
    "returnDate": "2024-04-17T20:19:57.164Z"
  }
]

[GET] Visualizar detalhes de um cliente

URL: /user/{document} Headers: Authentication Obs: so pode ser feito por um usuario do tipo atendente Request:

/user/29737520009

Response:

{
  "document": "29737520009",
  "name": "Joao da Silva",
  "role": "CLIENT | ATTENDANT",
  "booksRentedAmount": 10,
  "currentRentedBooks": [
    {
      "id": "uuidv4",
      "name": "A Cabana"
    }
  ]
}

[POST] Resetar senha de um usuario

URL: /user/reset-password Headers: Authentication Obs: so pode ser feito por um usuario do tipo atendente Request:

{
  "document": "29737520009"
}

Response:

{
  "password": "senha gerada automaticamente"
}

[POST] Dar baixa na devolucao de um livro

URL: /rent/return Headers: Authentication Obs: so pode ser feito por um usuario do tipo atendente Request:

{
  "userDocument": "29737520009",
  "bookId": "uuidv4"
}

Response:

200 OK

[POST] Cadastrar livro

URL: /book Headers: Authentication Obs: so pode ser feito por um usuario do tipo atendente Request:

{
  "name": "A Cabana",
  "Description": "Bla bla bla",
  "authorId": "Joao da Silva"
}

Response:

200 OK

[GET] Buscar usuarios

URL: /user Headers: Authentication Obs: so pode ser feito por um usuario do tipo atendente Request:

/user?page=0 /user?page=0&search=document_or_name

Response:

[
  {
    "name": "Joao da Silva",
    "document": "29737520009"
  }
]
classDiagram
    class Book {
        <<Entity>>
        + id: string
        + title: string
        + description: string
        + status: RENTED | AVAILABLE
        + createdAt: datetime
        - author: Author
    }

    class Author {
        <<Entity>>
        + id: string
        + name: string
        + createdAt: datetime
    }

    class User {
        <<Entity>>
        + id: string
        + name: string
        + document: string
        + password: string
        + role: CLIENT | ATTENDANT
        + createdAt: datetime
        - rents: Rent[]
    }

    class Rent {
        <<Entity>>
        + id: string
        + bookId: string
        + userId: string
        + rentDate: datetime
        + returnDate: datetime
        + returnedDate: datetime
    }

    Book "N" *-- "1" Author : has
    Book "1" *-- "N" Rent : has
    User "1*" *-- "N" Rent : has
Loading

clean-architecture-library's People

Contributors

gabrielmendes98 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.