fix: reduce endpoint nullability warnings
TaxBaik CI/CD / build-and-deploy (push) Failing after 5m10s

This commit is contained in:
2026-07-04 18:24:29 +09:00
parent d08de4fa10
commit 878ffdd3bb
9 changed files with 57 additions and 45 deletions
-3
View File
@@ -9,7 +9,4 @@
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using MudBlazor @using MudBlazor
@using TaxBaik.PortalClient @using TaxBaik.PortalClient
@using TaxBaik.WasmClient.Components.Admin
@using TaxBaik.WasmClient.Components.Admin.Layout
@using TaxBaik.WasmClient.Components.Admin.Shared
@using static Microsoft.AspNetCore.Components.Web.RenderMode @using static Microsoft.AspNetCore.Components.Web.RenderMode
@@ -54,7 +54,7 @@ public class GetAllActiveEndpoint : Endpoint<EmptyRequest, CommonCodeResponse>
var codes = await _service.GetAllActiveAsync(); var codes = await _service.GetAllActiveAsync();
await SendAsync(new CommonCodeResponse { Data = codes.Cast<object>().ToList() }, 200, cancellation: ct); await SendAsync(new CommonCodeResponse { Data = codes.Cast<object>().ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError("공통코드 조회 실패", statusCode: 500); ThrowError("공통코드 조회 실패", statusCode: 500);
} }
@@ -77,10 +77,12 @@ public class GetByGroupEndpoint : Endpoint<EmptyRequest, CommonCodeResponse>
var group = Route<string>("group"); var group = Route<string>("group");
try try
{ {
if (string.IsNullOrWhiteSpace(group))
ThrowError("그룹 코드가 필요합니다.", statusCode: 400);
var codes = await _service.GetByGroupAsync(group); var codes = await _service.GetByGroupAsync(group);
await SendAsync(new CommonCodeResponse { Data = codes.Cast<object>().ToList() }, 200, cancellation: ct); await SendAsync(new CommonCodeResponse { Data = codes.Cast<object>().ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError("그룹별 공통코드 조회 실패", statusCode: 500); ThrowError("그룹별 공통코드 조회 실패", statusCode: 500);
} }
@@ -105,7 +107,7 @@ public class GetGroupsEndpoint : Endpoint<EmptyRequest, GroupResponse>
var groups = await _service.GetAllGroupsAsync(); var groups = await _service.GetAllGroupsAsync();
await SendAsync(new GroupResponse { Data = groups.ToList() }, 200, cancellation: ct); await SendAsync(new GroupResponse { Data = groups.ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError("공통코드 그룹 조회 실패", statusCode: 500); ThrowError("공통코드 그룹 조회 실패", statusCode: 500);
} }
@@ -129,14 +131,16 @@ public class GetByGroupAndValueEndpoint : Endpoint<EmptyRequest, CommonCodeSingl
var value = Route<string>("value"); var value = Route<string>("value");
try try
{ {
if (string.IsNullOrWhiteSpace(group) || string.IsNullOrWhiteSpace(value))
ThrowError("그룹 코드와 값이 필요합니다.", statusCode: 400);
var code = await _service.GetAsync(group, value); var code = await _service.GetAsync(group, value);
if (code == null) if (code == null)
ThrowError("공통코드를 찾을 수 없습니다.", statusCode: 404); ThrowError("공통코드를 찾을 수 없습니다.", statusCode: 404);
await SendAsync(new CommonCodeSingleResponse { Data = code }, 200, cancellation: ct); await SendAsync(new CommonCodeSingleResponse { Data = code }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("공통코드 조회 실패", statusCode: 500);
} }
} }
} }
@@ -177,9 +181,9 @@ public class UpsertEndpoint : Endpoint<UpsertCommonCodeRequest, UpsertCommonCode
await _service.UpsertAsync(code); await _service.UpsertAsync(code);
await SendAsync(new UpsertCommonCodeResponse { Data = code }, 200, cancellation: ct); await SendAsync(new UpsertCommonCodeResponse { Data = code }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message); ThrowError("공통코드 저장 실패");
} }
} }
} }
@@ -201,12 +205,14 @@ public class DeleteEndpoint : Endpoint<EmptyRequest, EmptyResponse>
var value = Route<string>("value"); var value = Route<string>("value");
try try
{ {
if (string.IsNullOrWhiteSpace(group) || string.IsNullOrWhiteSpace(value))
ThrowError("그룹 코드와 값이 필요합니다.", statusCode: 400);
await _service.DeleteAsync(group, value); await _service.DeleteAsync(group, value);
await SendNoContentAsync(ct); await SendNoContentAsync(ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message); ThrowError("공통코드 삭제 실패");
} }
} }
} }
@@ -82,7 +82,7 @@ public class GetByIdEndpoint : Endpoint<EmptyRequest, CompanyResponse>
ThrowError("회사를 찾을 수 없습니다.", statusCode: 404); ThrowError("회사를 찾을 수 없습니다.", statusCode: 404);
await SendAsync(new CompanyResponse { Data = company }, 200, cancellation: ct); await SendAsync(new CompanyResponse { Data = company }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError("회사 조회 실패", statusCode: 500); ThrowError("회사 조회 실패", statusCode: 500);
} }
@@ -105,12 +105,14 @@ public class GetByCodeEndpoint : Endpoint<EmptyRequest, CompanyResponse>
var code = Route<string>("code"); var code = Route<string>("code");
try try
{ {
if (string.IsNullOrWhiteSpace(code))
ThrowError("회사 코드가 필요합니다.", statusCode: 400);
var company = await _service.GetByCodeAsync(code); var company = await _service.GetByCodeAsync(code);
if (company == null) if (company == null)
ThrowError("회사를 찾을 수 없습니다.", statusCode: 404); ThrowError("회사를 찾을 수 없습니다.", statusCode: 404);
await SendAsync(new CompanyResponse { Data = company }, 200, cancellation: ct); await SendAsync(new CompanyResponse { Data = company }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError("회사 조회 실패", statusCode: 500); ThrowError("회사 조회 실패", statusCode: 500);
} }
@@ -141,7 +143,7 @@ public class GetPagedEndpoint : Endpoint<GetPagedQuery, CompanyListResponse>
PageSize = request.PageSize PageSize = request.PageSize
}, 200, cancellation: ct); }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError("회사 목록 조회 실패", statusCode: 500); ThrowError("회사 목록 조회 실패", statusCode: 500);
} }
@@ -172,7 +174,7 @@ public class CreateEndpoint : Endpoint<CreateCompanyRequest, CompanyCreateRespon
{ {
ThrowError(ex.Message); ThrowError(ex.Message);
} }
catch (Exception ex) catch
{ {
ThrowError("회사 등록 실패", statusCode: 500); ThrowError("회사 등록 실패", statusCode: 500);
} }
@@ -203,7 +205,7 @@ public class UpdateEndpoint : Endpoint<UpdateCompanyRequest, CompanyUpdateRespon
{ {
ThrowError(ex.Message); ThrowError(ex.Message);
} }
catch (Exception ex) catch
{ {
ThrowError("회사 수정 실패", statusCode: 500); ThrowError("회사 수정 실패", statusCode: 500);
} }
@@ -233,7 +235,7 @@ public class DeleteEndpoint : Endpoint<EmptyRequest, CompanyDeleteResponse>
{ {
ThrowError(ex.Message); ThrowError(ex.Message);
} }
catch (Exception ex) catch
{ {
ThrowError("회사 삭제 실패", statusCode: 500); ThrowError("회사 삭제 실패", statusCode: 500);
} }
@@ -16,6 +16,8 @@ public class CreateEp : Endpoint<CreatReq, IdResp>
public override void Configure() { Post("/api/consultingactivity"); Policies("Bearer"); } public override void Configure() { Post("/api/consultingactivity"); Policies("Bearer"); }
public override async Task HandleAsync(CreatReq r, CancellationToken ct) public override async Task HandleAsync(CreatReq r, CancellationToken ct)
{ {
if (string.IsNullOrWhiteSpace(r.ActivityType) || string.IsNullOrWhiteSpace(r.Notes))
ThrowError("활동 유형과 메모가 필요합니다.", statusCode: 400);
var id = await _s.CreateAsync(r.ClientId, r.ActivityType, r.ActivityDate, r.Notes); var id = await _s.CreateAsync(r.ClientId, r.ActivityType, r.ActivityDate, r.Notes);
await SendAsync(new IdResp { Id = id }, 201, cancellation: ct); await SendAsync(new IdResp { Id = id }, 201, cancellation: ct);
} }
@@ -16,6 +16,8 @@ public class CreateEp : Endpoint<CreateRequest, IdResp>
public override void Configure() { Post("/api/contract"); Policies("Bearer"); } public override void Configure() { Post("/api/contract"); Policies("Bearer"); }
public override async Task HandleAsync(CreateRequest r, CancellationToken ct) public override async Task HandleAsync(CreateRequest r, CancellationToken ct)
{ {
if (string.IsNullOrWhiteSpace(r.ContractNumber) || string.IsNullOrWhiteSpace(r.ServiceType))
ThrowError("계약번호와 서비스 유형이 필요합니다.", statusCode: 400);
var id = await _svc.CreateAsync(r.ClientId, r.ContractNumber, r.ServiceType, r.StartDate, r.MonthlyFee, r.TotalAmount); var id = await _svc.CreateAsync(r.ClientId, r.ContractNumber, r.ServiceType, r.StartDate, r.MonthlyFee, r.TotalAmount);
await SendAsync(new IdResp { Id = id }, 201, cancellation: ct); await SendAsync(new IdResp { Id = id }, 201, cancellation: ct);
} }
@@ -62,9 +62,9 @@ public class GetUpcomingEndpoint : Endpoint<GetUpcomingQuery, TaxFilingListRespo
var filings = await _service.GetUpcomingAsync(request.DaysAhead); var filings = await _service.GetUpcomingAsync(request.DaysAhead);
await SendAsync(new TaxFilingListResponse { Data = filings.Cast<object>().ToList() }, 200, cancellation: ct); await SendAsync(new TaxFilingListResponse { Data = filings.Cast<object>().ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("예정 신고 조회 실패", statusCode: 500);
} }
} }
} }
@@ -88,9 +88,9 @@ public class GetByClientIdEndpoint : Endpoint<EmptyRequest, TaxFilingListRespons
var filings = await _service.GetByClientIdAsync(clientId); var filings = await _service.GetByClientIdAsync(clientId);
await SendAsync(new TaxFilingListResponse { Data = filings.Cast<object>().ToList() }, 200, cancellation: ct); await SendAsync(new TaxFilingListResponse { Data = filings.Cast<object>().ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("고객별 신고 조회 실패", statusCode: 500);
} }
} }
} }
@@ -116,9 +116,9 @@ public class GetByIdEndpoint : Endpoint<EmptyRequest, object>
ThrowError("신고 일정을 찾을 수 없습니다.", statusCode: 404); ThrowError("신고 일정을 찾을 수 없습니다.", statusCode: 404);
await SendAsync(filing, 200, cancellation: ct); await SendAsync(filing, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("신고 상세 조회 실패", statusCode: 500);
} }
} }
} }
@@ -141,18 +141,18 @@ public class CreateEndpoint : Endpoint<CreateTaxFilingRequest, TaxFilingResponse
var filing = new TaxFilingEntity var filing = new TaxFilingEntity
{ {
ClientId = request.ClientId, ClientId = request.ClientId,
FilingType = request.FilingType, FilingType = request.FilingType ?? string.Empty,
DueDate = request.DueDate, DueDate = request.DueDate,
Status = request.Status, Status = request.Status ?? "pending",
Memo = request.Memo Memo = request.Memo
}; };
var filingId = await _service.CreateAsync(filing); var filingId = await _service.CreateAsync(filing);
var result = await _service.GetByIdAsync(filingId); var result = await _service.GetByIdAsync(filingId);
await SendAsync(new TaxFilingResponse { Id = filingId }, 201, cancellation: ct); await SendAsync(new TaxFilingResponse { Id = filingId }, 201, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message); ThrowError("신고 생성 실패");
} }
} }
} }
@@ -176,9 +176,9 @@ public class UpdateEndpoint : Endpoint<UpdateTaxFilingRequest, TaxFilingUpdateRe
var filing = new TaxFilingEntity var filing = new TaxFilingEntity
{ {
Id = id, Id = id,
FilingType = request.FilingType, FilingType = request.FilingType ?? string.Empty,
DueDate = request.DueDate ?? DateTime.Now, DueDate = request.DueDate ?? DateTime.Now,
Status = request.Status, Status = request.Status ?? "pending",
Memo = request.Memo Memo = request.Memo
}; };
await _service.UpdateAsync(filing); await _service.UpdateAsync(filing);
@@ -187,9 +187,9 @@ public class UpdateEndpoint : Endpoint<UpdateTaxFilingRequest, TaxFilingUpdateRe
ThrowError("신고 일정을 찾을 수 없습니다.", statusCode: 404); ThrowError("신고 일정을 찾을 수 없습니다.", statusCode: 404);
await SendAsync(new TaxFilingUpdateResponse { Message = "신고 일정이 수정되었습니다." }, 200, cancellation: ct); await SendAsync(new TaxFilingUpdateResponse { Message = "신고 일정이 수정되었습니다." }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message); ThrowError("신고 수정 실패");
} }
} }
} }
@@ -213,9 +213,9 @@ public class DeleteEndpoint : Endpoint<EmptyRequest, EmptyResponse>
await _service.DeleteAsync(id); await _service.DeleteAsync(id);
await SendNoContentAsync(ct); await SendNoContentAsync(ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message); ThrowError("신고 삭제 실패");
} }
} }
} }
@@ -31,6 +31,8 @@ public class CreateEndpoint : Endpoint<CreateRequest, IdResponse>
public override async Task HandleAsync(CreateRequest req, CancellationToken ct) public override async Task HandleAsync(CreateRequest req, CancellationToken ct)
{ {
if (string.IsNullOrWhiteSpace(req.FilingType))
ThrowError("신고 유형이 필요합니다.", statusCode: 400);
var id = await _svc.CreateAsync(req.ClientId, req.FilingType, req.DueDate, req.FilingYear, req.AssignedToId); var id = await _svc.CreateAsync(req.ClientId, req.FilingType, req.DueDate, req.FilingYear, req.AssignedToId);
await SendAsync(new IdResponse { Id = id }, 201, cancellation: ct); await SendAsync(new IdResponse { Id = id }, 201, cancellation: ct);
} }
@@ -86,9 +86,9 @@ public class GetAllEndpoint : Endpoint<EmptyRequest, TaxProfileListResponse>
var profiles = await _service.GetAllAsync(); var profiles = await _service.GetAllAsync();
await SendAsync(new TaxProfileListResponse { Data = profiles.Cast<object>().ToList() }, 200, cancellation: ct); await SendAsync(new TaxProfileListResponse { Data = profiles.Cast<object>().ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("세무 프로필 조회 실패", statusCode: 500);
} }
} }
} }
@@ -114,9 +114,9 @@ public class GetByClientIdEndpoint : Endpoint<EmptyRequest, object>
ThrowError("세무 프로필을 찾을 수 없습니다.", statusCode: 404); ThrowError("세무 프로필을 찾을 수 없습니다.", statusCode: 404);
await SendAsync(profile, 200, cancellation: ct); await SendAsync(profile, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("세무 프로필 조회 실패", statusCode: 500);
} }
} }
} }
@@ -139,9 +139,9 @@ public class GetHighRiskEndpoint : Endpoint<EmptyRequest, TaxProfileListResponse
var profiles = await _service.GetHighRiskProfilesAsync(); var profiles = await _service.GetHighRiskProfilesAsync();
await SendAsync(new TaxProfileListResponse { Data = profiles.Cast<object>().ToList() }, 200, cancellation: ct); await SendAsync(new TaxProfileListResponse { Data = profiles.Cast<object>().ToList() }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("고위험 세무 프로필 조회 실패", statusCode: 500);
} }
} }
} }
@@ -164,9 +164,9 @@ public class GetUpcomingFilingsEndpoint : Endpoint<DaysAheadQuery, object>
var profiles = await _service.GetUpcomingFilingDuesAsync(request.DaysAhead); var profiles = await _service.GetUpcomingFilingDuesAsync(request.DaysAhead);
await SendAsync(new { data = profiles, daysAhead = request.DaysAhead }, 200, cancellation: ct); await SendAsync(new { data = profiles, daysAhead = request.DaysAhead }, 200, cancellation: ct);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("예정 신고 조회 실패", statusCode: 500);
} }
} }
} }
@@ -187,6 +187,8 @@ public class UpdateEndpoint : Endpoint<UpdateTaxProfileRequest, TaxProfileUpdate
var id = Route<int>("id"); var id = Route<int>("id");
try try
{ {
if (request.TaxRiskLevel is null)
request.TaxRiskLevel = "normal";
await _service.UpdateAsync(id, request.BusinessType, request.AccountingMethod, await _service.UpdateAsync(id, request.BusinessType, request.AccountingMethod,
request.NextFilingDueDate, request.TaxRiskLevel); request.NextFilingDueDate, request.TaxRiskLevel);
await SendAsync(new TaxProfileUpdateResponse { Message = "세무 프로필이 수정되었습니다." }, 200, cancellation: ct); await SendAsync(new TaxProfileUpdateResponse { Message = "세무 프로필이 수정되었습니다." }, 200, cancellation: ct);
@@ -195,9 +197,9 @@ public class UpdateEndpoint : Endpoint<UpdateTaxProfileRequest, TaxProfileUpdate
{ {
ThrowError(ex.Message); ThrowError(ex.Message);
} }
catch (Exception ex) catch
{ {
ThrowError(ex.Message, statusCode: 500); ThrowError("세무 프로필 수정 실패", statusCode: 500);
} }
} }
} }
-1
View File
@@ -395,7 +395,6 @@ app.MapStaticAssets();
// Blazor WebAssembly Admin Client // Blazor WebAssembly Admin Client
app.MapRazorComponents<TaxBaik.WasmClient.Components.Admin.App>() app.MapRazorComponents<TaxBaik.WasmClient.Components.Admin.App>()
.AddInteractiveWebAssemblyRenderMode() .AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(TaxBaik.WasmClient._Imports).Assembly)
.AllowAnonymous(); .AllowAnonymous();
// SPA 라우팅 폴백 (가장 마지막에!) // SPA 라우팅 폴백 (가장 마지막에!)