Files
Distribution_GL/Helpers/ResponseHelpers.cs

28 lines
1004 B
C#

using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Services
{
// Shared ApiResponse success-path builder (01_Full_Development_Plan.md Section 10.4) - removes
// the repeated `new ApiResponse { StatusCode = ..., Success = true, ... }` block duplicated in
// nearly every Service method. Does not modify ApiResponse itself (CLAUDE.md Rule 1 foundation,
// off-limits without asking) - this is a separate builder file that constructs one.
internal static class ResponseHelpers
{
public static ApiResponse Ok(string message, object? data) => new()
{
StatusCode = StatusCodes.Status200OK,
Success = true,
Message = message,
Data = data
};
public static ApiResponse Created(string message, object? data) => new()
{
StatusCode = StatusCodes.Status201Created,
Success = true,
Message = message,
Data = data
};
}
}