- POST /v1/in/auth/signup 엔드포인트 추가 (AllowAnonymous) - SignupRequestDto/SignupResponseDto 생성 - AuthService.SignupAsync 구현 (이메일 중복검사, AdminCode 생성, BCrypt 해싱) - ApiResponse<T>.Success(data, msg) 오버로드 추가
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace SPMS.Domain.Common;
|
|
|
|
public class ApiResponse
|
|
{
|
|
[JsonPropertyName("result")]
|
|
public bool Result { get; init; }
|
|
|
|
[JsonPropertyName("code")]
|
|
public string Code { get; init; } = ErrorCodes.Success;
|
|
|
|
[JsonPropertyName("msg")]
|
|
public string Msg { get; init; } = string.Empty;
|
|
|
|
public static ApiResponse Success()
|
|
=> new() { Result = true, Code = ErrorCodes.Success };
|
|
|
|
public static ApiResponse Fail(string code, string msg)
|
|
=> new() { Result = false, Code = code, Msg = msg };
|
|
}
|
|
|
|
public class ApiResponse<T> : ApiResponse
|
|
{
|
|
[JsonPropertyName("data")]
|
|
public T? Data { get; init; }
|
|
|
|
public static ApiResponse<T> Success(T data)
|
|
=> new() { Result = true, Code = ErrorCodes.Success, Data = data };
|
|
|
|
public static ApiResponse<T> Success(T data, string msg)
|
|
=> new() { Result = true, Code = ErrorCodes.Success, Data = data, Msg = msg };
|
|
|
|
public new static ApiResponse<T> Fail(string code, string msg)
|
|
=> new() { Result = false, Code = code, Msg = msg };
|
|
}
|