feat: Added Product controller and endpoints (Service Layer)
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| using Core.Adapters.Lib; | ||||
| using Core.Adapters.Lib.Inventory; | ||||
| using Core.Blueprint.Mongo; | ||||
| using Core.Inventory.External.Clients.Adapters; | ||||
| using Core.Inventory.External.Clients.Requests; | ||||
| @@ -101,5 +102,33 @@ namespace Core.Inventory.External.Clients | ||||
|         Task<TagAdapter> RemoveParentTagAsync([FromRoute] string tagId, [FromRoute] string parentTagId, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         #endregion | ||||
|  | ||||
|         #region Product | ||||
|  | ||||
|         [Get("/api/v1/Product")] | ||||
|         Task<IEnumerable<ProductAdapter>> GetAllProductsAsync(CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/api/v1/Product/GetProductList")] | ||||
|         Task<IEnumerable<ProductAdapter>> GetAllProductsByListAsync([FromBody] string[] request, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Get("/api/v1/Product/{id}")] | ||||
|         Task<ProductAdapter> GetProductByIdAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/api/v1/Product")] | ||||
|         Task<ProductAdapter> CreateProductAsync([FromBody] ProductRequest newProduct, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Put("/api/v1/Product/{id}")] | ||||
|         Task<ProductAdapter> UpdateProductAsync([FromBody] ProductAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Patch("/api/v1/Product/{id}/{newStatus}/ChangeStatus")] | ||||
|         Task<ProductAdapter> ChangeProductStatusAsync([FromRoute] string id, [FromRoute] ProductStatus newStatus, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Post("/api/v1/Product/{productId}/tags/{tagId}")] | ||||
|         Task<ProductAdapter> AddTagToProductAsync([FromRoute] string productId, [FromRoute] string tagId, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         [Delete("/api/v1/Product/{productId}/tags/{tagId}")] | ||||
|         Task<ProductAdapter> RemoveTagFromProductAsync([FromRoute] string productId, [FromRoute] string tagId, CancellationToken cancellationToken = default); | ||||
|  | ||||
|         #endregion | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										11
									
								
								Core.Inventory.External/Clients/Requests/ProductRequest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Core.Inventory.External/Clients/Requests/ProductRequest.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| namespace Core.Inventory.External.Clients.Requests | ||||
| { | ||||
|     public class ProductRequest | ||||
|     { | ||||
|         public string TenantId { get; set; } = null!; | ||||
|         public string ProductName { get; set; } = null!; | ||||
|         public string Description { get; set; } = null!; | ||||
|         public string Status { get; set; } = null!; | ||||
|         public List<string> TagIds { get; set; } = new List<string>(); | ||||
|     } | ||||
| }  | ||||
		Reference in New Issue
	
	Block a user