Skip to content

Commit c140e70

Browse files
committed
Add support for v2 API endpoints in VaultController
Updated the `VaultController` to include new routes for `v2` API endpoints: - Added `[HttpGet("/api/v2/vault/{key}")]` to `GetVaultAsync`. - Added `[HttpPost("/api/v2/vault/{key}")]` to `UpdateVaultAsync`. - Added `[HttpGet("/api/v2/vault/secrets/{keyId}")]` to `GetSecret`. These changes ensure backward compatibility with `v1` endpoints while enabling the application to handle `v2` requests, facilitating a smooth transition to the new API version.
1 parent 50b0d67 commit c140e70

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Sources/EasyVault.Server/Controllers/VaultController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace EasyVault.Server.Controllers
1515
public class VaultController(ILogger<VaultController> _logger, AppDbContext _dbContext, IVault _vault) : ControllerBase
1616
{
1717
[HttpGet("/api/v1/vault/{key}")]
18+
[HttpGet("/api/v2/vault/{key}")]
1819
public async Task<IEnumerable<VaultSecret>> GetVaultAsync([FromRoute][Required] string key)
1920
{
2021
string ip = Request.GetRemoteAddress();
@@ -46,6 +47,7 @@ public async Task<IEnumerable<VaultSecret>> GetVaultAsync([FromRoute][Required]
4647
}
4748

4849
[HttpPost("/api/v1/vault/{key}")]
50+
[HttpPost("/api/v2/vault/{key}")]
4951
public async Task<IActionResult> UpdateVaultAsync([FromRoute][Required] string key, [FromBody] IEnumerable<VaultSecret> secrets)
5052
{
5153
string ip = Request.GetRemoteAddress();
@@ -95,6 +97,7 @@ public async Task<IActionResult> UpdateVaultAsync([FromRoute][Required] string k
9597
}
9698

9799
[HttpGet("/api/v1/vault/secrets/{keyId}")]
100+
[HttpGet("/api/v2/vault/secrets/{keyId}")]
98101
public async Task<IActionResult> GetSecret(Guid keyId, [FromQuery] string format = "json")
99102
{
100103
string ip = Request.GetRemoteAddress();

0 commit comments

Comments
 (0)