An open API service indexing awesome lists of open source software.

https://github.com/martinpcdev/backup_s15-04-t-node-react

repositorio backup del proyecto No Country s15-04-t-node-react
https://github.com/martinpcdev/backup_s15-04-t-node-react

Last synced: about 1 year ago
JSON representation

repositorio backup del proyecto No Country s15-04-t-node-react

Awesome Lists containing this project

README

          

# API DOCUMENTATION

Create an .env file with the following constants, where:

- PORT : is the port where you go to run your server.
- DATABASE_URL : is the URI of PostgresSQL database.
- JWT_SECRET : is the secret key used for JWT

Install the dependencies with npm i
Run the server with npm run dev (development)

## API Reference

### Usuario

| Type | Details | Route | Description |
| :--- | :-------------------- | :------------------------------------------ | :------------------------------------------------------------------------------------------------- |
| POST | Register user | http://localhost:PORT/api/v1/users/register | body : {email,password,nombre,apellido,dni} |
| POST | Login user | http://localhost:PORT/api/v1/users/login | body : { email, password } |
| GET | Get User Data Session | http://localhost:PORT/api/v1/users | headers : { token} |
| PUT | upgrade user by id | http://localhost:PORT/api/v1/users/:id | params : { id }, body : {password,nombre,apellido,dni,telefono,direccion,ciudad}, headers: {token} |

### Usuario schema

| Key | Type | Required |
| :------------------ | :---------------- | :------------ |
| id | string (UUID) | autogenerated |
| email | string | true |
| password | string | true |
| rol | Role | false |
| nombre | string | true |
| apellido | string | true |
| dni | string | true |
| telefono | string | false |
| direccion | string | false |
| ciudad | string | false |
| codigo_postal | string | false |
| empresa_id | string | false |
| createdAt | Date | false |
| updatedAt | Date | false |
| contrato | Contrato | false |
| empresa | Empresa | false |
| solicitudesLicencia | SolicitudLicencia | false |

**ROLE: ADMIN,USER,EMPLEADO : por Default is USER**

### Contrato

**Only Admin -> header:{ JWT Admin }**

| Type | Details | Route | Description |
| :--- | :------------- | :------------------------------------ | :-------------------------------------------------------------------- |
| POST | Nuevo Contrato | http://localhost:PORT/api/v1/contract | body : {usuarioId,salario,descripcion,cargoId,fecha_inicio,fecha_fin} |

### Contract schema

| Key | Type | Required |
| :----------- | :------------ | :------------ |
| id | string (UUID) | autogenerated |
| salario | Float | true |
| descripcion | string | true |
| fecha_inicio | Date | autogenerated |
| fecha_fin | Date | true |
| status | Status | true |
| Cargo | Cargo | false |
| cargoId | string | false |
| Usuario | Usuario | false |
| usuarioId | string | false |

**STATUS: ACTIVO, INACTIVO , Default ACTIVO**

## Cargo

**Only Admin -> header:{ JWT Admin }**

| Type | Details | Route | Description |
| :----- | :----------------- | :------------------------------------- | :------------------------------------------------------------------- |
| GET | Get All | http://localhost:PORT/api/v1/cargo | null , headers: {token} |
| POST | Create Cargo | http://localhost:PORT/api/v1/cargo | body : { nombre, descripcion } , headers: {token} |
| GET | Get Cargo By Id | http://localhost:PORT/api/v1/cargo/:id | param : { id(UUID), headers: {token} } |
| PUT | Update Cargo By Id | http://localhost:PORT/api/v1/cargo/:id | param : { id(UUID) }, body : {nombre, descripcion}, headers: {token} |
| DELETE | Delete Cargo by id | http://localhost:PORT/api/v1/cargo/:id | param : { id(UUID) }, headers: {token} |

### Cargo schema

| Key | Type | Required |
| :---------- | :------------ | :------------ |
| id | string (UUID) | autogenerated |
| nombre | string | true |
| descripcion | string | true |
| contrato | Contrato | false |

## Backend developers

- [@MartinPC](https://github.com/MarkpherDev)