-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathWageTypeController.cs
More file actions
109 lines (101 loc) · 4.1 KB
/
Copy pathWageTypeController.cs
File metadata and controls
109 lines (101 loc) · 4.1 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PayrollEngine.Api.Core;
using PayrollEngine.Domain.Application.Service;
using ApiObject = PayrollEngine.Api.Model;
namespace PayrollEngine.Backend.Controller;
/// <inheritdoc/>
[ApiControllerName("Wage types")]
[Route("api/tenants/{tenantId}/regulations/{regulationId}/wagetypes")]
[TenantAuthorize]
public class WageTypeController : Api.Controller.WageTypeController
{
/// <inheritdoc/>
public WageTypeController(IRegulationService regulationService, IWageTypeService wageTypeService,
IControllerRuntime runtime) :
base(regulationService, wageTypeService, runtime)
{
}
/// <summary>
/// Query regulation wage types
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="regulationId">The regulation id</param>
/// <param name="query">Query parameters</param>
/// <returns>The regulation wage types</returns>
[HttpGet]
[OkResponse]
[NotFoundResponse]
[UnprocessableEntityResponse]
[ApiOperationId("QueryWageTypes")]
public async Task<ActionResult> QueryWageTypesAsync(int tenantId, int regulationId,
[FromQuery] Query query) =>
await QueryItemsAsync(regulationId, query);
/// <summary>
/// Get a regulation wageType
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="regulationId">The regulation id</param>
/// <param name="wageTypeId">The wage type id</param>
/// <returns>The regulation wageType</returns>
[HttpGet("{wageTypeId}")]
[OkResponse]
[NotFoundResponse]
[ApiOperationId("GetWageType")]
public async Task<ActionResult<ApiObject.WageType>> GetWageTypeAsync(
int tenantId, int regulationId, int wageTypeId) =>
await GetAsync(regulationId, wageTypeId);
/// <summary>
/// Add a new regulation wage type
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="regulationId">The regulation id</param>
/// <param name="wageType">The wage type to add</param>
/// <returns>The newly created regulation wage type</returns>
[HttpPost]
[CreatedResponse]
[NotFoundResponse]
[UnprocessableEntityResponse]
[ApiOperationId("CreateWageType")]
public async Task<ActionResult<ApiObject.WageType>> CreateWageTypeAsync(
int tenantId, int regulationId, ApiObject.WageType wageType) =>
await CreateAsync(regulationId, wageType);
/// <summary>
/// Update a regulation wage type
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="regulationId">The regulation id</param>
/// <param name="wageType">The wage type with updated values</param>
/// <returns>The modified regulation wage type</returns>
[HttpPut("{wageTypeId}")]
[OkResponse]
[NotFoundResponse]
[UnprocessableEntityResponse]
[ApiOperationId("UpdateWageType")]
public async Task<ActionResult<ApiObject.WageType>> UpdateWageTypeAsync(
int tenantId, int regulationId, ApiObject.WageType wageType) =>
await UpdateAsync(regulationId, wageType);
/// <summary>
/// Rebuild regulation wage type
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="regulationId">The regulation id</param>
/// <param name="wageTypeId">The id of the wage type</param>
[HttpPut("{wageTypeId}/rebuild")]
[NotFoundResponse]
[ApiOperationId("RebuildWageType")]
public async Task<ActionResult> RebuildWageTypeAsync(int tenantId,
int regulationId, int wageTypeId) =>
await RebuildAsync(regulationId, wageTypeId);
/// <summary>
/// Delete a regulation wage type
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="regulationId">The regulation id</param>
/// <param name="wageTypeId">The id of the wage type</param>
[HttpDelete("{wageTypeId}")]
[ApiOperationId("DeleteWageType")]
public async Task<IActionResult> DeleteWageTypeAsync(int tenantId,
int regulationId, int wageTypeId) =>
await DeleteAsync(regulationId, wageTypeId);
}