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
- Host: GitHub
- URL: https://github.com/martinpcdev/backup_s15-04-t-node-react
- Owner: MartinpcDev
- Created: 2024-06-12T17:05:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-12T17:28:35.000Z (almost 2 years ago)
- Last Synced: 2025-02-02T13:16:36.313Z (over 1 year ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)