Update the Id check in branch update API
This commit is contained in:
parent
bd2f9d953f
commit
a31266ee4a
@ -808,9 +808,9 @@ namespace Marco.Pms.Services.Service
|
|||||||
public async Task<ApiResponse<object>> UpdateProjectBranchAsync(Guid id, ProjectBranchDto model, Employee loggedInEmployee, Guid tenantId)
|
public async Task<ApiResponse<object>> UpdateProjectBranchAsync(Guid id, ProjectBranchDto model, Employee loggedInEmployee, Guid tenantId)
|
||||||
{
|
{
|
||||||
// Validate ID consistency between route parameter and payload DTO
|
// Validate ID consistency between route parameter and payload DTO
|
||||||
if (model.Id.HasValue && model.Id != id)
|
if (!model.Id.HasValue && model.Id != id)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ID mismatch: Route ID {RouteId} != Payload ID {PayloadId}", id, model.Id);
|
_logger.LogWarning("ID mismatch: Route ID {RouteId} != Payload ID {PayloadId}", id, model.Id ?? Guid.Empty);
|
||||||
return ApiResponse<object>.ErrorResponse("ID mismatch between route and payload", "The ID provided in the route does not match the payload.", 400);
|
return ApiResponse<object>.ErrorResponse("ID mismatch between route and payload", "The ID provided in the route does not match the payload.", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user