feat: add inventory management system with product, category, and movement tracking
- Implemented global styles using Tailwind CSS for consistent theming. - Created layout component to structure the application with a navigation bar. - Developed Movements page to handle inventory entries and exits, including form submission and data display. - Added Products page for listing, editing, and deleting products with API integration. - Introduced Categories management functionality. - Built Navbar component for easy navigation across the application. - Established API service for handling requests to the backend. - Defined TypeScript types for Category, Product, and InventoryMovement to ensure type safety. - Configured TypeScript settings for the project.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Inventario.Core.Interfaces;
|
||||
using Inventario.Core.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Inventario.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class InventoryMovementsController : ControllerBase
|
||||
{
|
||||
private readonly IInventoryMovementRepository _repository;
|
||||
|
||||
public InventoryMovementsController(IInventoryMovementRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<InventoryMovement>>> GetAll()
|
||||
{
|
||||
var movements = await _repository.GetAllAsync();
|
||||
return Ok(movements);
|
||||
}
|
||||
|
||||
[HttpGet("product/{productId}")]
|
||||
public async Task<ActionResult<IEnumerable<InventoryMovement>>> GetByProduct(int productId)
|
||||
{
|
||||
var movements = await _repository.GetByProductIdAsync(productId);
|
||||
return Ok(movements);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<InventoryMovement>> Create(InventoryMovement movement)
|
||||
{
|
||||
var created = await _repository.AddAsync(movement);
|
||||
return CreatedAtAction(nameof(GetByProduct), new { productId = created.ProductId }, created);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user