Add Hardware
parent
062036355e
commit
ffd811231b
|
@ -0,0 +1,252 @@
|
|||
### Documentación - API ogCore
|
||||
|
||||
## Select Language / Seleccionar Idioma
|
||||
|
||||
- [English](#english)
|
||||
- [Español](#español)
|
||||
|
||||
---
|
||||
|
||||
## English
|
||||
|
||||
### Table of Contents
|
||||
|
||||
1. [Introduction](#introduction)
|
||||
2. [Configuration](#configuration)
|
||||
3. [Resource Definition](#resource-definition)
|
||||
4. [API Operations](#api-operations)
|
||||
5. [Entity Properties](#entity-properties)
|
||||
6. [Hardware Input DTO](#hardware-input-dto)
|
||||
|
||||
### Introduction
|
||||
|
||||
This documentation describes the configuration of API Platform in a Symfony project. It details the resources, operations, and entity properties exposed through the API.
|
||||
|
||||
### Configuration
|
||||
|
||||
API configuration is done in Symfony configuration files, usually in the `config/packages/api_platform.yaml` file.
|
||||
|
||||
```yaml
|
||||
resources:
|
||||
App\Entity\Hardware:
|
||||
processor: App\State\Processor\HardwareProcessor
|
||||
input: App\Dto\Input\HardwareInput
|
||||
output: App\Dto\Output\HardwareOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'hardware:read']
|
||||
denormalizationContext:
|
||||
groups: ['hardware:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
filters:
|
||||
- 'api_platform.filter.hardware.order'
|
||||
- 'api_platform.filter.hardware.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Hardware:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
||||
```
|
||||
|
||||
### Resource Definition
|
||||
|
||||
#### App\Entity\Hardware
|
||||
|
||||
- **Processor**: `App\State\Processor\HardwareProcessor`
|
||||
- **Input**: `App\Dto\Input\HardwareInput`
|
||||
- **Output**: `App\Dto\Output\HardwareOutput`
|
||||
- **Normalization Context**: `['default', 'hardware:read']`
|
||||
- **Denormalization Context**: `['hardware:write']`
|
||||
|
||||
### API Operations
|
||||
|
||||
#### Hardware Operations
|
||||
|
||||
##### Get Hardware Collection (GetCollection)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
- **Filters**:
|
||||
- Order hardware: `api_platform.filter.hardware.order`
|
||||
- Search hardware: `api_platform.filter.hardware.search`
|
||||
|
||||
##### Get Hardware (Get)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
|
||||
##### Update Hardware (Put)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
|
||||
##### Partially Update Hardware (Patch)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
|
||||
##### Create Hardware (Post)
|
||||
- **Default Operation**: ~
|
||||
|
||||
##### Delete Hardware (Delete)
|
||||
- **Default Operation**: ~
|
||||
|
||||
### Entity Properties
|
||||
|
||||
#### App\Entity\Hardware
|
||||
|
||||
- **id**:
|
||||
- **Identifier**: `false`
|
||||
|
||||
- **uuid**:
|
||||
- **Identifier**: `true`
|
||||
|
||||
### Hardware Input DTO
|
||||
|
||||
#### Fields Required in Hardware Endpoint Input
|
||||
|
||||
1. **name**
|
||||
- **Type**: string
|
||||
- **Validation**: Not blank
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
2. **description**
|
||||
- **Type**: string
|
||||
- **Validation**: Optional
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
3. **type**
|
||||
- **Type**: string
|
||||
- **Validation**: Not blank
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
4. **price**
|
||||
- **Type**: float
|
||||
- **Validation**: Positive value
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
---
|
||||
|
||||
## Español
|
||||
|
||||
### Índice
|
||||
|
||||
1. [Introducción](#introducción)
|
||||
2. [Configuración](#configuración)
|
||||
3. [Definición de Recursos](#definición-de-recursos)
|
||||
4. [Operaciones de API](#operaciones-de-api)
|
||||
5. [Propiedades de la Entidad](#propiedades-de-la-entidad)
|
||||
6. [DTO de Entrada de Hardware](#dto-de-entrada-de-hardware)
|
||||
|
||||
### Introducción
|
||||
|
||||
Esta documentación describe la configuración de API Platform en un proyecto Symfony. Se detallan los recursos, operaciones y propiedades de las entidades expuestas a través de la API.
|
||||
|
||||
### Configuración
|
||||
|
||||
La configuración de la API se realiza en los archivos de configuración de Symfony, generalmente en `config/packages/api_platform.yaml`.
|
||||
|
||||
```yaml
|
||||
resources:
|
||||
App\Entity\Hardware:
|
||||
processor: App\State\Processor\HardwareProcessor
|
||||
input: App\Dto\Input\HardwareInput
|
||||
output: App\Dto\Output\HardwareOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'hardware:read']
|
||||
denormalizationContext:
|
||||
groups: ['hardware:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
filters:
|
||||
- 'api_platform.filter.hardware.order'
|
||||
- 'api_platform.filter.hardware.search'
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\HardwareProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\Hardware:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
||||
```
|
||||
|
||||
### Definición de Recursos
|
||||
|
||||
#### App\Entity\Hardware
|
||||
|
||||
- **Processor**: `App\State\Processor\HardwareProcessor`
|
||||
- **Input**: `App\Dto\Input\HardwareInput`
|
||||
- **Output**: `App\Dto\Output\HardwareOutput`
|
||||
- **Contexto de Normalización**: `['default', 'hardware:read']`
|
||||
- **Contexto de Desnormalización**: `['hardware:write']`
|
||||
|
||||
### Operaciones de API
|
||||
|
||||
#### Operaciones de Hardware
|
||||
|
||||
##### Obtener Colección de Hardware (GetCollection)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
- **Filtros**:
|
||||
- Ordenar hardware: `api_platform.filter.hardware.order`
|
||||
- Buscar hardware: `api_platform.filter.hardware.search`
|
||||
|
||||
##### Obtener Hardware (Get)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
|
||||
##### Actualizar Hardware (Put)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
|
||||
##### Actualización Parcial de Hardware (Patch)
|
||||
- **Provider**: `App\State\Provider\HardwareProvider`
|
||||
|
||||
##### Crear Hardware (Post)
|
||||
- **Operación Predeterminada**: ~
|
||||
|
||||
##### Eliminar Hardware (Delete)
|
||||
- **Operación Predeterminada**: ~
|
||||
|
||||
### Propiedades de la Entidad
|
||||
|
||||
#### App\Entity\Hardware
|
||||
|
||||
- **id**:
|
||||
- **Identificador**: `false`
|
||||
|
||||
- **uuid**:
|
||||
- **Identificador**: `true`
|
||||
|
||||
### DTO de Entrada de Hardware
|
||||
|
||||
#### Campos Requeridos en la Entrada del Endpoint de Hardware
|
||||
|
||||
1. **name**
|
||||
- **Tipo**: string
|
||||
- **Validación**: No nulo
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
2. **description**
|
||||
- **Tipo**: string
|
||||
- **Validación**: Opcional
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
3. **type**
|
||||
- **Tipo**: string
|
||||
- **Validación**: No nulo
|
||||
- **Groups**: `hardware:write`
|
||||
|
||||
4. **price**
|
||||
- **Tipo**: float
|
||||
- **Validación**: Valor positivo
|
||||
- **Groups**: `hardware:write`
|
Loading…
Reference in New Issue