🚧 Projeto em construção 🚧
É uma api REST, construída em Elixir com o objetivo de auxliar na administração de um salão de cabeleiro
Para iniciar seu server:
- Instale as dependências com:
mix deps.get
- Crie e migre seu bando de dados com:
mix ecto.setup
- Inicie Phoenix endpoint com:
mix phx.server
ou inside IEx com:iex -S mix phx.server
Agora você pode visitar localhost:4000
do seu navegador.
[POST] api/employees
Exemplo da requisão
{
"email": "[email protected]",
"password": "123456",
"name": "NAME",
"cpf": "12345678900"
}
Exemplo da resposta
{
"message": "Employee created!",
"employee": {
"cpf": "12345678912",
"email": "[email protected]",
"id": "UUID",
"inserted_at": "2022-07-04T20:35:16",
"name": "NAME"
}
}
[POST] /api/employees/signin
Exemplo da requisição de login
{
"email": "EMAIL",
"password": "PASSWORD"
}
Exemplo da resposta de sucesso no login
{
"token": "TOKEN_JWT"
}
[PUT] /api/employees/:id
Exemplo de requisão alterando o nome
{
"name": "UPDATE_NAME"
}
Exemplo da resposta
{
"message": "Employee created!",
"employee": {
"cpf": "12345678912",
"email": "[email protected]",
"id": "UUID",
"inserted_at": "2022-07-04T20:35:16",
"name": "UPDATE_NAME"
}
}
[GET] /api/employees/:id
[GET] /api/employees
[PUT] /api/employees
[DELETE] /api/employees/:id
[POST] /api/clients
Exemplo de requisão
{
"name": "NAME",
"cpf": "12345678900",
"rg": "123456780",
"address": "RUA, N°",
"district": "BAIRRO",
"phone": "(xx) xxxxx-xxxx"
}
Exemplo da resposta de Sucesso
{
"message": "Client created!",
"client": {
"cpf": "12345678900",
"id": "UUID",
"inserted_at": "2022-07-03T04:05:31",
"name": "NAME",
"phone": "(xx) xxxxx-xxxx",
"rg": "123456780"
}
}
[PUT] /api/clients/:id
Exemplo de requisão alterando o nome
{
"name": "UPDATE_NAME"
}
Exemplo da resposta de sucesso
{
"message": "Client updated!",
"client": {
"cpf": "12345678900",
"id": "UUID",
"inserted_at": "2022-07-03T04:05:31",
"name": "UPDATE_NAME",
"phone": "(xx) xxxxx-xxxx",
"rg": "123456780"
}
}
[GET] /api/clients/:id
Exemplo da resposta, passando um id que corresponde a um cliente.
{
"id": "UUID",
"inserted_at": "2022-07-03T04:05:31",
"name": "NAME",
"phone": "(xx) xxxxx-xxxx"
}
[GET] /api/clients
Exemplo da resposta, quando não houver clientes cadastrados
[]
Exemplo da resposta, quando houver clientes cadastrados
[
{
"id": "UUID",
"inserted_at": "2022-07-03T04:05:31",
"name": "NAME",
"phone": "(xx) xxxxx-xxxx"
},
{
"id": "UUID",
"inserted_at": "2022-07-03T04:05:31",
"name": "NAME",
"phone": "(xx) xxxxx-xxxx"
},
{
"id": "UUID",
"inserted_at": "2022-07-03T04:05:31",
"name": "NAME",
"phone": "(xx) xxxxx-xxxx"
}
...
]
[DELETE] api/clients/:id
Exemplo da resposta, passando um id válido.
{
"message": "The client CLIENT_NAME was deleted with sucess!"
}
[POST] /api/services
Exemplo da requisão
{
"title": "TITLE_SERVICE",
"price": 20.00
}
Exemplo da resposta
{
"message": "Service created!",
"service": {
"id": "UUID",
"inserted_at": "2022-07-03T04:05:56",
"price": 20.0,
"title": "TITLE_SERICE"
}
}
[POST] /api/sales
Exemplo da requisição
{
"payment_method": "PAYMENT_METHOD", // "dinheiro", "cartão", "fiado".
"employee_id": "EMPLOYEE_UUID",
"service_id": "SERVICE_UUID",
"client_id": "CLIENT_UUID"
}
Exemplo da resposta
{
"messagge": "Sale created!",
"sale": {
"client_id": "CLIENT_UUID",
"employee_id": "EMPLOYEE_ID",
"id": "UUID",
"inserterd_at": "2022-07-04T20:36:55",
"service_id": "SERVICE_UUID"
}
}
[GET] /api/sales/:id
[GET] /api/sales
[DELETE] /api/sales/:id
[POST] /api/employees/payroll
[GET] /api/employees/payroll/:id
[GET] /api/employees/payroll
[DELETE] /api/employees/payroll/:id
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix