diff --git a/services/storage-service-net/src/StorageService.API/Controllers/FilesController.cs b/services/storage-service-net/src/StorageService.API/Controllers/FilesController.cs
index 7d9099d5..db04d722 100644
--- a/services/storage-service-net/src/StorageService.API/Controllers/FilesController.cs
+++ b/services/storage-service-net/src/StorageService.API/Controllers/FilesController.cs
@@ -5,6 +5,7 @@ using StorageService.API.Application.Commands;
using StorageService.API.Application.Queries;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
+using Asp.Versioning;
namespace StorageService.API.Controllers;
@@ -13,7 +14,8 @@ namespace StorageService.API.Controllers;
/// VI: Controller cho các thao tác file.
///
[ApiController]
-[Route("api/v1/files")]
+[ApiVersion("1.0")]
+[Route("api/v{version:apiVersion}/files")]
[SwaggerTag("File Management - Upload, download, and manage files")]
public class FilesController : ControllerBase
{
diff --git a/services/storage-service-net/src/StorageService.API/Controllers/QuotaController.cs b/services/storage-service-net/src/StorageService.API/Controllers/QuotaController.cs
index 92800b14..ba34724a 100644
--- a/services/storage-service-net/src/StorageService.API/Controllers/QuotaController.cs
+++ b/services/storage-service-net/src/StorageService.API/Controllers/QuotaController.cs
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using StorageService.API.Application.Queries;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
+using Asp.Versioning;
namespace StorageService.API.Controllers;
@@ -12,7 +13,8 @@ namespace StorageService.API.Controllers;
/// VI: Controller cho các thao tác quota storage.
///
[ApiController]
-[Route("api/v1/quota")]
+[ApiVersion("1.0")]
+[Route("api/v{version:apiVersion}/quota")]
[SwaggerTag("Quota Management - View and manage storage quotas")]
public class QuotaController : ControllerBase
{
diff --git a/services/storage-service-net/src/StorageService.API/Program.cs b/services/storage-service-net/src/StorageService.API/Program.cs
index 7912fef2..a315ab16 100644
--- a/services/storage-service-net/src/StorageService.API/Program.cs
+++ b/services/storage-service-net/src/StorageService.API/Program.cs
@@ -1,9 +1,12 @@
using Asp.Versioning;
+using Asp.Versioning.ApiExplorer;
using FluentValidation;
using Hellang.Middleware.ProblemDetails;
using StorageService.API.Application.Behaviors;
using StorageService.Infrastructure;
using Serilog;
+using Microsoft.Extensions.Options;
+using Swashbuckle.AspNetCore.SwaggerGen;
// EN: Configure Serilog early / VI: Cấu hình Serilog sớm
Log.Logger = new LoggerConfiguration()
@@ -64,6 +67,7 @@ try
builder.Environment.IsDevelopment();
});
+ // EN: Add Swagger / VI: Thêm Swagger
// EN: Add Swagger / VI: Thêm Swagger
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
@@ -74,6 +78,9 @@ try
Version = "v1",
Description = "StorageService microservice API / API microservice StorageService"
});
+
+ // EN: Enable annotations / VI: Bật annotations
+ options.EnableAnnotations();
});
// EN: Add health checks / VI: Thêm health checks
diff --git a/services/storage-service-net/src/StorageService.API/StorageService.API.csproj b/services/storage-service-net/src/StorageService.API/StorageService.API.csproj
index 9328a980..fe5948ee 100644
--- a/services/storage-service-net/src/StorageService.API/StorageService.API.csproj
+++ b/services/storage-service-net/src/StorageService.API/StorageService.API.csproj
@@ -4,7 +4,9 @@
StorageService.API
StorageService.API
Web API layer with CQRS pattern for Storage Service
- storageservice-api
+
+ true
+ $(NoWarn);1591
@@ -21,6 +23,7 @@
+
@@ -37,7 +40,6 @@
-