"vscode:/vscode.git/clone" n'existait pas sur "d037c68d656183e43271bc93f94da9c16cfd5949"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace App\Dto;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\QueryParameter;
use App\State\TaxFieldStatProvider;
#[ApiResource(
shortName: 'TaxFieldStat',
paginationEnabled: false,
operations: [
new Get(
uriTemplate: '/somme/{field}',
name: 'tax_sum',
description: 'Calculate the sum of a specific tax field (tfpnb, tfpb, th, cfe)',
provider: TaxFieldStatProvider::class,
),
new Get(
uriTemplate: '/average/{field}',
name: 'tax_average',
description: 'Calculate the average of a specific tax field (tfpnb, tfpb, th, cfe)',
provider: TaxFieldStatProvider::class,
),
],
)]
#[QueryParameter(key: 'department_id', schema: ['type' => 'string'])]
#[QueryParameter(key: 'year', schema: ['type' => 'integer'])]
class TaxFieldStat
{
public function __construct(
public readonly string $field = '',
public readonly ?float $sum = null,
public readonly ?float $average = null,
public readonly array $filters = [],
) {}
}