ifpi-picos / projeto-integrador-i-stock-academic-backend

Apache License 2.0
0 stars 0 forks source link

Documentação das Rotas #31

Open edmarques11 opened 2 years ago

edmarques11 commented 2 years ago

Login admin

POST /admin/auth

Payload:

{
    "email": "leaf.reciclagem@reci.leaf.com",
    "password": "Lea@fadm1n"
}

Response:

{
    "code": 201,
    "data": {
        "auth": true,
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaXNfYWRtaW4iOnRydWUsImlhdCI6MTY0MzY3MTQyNywiZXhwIjoxNjQzNzE0NjI3fQ.PUzCa8r4UwiqVKrJXapRm42vyRVPK0owfz8zrlDaJ7s",
        "entite": {
            "name": "Admin",
            "email": "leaf.reciclagem@reci.leaf.com"
        }
    },
    "message": "Sucesso!"
}

Criar nova wallet:

POST /wallet

Payload: sem payload Response:

{
    "code": 201,
    "data": {
        "id": 1,
        "wallet_code": "f5c1f232-0ca2-42c4-901e-2f5349ebecc1",
        "updatedAt": "2022-01-31T23:25:15.073Z",
        "createdAt": "2022-01-31T23:25:15.073Z"
    },
    "message": "Sucesso!"
}

Upload de Foto de Usuário:

POST /file-upload

Payload: Arquivo de imagem jpg, jpeg, png, gif Response:

{
    "code": 201,
    "data": {
        "urlFile": "https://storage.googleapis.com/stock-academic-7e9cc.appspot.com/6e8566cd-5282-49d6-bbd7-9ce44304ea7b-download.jpeg"
    },
    "message": "Upload concluído com sucesso!"
}

Deletar foto upada:

DELETE /file-exclude/{pathFile}

Payload: Sem payload Response:

{
    "code": 200,
    "data": {},
        "message": "sucesso"
}

Salvar usuário

POST /users

payload:

{
    "name": "Edmarques",
        "nickname": "edm",
        "phone": "(12) 91234-5678",
        "type_key_pix": "celular",
        "key_pix: "(12) 91234-5678",
        "cpf_or_cnpj": "123.456.789-10",
        "password": "password",
    "email": "edmarques@leaf.com",
    "wallet_id": 1,
        "is_admin": false
}

Response:

{
    "code": 201,
    "data": {
        "id": 3,
        "name": "Edmarques",
        "nickname": "edm",
        "phone":  "(12) 91234-5678",
        "email": "edmarques@leaf.com",
        "type_key_pix": "celular",
        "key_pix":  "(12) 91234-5678",
        "cpf_or_cnpj": "123.456.789-10",
        "wallet_id": 1,
        "is_admin": false,
        "updatedAt": "2022-01-30T03:42:31.157Z",
        "createdAt": "2022-01-30T03:42:31.157Z",
        "user_photo": "https://storage.googleapis.com/stock-academic-7e9cc.appspot.com/6e8566cd-5282-49d6-bbd7-9ce44304ea7b-download.jpeg"
    },
    "message": "Sucesso!"
}

Atualizar dado de usuário:

PATCH /users/{userId}

Payload:

{
    "name": "Edmarques",
        "nickname": "edm",
        "phone": "(12) 91234-5678",
        "type_key_pix": "celular",
        "key_pix: "(12) 91234-5678",
        "cpf_or_cnpj": "123.456.789-10",
        "password": "password",
    "email": "edmarques@leaf.com",
    "wallet_id": 1,
        "is_admin": false
}

Response:

{
    "code": 200,
    "data": {},
        "message": "sucesso"
}

Buscar todos os usuários

GET /users

Payload: sem payload, Response:

{
    "code": 200,
    "data": [
        {
            "id": 3,
            "name": "Edmarques",
            "email": "edmarques@leaf.com",
            "phone": null,
            "wallet": {
                "id": 1,
                "wallet_code": "95ad7ed2-5874-4809-abfc-9f85b2e48ebb"
            }
        }
    ],
    "message": "Sucesso!"
}
edmarques11 commented 2 years ago

Correção de formatação do json