Compare commits
	
		
			4 Commits
		
	
	
		
			cf957eb3e0
			...
			developmen
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 37b9888532 | ||
| 6ec76fc975 | |||
| 1c193b68bb | |||
|   | d4d0a4d2d1 | 
							
								
								
									
										12
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| **/bin | ||||
| **/obj | ||||
| **/out | ||||
| **/.vs | ||||
| **/.idea | ||||
| **/.git | ||||
| **/.gitignore | ||||
| **/node_modules | ||||
| *.user | ||||
| *.swp | ||||
| *.swo | ||||
| .DS_Store | ||||
| @@ -2,6 +2,7 @@ | ||||
| using Core.Adapters.Lib; | ||||
| using Core.Inventory.External.Clients.Inventory; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.Tag; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.TagType; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| @@ -257,5 +258,34 @@ namespace Core.Inventory.BFF.API.Controllers | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Deletes a full Tag by identifier. | ||||
|         /// </summary> | ||||
|         [HttpDelete("Delete")] | ||||
|         [ProducesResponseType(StatusCodes.Status200OK)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         public async Task<IActionResult> DeleteTagService(DeleteTagRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 logger.LogInformation($"{nameof(DeleteTagService)} - Request received - Payload: {JsonSerializer.Serialize(request)}"); | ||||
|  | ||||
|                 if (request == null) return BadRequest("Invalid Tag object"); | ||||
|  | ||||
|                 if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid Tag identifier"); | ||||
|  | ||||
|                 return await Handle(() => inventoryServiceClient.DeleteTagService(request, cancellationToken)).ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 logger.LogError($"{nameof(DeleteTagService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}"); | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| using Core.Adapters.Lib; | ||||
| using Core.Inventory.External.Clients.Inventory; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.TagOverride; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.TagType; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| @@ -202,6 +203,33 @@ namespace Core.Inventory.BFF.API.Controllers | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Deletes a full TagOverride by identifier. | ||||
|         /// </summary> | ||||
|         [HttpDelete("Delete")] | ||||
|         [ProducesResponseType(StatusCodes.Status200OK)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         public async Task<IActionResult> DeleteTagOverrideService(DeleteTagOverrideRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 logger.LogInformation($"{nameof(DeleteTagOverrideService)} - Request received - Payload: {JsonSerializer.Serialize(request)}"); | ||||
|  | ||||
|                 if (request == null) return BadRequest("Invalid TagOverride object"); | ||||
|  | ||||
|                 if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid TagOverride identifier"); | ||||
|  | ||||
|                 return await Handle(() => inventoryServiceClient.DeleteTagOverrideService(request, cancellationToken)).ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 logger.LogError($"{nameof(DeleteTagOverrideService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}"); | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -198,6 +198,33 @@ namespace Core.Inventory.BFF.API.Controllers | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Deletes a full TagType by identifier. | ||||
|         /// </summary> | ||||
|         [HttpDelete("Delete")] | ||||
|         [ProducesResponseType(StatusCodes.Status200OK)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         public async Task<IActionResult> DeleteTagTypeService(DeleteTagTypeRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 logger.LogInformation($"{nameof(DeleteTagTypeService)} - Request received - Payload: {JsonSerializer.Serialize(request)}"); | ||||
|  | ||||
|                 if (request == null) return BadRequest("Invalid TagType object"); | ||||
|  | ||||
|                 if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid TagType identifier"); | ||||
|  | ||||
|                 return await Handle(() => inventoryServiceClient.DeleteTagTypeService(request, cancellationToken)).ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 logger.LogError($"{nameof(DeleteTagTypeService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}"); | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" /> | ||||
|     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" /> | ||||
|     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.0" /> | ||||
|     <PackageReference Include="OpenTelemetry" Version="1.12.0" /> | ||||
|     <PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.12.0" /> | ||||
|     <PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" /> | ||||
|   | ||||
| @@ -76,6 +76,9 @@ namespace Core.Inventory.External.Clients.Inventory | ||||
|         [Patch("/api/v1/TagType/ChangeStatus")] | ||||
|         Task<ApiResponse<TagTypeAdapter>> ChangeTagTypeStatusService([Header("TrackingId")][Body] ChangeTagTypeStatusRequest request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/api/v1/TagType/Delete")] | ||||
|         Task<ApiResponse<TagTypeAdapter>> DeleteTagTypeService([Header("TrackingId")][Body] DeleteTagTypeRequest request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         #endregion | ||||
|  | ||||
|         #region Tag | ||||
| @@ -104,6 +107,9 @@ namespace Core.Inventory.External.Clients.Inventory | ||||
|         [Delete("/api/v1/Tag/RemoveParentTag")] | ||||
|         Task<ApiResponse<TagAdapter>> RemoveParentTagAsync([Header("TrackingId")][Body] RemoveParentTagFromTag request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/api/v1/Tag/Delete")] | ||||
|         Task<ApiResponse<TagAdapter>> DeleteTagService([Header("TrackingId")][Body] DeleteTagRequest request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         #endregion | ||||
|  | ||||
|         #region TagOverride | ||||
| @@ -126,6 +132,9 @@ namespace Core.Inventory.External.Clients.Inventory | ||||
|         [Patch("/api/v1/TagOverride/ChangeStatus")] | ||||
|         Task<ApiResponse<TagOverrideAdapter>> ChangeTagOverrideStatusService([Header("TrackingId")][Body] ChangeTagOverrideStatusRequest request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/api/v1/TagOverride/Delete")] | ||||
|         Task<ApiResponse<TagOverrideAdapter>> DeleteTagOverrideService([Header("TrackingId")][Body] DeleteTagOverrideRequest request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         #endregion | ||||
|  | ||||
|         #region Product | ||||
|   | ||||
| @@ -12,5 +12,6 @@ namespace Core.Inventory.External.Clients.Inventory.Requests.Base | ||||
|         public string? MaintenanceNotes { get; set; } | ||||
|         public DimensionsRequest Dimensions { get; set; } = new(); | ||||
|         public List<string>? VariantIds { get; set; } | ||||
|         public string Icon { get; set; } = null!; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -14,5 +14,6 @@ namespace Core.Inventory.External.Clients.Inventory.Requests.Base | ||||
|         public string? MaintenanceNotes { get; set; } | ||||
|         public DimensionsRequest Dimensions { get; set; } = new(); | ||||
|         public List<string>? VariantIds { get; set; } | ||||
|         public string Icon { get; set; } = null!; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,14 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
|  | ||||
| namespace Core.Inventory.External.Clients.Inventory.Requests.Tag | ||||
| { | ||||
|     public class DeleteTagRequest : Notificator, ICommand | ||||
|     { | ||||
|         public string Id { get; set; } = null!; | ||||
|  | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return Id != null; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,14 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
|  | ||||
| namespace Core.Inventory.External.Clients.Inventory.Requests.TagOverride | ||||
| { | ||||
|     public class DeleteTagOverrideRequest : Notificator, ICommand | ||||
|     { | ||||
|         public string Id { get; set; } = null!; | ||||
|  | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return Id != null; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,14 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
|  | ||||
| namespace Core.Inventory.External.Clients.Inventory.Requests.TagType | ||||
| { | ||||
|     public class DeleteTagTypeRequest : Notificator, ICommand | ||||
|     { | ||||
|         public string Id { get; set; } = null!; | ||||
|  | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return Id != null; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -15,5 +15,6 @@ | ||||
|         public string ProviderId { get; set; } = string.Empty; | ||||
|  | ||||
|         public Dictionary<string, string> Attributes { get; set; } = []; | ||||
|         public string Icon { get; set; } = null!; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,5 +17,6 @@ | ||||
|         public string ProviderId { get; set; } = string.Empty; | ||||
|  | ||||
|         public Dictionary<string, string> Attributes { get; set; } = new(); | ||||
|         public string Icon { get; set; } = null!; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,8 +7,8 @@ | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Adapters.Lib" Version="1.0.13" /> | ||||
|     <PackageReference Include="BuildingBlocks.Library" Version="1.0.0" /> | ||||
|     <PackageReference Include="Core.Adapters.Lib" Version="1.0.1" /> | ||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> | ||||
|     <PackageReference Include="Refit" Version="8.0.0" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   | ||||
							
								
								
									
										38
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| # ===== Build stage ===== | ||||
| FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||||
| WORKDIR /src | ||||
|  | ||||
| # Usar tu feed (BaGet) + nuget.org | ||||
| COPY nuget.config ./ | ||||
|  | ||||
| # Copiar SOLO los .csproj primero (mejor caché) | ||||
| COPY Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj Core.Inventory.BFF.API/ | ||||
| COPY Core.Inventory.External/Core.Inventory.External.csproj Core.Inventory.External/ | ||||
|  | ||||
| # Restore con tu nuget.config | ||||
| RUN dotnet restore Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj --configfile ./nuget.config | ||||
|  | ||||
| # Copiar el resto del código | ||||
| COPY . . | ||||
|  | ||||
| # Publicar artefactos | ||||
| ARG BUILD_CONFIGURATION=Release | ||||
| RUN dotnet publish Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj \ | ||||
|     -c $BUILD_CONFIGURATION -o /app/out /p:UseAppHost=false | ||||
|  | ||||
| # ===== Runtime stage ===== | ||||
| FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime | ||||
| WORKDIR /app | ||||
| COPY --from=build /app/out . | ||||
|  | ||||
| # Config base | ||||
| ENV ASPNETCORE_URLS=http://+:8080 \ | ||||
|     ASPNETCORE_ENVIRONMENT=Production | ||||
|  | ||||
| EXPOSE 8080 | ||||
|  | ||||
| # (Opcional) Healthcheck si tienes endpoint /health | ||||
| # HEALTHCHECK --interval=30s --timeout=5s --retries=5 \ | ||||
| #   CMD wget -qO- http://localhost:8080/health || exit 1 | ||||
|  | ||||
| ENTRYPOINT ["dotnet", "Core.Inventory.BFF.API.dll"] | ||||
							
								
								
									
										9
									
								
								nuget.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								nuget.config
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <configuration> | ||||
|   <packageSources> | ||||
|     <!-- Tu BaGet primero --> | ||||
|     <add key="BaGet" value="https://nuget.dream-views.com/v3/index.json" protocolVersion="3" /> | ||||
|     <!-- NuGet oficial como fallback (si quieres) --> | ||||
|     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||||
|   </packageSources> | ||||
| </configuration> | ||||
		Reference in New Issue
	
	Block a user