Compare commits
9 Commits
12fe25e71e
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c9fecb909 | ||
| 88d3d46cd7 | |||
|
|
b60c6894bc | ||
| af51189640 | |||
| 1818de98c0 | |||
|
|
6146fcfed2 | ||
| 97992e5cdb | |||
| e1612e4301 | |||
| 17c94d1095 |
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
|
||||
@@ -202,5 +202,30 @@ namespace Core.Inventory.DAL.API.Controllers
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a Product by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The Product MongoDB identifier.</param>
|
||||
/// <returns>The result of the delete operation.</returns>
|
||||
/// <response code="200">The Product deleted successfully.</response>
|
||||
/// <response code="404">The Product not found.</response>
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpDelete]
|
||||
[Route("{id}")]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> DeleteProduct([FromRoute] string id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteProduct(id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return NotFound("Product not found");
|
||||
}
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,5 +186,27 @@ namespace Core.Inventory.DAL.API.Controllers
|
||||
var result = await service.RemoveParentTag(tagId, parentTagId, cancellationToken).ConfigureAwait(false); ;
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a Tag by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The Tag MongoDB identifier.</param>
|
||||
/// <returns>The result of the delete operation.</returns>
|
||||
/// <response code="200">The Tag deleted successfully.</response>
|
||||
/// <response code="404">The Tag not found.</response>
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpDelete]
|
||||
[Route("{id}")]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(TagAdapter), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> DeleteTag([FromRoute] string id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteTag(id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result is null) return NotFound("Tag not found");
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,5 +150,27 @@ namespace Core.Inventory.DAL.API.Controllers
|
||||
var result = await service.ChangeTagOverrideStatus(id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a TagOverride by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The TagOverride MongoDB identifier.</param>
|
||||
/// <returns>The result of the delete operation.</returns>
|
||||
/// <response code="200">The TagOverride deleted successfully.</response>
|
||||
/// <response code="404">The TagOverride not found.</response>
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpDelete]
|
||||
[Route("{id}")]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(TagOverrideAdapter), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> DeleteTagOverride([FromRoute] string id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteTagOverride(id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result is null) return NotFound("TagOverride not found");
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,5 +150,27 @@ namespace Core.Inventory.DAL.API.Controllers
|
||||
var result = await service.ChangeTagTypeStatus(id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a TagType by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The TagType MongoDB identifier.</param>
|
||||
/// <returns>The result of the delete operation.</returns>
|
||||
/// <response code="200">The TagType deleted successfully.</response>
|
||||
/// <response code="404">The TagType not found.</response>
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpDelete]
|
||||
[Route("{id}")]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(TagTypeAdapter), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> DeleteTagType([FromRoute] string id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteTagType(id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result is null) return NotFound("TagType not found");
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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="Swashbuckle.AspNetCore" Version="6.6.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"LocalAudience": "InventotyLocal"
|
||||
},
|
||||
"DetailedErrors": true,
|
||||
"UseRedisCache": true,
|
||||
"UseRedisCache": false,
|
||||
"CacheSettings": {
|
||||
"DefaultCacheDurationInMinutes": 3
|
||||
},
|
||||
|
||||
@@ -76,6 +76,14 @@ namespace Core.Inventory.Domain.Contexts.Inventory.Request
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
[JsonPropertyName("variantIds")]
|
||||
public List<string>? VariantIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the icon of the FurnitureBase.
|
||||
/// </summary>
|
||||
[BsonElement("icon")]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
[JsonPropertyName("icon")]
|
||||
public string Icon { get; set; } = null!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -49,5 +49,13 @@ namespace Core.Inventory.Domain.Contexts.Inventory.Request
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
[JsonPropertyName("line")]
|
||||
public string? Line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the icon of the FurnitureVariant.
|
||||
/// </summary>
|
||||
[BsonElement("icon")]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
[JsonPropertyName("icon")]
|
||||
public string Icon { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace Core.Inventory.Domain.Contexts.Inventory.Request
|
||||
public string Description { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the status of the product.
|
||||
/// Gets or sets the productStatus of the product.
|
||||
/// </summary>
|
||||
[BsonElement("status")]
|
||||
[BsonElement("productStatus")]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; } = null!;
|
||||
[JsonPropertyName("productStatus")]
|
||||
public string ProductStatus { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of Tag Ids associated with this product.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BuildingBlocks.Library" Version="1.0.0" />
|
||||
<PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -73,5 +73,13 @@ namespace Core.Inventory.Provider.Contracts
|
||||
/// <returns>A <see cref="{Task{ProductAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<ProductAdapter> RemoveTagFromProduct(string productId, string tagId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a Product by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="productId">The Product MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{bool}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<bool> DeleteProduct(string productId, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -55,5 +55,13 @@ namespace Core.Inventory.Provider.Contracts
|
||||
/// <returns>A <see cref="{Task{TagOverrideAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<TagOverrideAdapter> UpdateTagOverride(TagOverrideAdapter entity, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a TagOverride by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="tagOverrideId">The TagOverride MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{TagOverrideAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<TagOverrideAdapter> DeleteTagOverride(string tagOverrideId, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,5 +71,13 @@ namespace Core.Inventory.Provider.Contracts
|
||||
/// <param name="parentTagId">The identifier of the parentTag to add.</param>
|
||||
/// <returns>A <see cref="Task{TagAdapter}"/> representing the asynchronous operation, with the updated tag object.</returns>
|
||||
ValueTask<TagAdapter> RemoveParentTag(string tagId, string parentTagId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a Tag by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="TagId">The Tag MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{TagAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<TagAdapter> DeleteTag(string tagId, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,5 +55,13 @@ namespace Core.Inventory.Provider.Contracts
|
||||
/// <returns>A <see cref="{Task{TagTypeAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<TagTypeAdapter> UpdateTagType(TagTypeAdapter entity, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a TagType by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="tagTypeId">The TagType MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{TagTypeAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
ValueTask<TagTypeAdapter> DeleteTagType(string tagTypeId, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Adapters.Lib" Version="1.0.11" />
|
||||
<PackageReference Include="Core.Adapters.Lib" Version="1.0.1" />
|
||||
<PackageReference Include="Core.Blueprint.Mongo" Version="1.0.0" />
|
||||
<PackageReference Include="Core.Blueprint.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="Core.Blueprint.Redis" Version="1.0.0" />
|
||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
if (cachedData.Any()) return cachedData;
|
||||
|
||||
var data = await repository.AsQueryable();
|
||||
await cacheProvider.SetAsync(cacheKey, data);
|
||||
await cacheProvider.SetAsync(cacheKey, data, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
if (cached is not null) return cached;
|
||||
|
||||
var result = await repository.FindByIdAsync(mongoId);
|
||||
await cacheProvider.SetAsync(cacheKey, result);
|
||||
await cacheProvider.SetAsync(cacheKey, result, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
var variants = await repository.FilterByMongoFilterAsync(filter);
|
||||
|
||||
if (variants is not null && variants.Any())
|
||||
await cacheProvider.SetAsync(cacheKey, variants);
|
||||
await cacheProvider.SetAsync(cacheKey, variants, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return variants ?? [];
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
if (cached is not null) return cached;
|
||||
|
||||
var result = await repository.FindByIdAsync(mongoId);
|
||||
await cacheProvider.SetAsync(cacheKey, result);
|
||||
await cacheProvider.SetAsync(cacheKey, result, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
var variants = await repository.FilterByMongoFilterAsync(filter);
|
||||
|
||||
if (variants is not null && variants.Any())
|
||||
await cacheProvider.SetAsync(cacheKey, variants);
|
||||
await cacheProvider.SetAsync(cacheKey, variants, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return variants ?? [];
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
if (cachedData.Any()) return cachedData;
|
||||
|
||||
var data = await repository.AsQueryable();
|
||||
await cacheProvider.SetAsync(cacheKey, data);
|
||||
await cacheProvider.SetAsync(cacheKey, data, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ using Core.Inventory.Domain.Contexts.Inventory.Request;
|
||||
using Core.Inventory.Provider.Contracts;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Core.Inventory.Provider.Providers.Inventory
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var product = await repository.FindByIdAsync(_id);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, product);
|
||||
await cacheProvider.SetAsync(cacheKey, product, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return product;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var products = await repository.AsQueryable();
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, products);
|
||||
await cacheProvider.SetAsync(cacheKey, products, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return products;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var productsList = await repository.FilterByMongoFilterAsync(finalFilter);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, productsList);
|
||||
await cacheProvider.SetAsync(cacheKey, productsList, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return productsList;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
public async ValueTask<ProductAdapter> ChangeProductStatus(string id, ProductStatus newStatus, CancellationToken cancellationToken)
|
||||
{
|
||||
var entity = await repository.FindByIdAsync(id);
|
||||
entity.Status = newStatus;
|
||||
entity.ProductStatus = newStatus;
|
||||
|
||||
await repository.ReplaceOneAsync(entity);
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
public async ValueTask<ProductAdapter> AddTagToProduct(string productId, string tagId, CancellationToken cancellationToken)
|
||||
{
|
||||
var product = await repository.FindByIdAsync(productId);
|
||||
|
||||
|
||||
if (product != null)
|
||||
{
|
||||
var objectId = ObjectId.Parse(tagId);
|
||||
@@ -180,7 +180,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
public async ValueTask<ProductAdapter> RemoveTagFromProduct(string productId, string tagId, CancellationToken cancellationToken)
|
||||
{
|
||||
var product = await repository.FindByIdAsync(productId);
|
||||
|
||||
|
||||
if (product != null)
|
||||
{
|
||||
var objectId = ObjectId.Parse(tagId);
|
||||
@@ -190,5 +190,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
return product;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a Product by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="productId">The Product MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{bool}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
public async ValueTask<bool> DeleteProduct(string productId, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
await repository.DeleteByIdAsync(productId);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var TagOverride = await repository.FindByIdAsync(_id);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, TagOverride);
|
||||
await cacheProvider.SetAsync(cacheKey, TagOverride, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return TagOverride;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var TagOverrides = await repository.AsQueryable();
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, TagOverrides);
|
||||
await cacheProvider.SetAsync(cacheKey, TagOverrides, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return TagOverrides;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var TagOverridesList = await repository.FilterByMongoFilterAsync(finalFilter);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, TagOverridesList);
|
||||
await cacheProvider.SetAsync(cacheKey, TagOverridesList, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return TagOverridesList;
|
||||
}
|
||||
@@ -145,5 +145,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a TagOverride by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="tagOverrideId">The TagOverride MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{TagOverrideAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
public async ValueTask<TagOverrideAdapter> DeleteTagOverride(string tagOverrideId, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await repository.DeleteOneAsync(doc => doc._Id == tagOverrideId);
|
||||
return entity;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var tag = await repository.FindByIdAsync(_id);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, tag);
|
||||
await cacheProvider.SetAsync(cacheKey, tag, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return tag;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var tags = await repository.AsQueryable();
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, tags);
|
||||
await cacheProvider.SetAsync(cacheKey, tags, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return tags;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var TagsList = await repository.FilterByMongoFilterAsync(finalFilter);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, TagsList);
|
||||
await cacheProvider.SetAsync(cacheKey, TagsList, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return TagsList;
|
||||
}
|
||||
@@ -188,5 +188,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a Tag by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="tagId">The Tag MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{TagAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
public async ValueTask<TagAdapter> DeleteTag(string tagId, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await repository.DeleteOneAsync(doc => doc._Id == tagId);
|
||||
return entity;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var tagType = await repository.FindByIdAsync(_id);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, tagType);
|
||||
await cacheProvider.SetAsync(cacheKey, tagType, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return tagType;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var tagTypes = await repository.AsQueryable();
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, tagTypes);
|
||||
await cacheProvider.SetAsync(cacheKey, tagTypes, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return tagTypes;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
var tagTypesList = await repository.FilterByMongoFilterAsync(finalFilter);
|
||||
|
||||
await cacheProvider.SetAsync(cacheKey, tagTypesList);
|
||||
await cacheProvider.SetAsync(cacheKey, tagTypesList, TimeSpan.FromMinutes(cacheSettings.DefaultCacheDurationInMinutes));
|
||||
|
||||
return tagTypesList;
|
||||
}
|
||||
@@ -145,5 +145,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a TagType by its MongoDB identifier.
|
||||
/// </summary>
|
||||
/// <param name="tagTypeId">The TagType MongoDB identifier.</param>
|
||||
/// <returns>A <see cref="{Task{TagTypeAdapter}}"/> representing
|
||||
/// the asynchronous execution of the service.</returns>
|
||||
public async ValueTask<TagTypeAdapter> DeleteTagType(string tagTypeId, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await repository.DeleteOneAsync(doc => doc._Id == tagTypeId);
|
||||
return entity;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# ===== Build stage =====
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Copia nuget.config de la raíz (con BaGet + nuget.org)
|
||||
COPY nuget.config ./
|
||||
|
||||
# Copia SOLO los .csproj que DAL necesita (para cache de restore)
|
||||
COPY Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj Core.Inventory.DAL.API/
|
||||
COPY Core.Inventory.Domain/Core.Inventory.Domain.csproj Core.Inventory.Domain/
|
||||
COPY Core.Inventory.Provider/Core.Inventory.Provider.csproj Core.Inventory.Provider/
|
||||
|
||||
# Restaura usando nuget.config
|
||||
RUN dotnet restore Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj --configfile ./nuget.config
|
||||
|
||||
# Copia el resto del código
|
||||
COPY . .
|
||||
|
||||
# Publica artefactos listos para runtime
|
||||
RUN dotnet publish Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj \
|
||||
-c Release -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 .
|
||||
|
||||
# Configuración básica
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["dotnet", "Core.Inventory.DAL.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