Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.
Implement API security baseline (sys_user, JWT, audit fields, transactions, unique constraints) and Web real login with 401 handling. Document setup and development workflows in root, WmsLite.Api, and WmsLite.Web README files. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
fa1b286463
241 files changed
+31188
No files matched your search
@@ -0,0 +1,59 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WmsLite.Api.Common;
|
||||
using WmsLite.Api.Dtos.Material;
|
||||
using WmsLite.Api.Infrastructure.Auth;
|
||||
using WmsLite.Api.Services.Interfaces;
|
||||
|
||||
namespace WmsLite.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class MaterialController : WmsLiteControllerBase
|
||||
{
|
||||
private readonly IMaterialService _materialService;
|
||||
|
||||
public MaterialController(IMaterialService materialService, ICurrentUserContext currentUser)
|
||||
: base(currentUser)
|
||||
{
|
||||
_materialService = materialService;
|
||||
}
|
||||
|
||||
[HttpPost("paged-list")]
|
||||
public async Task<ActionResult<BusinessResult>> GetPagedList([FromBody] MaterialPagedQuery request)
|
||||
{
|
||||
var result = await _materialService.GetPagedListAsync(request);
|
||||
return Ok(BusinessResult.Ok(result));
|
||||
}
|
||||
|
||||
[HttpGet("{id:long}")]
|
||||
public async Task<ActionResult<BusinessResult>> GetById(long id)
|
||||
{
|
||||
var result = await _materialService.GetByIdAsync(id, TenantId, OwnerCode);
|
||||
return result is null
|
||||
? NotFound(BusinessResult.NotFound("Resource not found."))
|
||||
: Ok(BusinessResult.Ok(result));
|
||||
}
|
||||
|
||||
[HttpPost("create")]
|
||||
public async Task<ActionResult<BusinessResult>> Create([FromBody] MaterialSaveRequest request)
|
||||
{
|
||||
var result = await _materialService.CreateAsync(request);
|
||||
return Ok(BusinessResult.Ok(result));
|
||||
}
|
||||
|
||||
[HttpPut("update")]
|
||||
public async Task<ActionResult<BusinessResult>> Update([FromBody] MaterialUpdateRequest request)
|
||||
{
|
||||
var result = await _materialService.UpdateAsync(request);
|
||||
return result is null
|
||||
? NotFound(BusinessResult.NotFound("Resource not found."))
|
||||
: Ok(BusinessResult.Ok(result));
|
||||
}
|
||||
|
||||
[HttpDelete("{id:long}")]
|
||||
public async Task<ActionResult<BusinessResult>> Delete(long id)
|
||||
{
|
||||
var affectedRows = await _materialService.DeleteAsync(id, TenantId, OwnerCode);
|
||||
return Ok(BusinessResult.Ok(new { AffectedRows = affectedRows }));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user