diff --git a/src/TaxBaik.Portal.Client/_Imports.razor b/src/TaxBaik.Portal.Client/_Imports.razor index ee04635..27e9c7e 100644 --- a/src/TaxBaik.Portal.Client/_Imports.razor +++ b/src/TaxBaik.Portal.Client/_Imports.razor @@ -9,7 +9,4 @@ @using Microsoft.JSInterop @using MudBlazor @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 diff --git a/src/TaxBaik.Web/Endpoints/CommonCode/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/CommonCode/AllEndpoints.cs index 4c28d90..4d0fb47 100644 --- a/src/TaxBaik.Web/Endpoints/CommonCode/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/CommonCode/AllEndpoints.cs @@ -54,7 +54,7 @@ public class GetAllActiveEndpoint : Endpoint var codes = await _service.GetAllActiveAsync(); await SendAsync(new CommonCodeResponse { Data = codes.Cast().ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { ThrowError("공통코드 조회 실패", statusCode: 500); } @@ -77,10 +77,12 @@ public class GetByGroupEndpoint : Endpoint var group = Route("group"); try { + if (string.IsNullOrWhiteSpace(group)) + ThrowError("그룹 코드가 필요합니다.", statusCode: 400); var codes = await _service.GetByGroupAsync(group); await SendAsync(new CommonCodeResponse { Data = codes.Cast().ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { ThrowError("그룹별 공통코드 조회 실패", statusCode: 500); } @@ -105,7 +107,7 @@ public class GetGroupsEndpoint : Endpoint var groups = await _service.GetAllGroupsAsync(); await SendAsync(new GroupResponse { Data = groups.ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { ThrowError("공통코드 그룹 조회 실패", statusCode: 500); } @@ -129,14 +131,16 @@ public class GetByGroupAndValueEndpoint : Endpoint("value"); try { + if (string.IsNullOrWhiteSpace(group) || string.IsNullOrWhiteSpace(value)) + ThrowError("그룹 코드와 값이 필요합니다.", statusCode: 400); var code = await _service.GetAsync(group, value); if (code == null) ThrowError("공통코드를 찾을 수 없습니다.", statusCode: 404); 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 var value = Route("value"); try { + if (string.IsNullOrWhiteSpace(group) || string.IsNullOrWhiteSpace(value)) + ThrowError("그룹 코드와 값이 필요합니다.", statusCode: 400); await _service.DeleteAsync(group, value); await SendNoContentAsync(ct); } - catch (Exception ex) + catch { - ThrowError(ex.Message); + ThrowError("공통코드 삭제 실패"); } } } diff --git a/src/TaxBaik.Web/Endpoints/Company/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/Company/AllEndpoints.cs index 749e4cb..b9aa3b1 100644 --- a/src/TaxBaik.Web/Endpoints/Company/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/Company/AllEndpoints.cs @@ -82,7 +82,7 @@ public class GetByIdEndpoint : Endpoint ThrowError("회사를 찾을 수 없습니다.", statusCode: 404); await SendAsync(new CompanyResponse { Data = company }, 200, cancellation: ct); } - catch (Exception ex) + catch { ThrowError("회사 조회 실패", statusCode: 500); } @@ -105,12 +105,14 @@ public class GetByCodeEndpoint : Endpoint var code = Route("code"); try { + if (string.IsNullOrWhiteSpace(code)) + ThrowError("회사 코드가 필요합니다.", statusCode: 400); var company = await _service.GetByCodeAsync(code); if (company == null) ThrowError("회사를 찾을 수 없습니다.", statusCode: 404); await SendAsync(new CompanyResponse { Data = company }, 200, cancellation: ct); } - catch (Exception ex) + catch { ThrowError("회사 조회 실패", statusCode: 500); } @@ -141,7 +143,7 @@ public class GetPagedEndpoint : Endpoint PageSize = request.PageSize }, 200, cancellation: ct); } - catch (Exception ex) + catch { ThrowError("회사 목록 조회 실패", statusCode: 500); } @@ -172,7 +174,7 @@ public class CreateEndpoint : Endpoint { ThrowError(ex.Message); } - catch (Exception ex) + catch { ThrowError("회사 삭제 실패", statusCode: 500); } diff --git a/src/TaxBaik.Web/Endpoints/ConsultingActivity/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/ConsultingActivity/AllEndpoints.cs index bde397f..2bc52ac 100644 --- a/src/TaxBaik.Web/Endpoints/ConsultingActivity/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/ConsultingActivity/AllEndpoints.cs @@ -16,6 +16,8 @@ public class CreateEp : Endpoint public override void Configure() { Post("/api/consultingactivity"); Policies("Bearer"); } 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); await SendAsync(new IdResp { Id = id }, 201, cancellation: ct); } diff --git a/src/TaxBaik.Web/Endpoints/Contract/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/Contract/AllEndpoints.cs index e9d5a6a..797e99e 100644 --- a/src/TaxBaik.Web/Endpoints/Contract/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/Contract/AllEndpoints.cs @@ -16,6 +16,8 @@ public class CreateEp : Endpoint public override void Configure() { Post("/api/contract"); Policies("Bearer"); } 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); await SendAsync(new IdResp { Id = id }, 201, cancellation: ct); } diff --git a/src/TaxBaik.Web/Endpoints/TaxFiling/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/TaxFiling/AllEndpoints.cs index 851f11c..d52515e 100644 --- a/src/TaxBaik.Web/Endpoints/TaxFiling/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/TaxFiling/AllEndpoints.cs @@ -62,9 +62,9 @@ public class GetUpcomingEndpoint : Endpoint().ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { - ThrowError(ex.Message, statusCode: 500); + ThrowError("예정 신고 조회 실패", statusCode: 500); } } } @@ -88,9 +88,9 @@ public class GetByClientIdEndpoint : Endpoint().ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { - ThrowError(ex.Message, statusCode: 500); + ThrowError("고객별 신고 조회 실패", statusCode: 500); } } } @@ -116,9 +116,9 @@ public class GetByIdEndpoint : Endpoint ThrowError("신고 일정을 찾을 수 없습니다.", statusCode: 404); 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 await _service.DeleteAsync(id); await SendNoContentAsync(ct); } - catch (Exception ex) + catch { - ThrowError(ex.Message); + ThrowError("신고 삭제 실패"); } } } diff --git a/src/TaxBaik.Web/Endpoints/TaxFilingSchedule/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/TaxFilingSchedule/AllEndpoints.cs index 9c3c916..eb49eeb 100644 --- a/src/TaxBaik.Web/Endpoints/TaxFilingSchedule/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/TaxFilingSchedule/AllEndpoints.cs @@ -31,6 +31,8 @@ public class CreateEndpoint : Endpoint 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); await SendAsync(new IdResponse { Id = id }, 201, cancellation: ct); } diff --git a/src/TaxBaik.Web/Endpoints/TaxProfile/AllEndpoints.cs b/src/TaxBaik.Web/Endpoints/TaxProfile/AllEndpoints.cs index f517eb9..8682273 100644 --- a/src/TaxBaik.Web/Endpoints/TaxProfile/AllEndpoints.cs +++ b/src/TaxBaik.Web/Endpoints/TaxProfile/AllEndpoints.cs @@ -86,9 +86,9 @@ public class GetAllEndpoint : Endpoint var profiles = await _service.GetAllAsync(); await SendAsync(new TaxProfileListResponse { Data = profiles.Cast().ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { - ThrowError(ex.Message, statusCode: 500); + ThrowError("세무 프로필 조회 실패", statusCode: 500); } } } @@ -114,9 +114,9 @@ public class GetByClientIdEndpoint : Endpoint ThrowError("세무 프로필을 찾을 수 없습니다.", statusCode: 404); 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().ToList() }, 200, cancellation: ct); } - catch (Exception ex) + catch { - ThrowError(ex.Message, statusCode: 500); + ThrowError("고위험 세무 프로필 조회 실패", statusCode: 500); } } } @@ -164,9 +164,9 @@ public class GetUpcomingFilingsEndpoint : Endpoint var profiles = await _service.GetUpcomingFilingDuesAsync(request.DaysAhead); 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("id"); try { + if (request.TaxRiskLevel is null) + request.TaxRiskLevel = "normal"; await _service.UpdateAsync(id, request.BusinessType, request.AccountingMethod, request.NextFilingDueDate, request.TaxRiskLevel); await SendAsync(new TaxProfileUpdateResponse { Message = "세무 프로필이 수정되었습니다." }, 200, cancellation: ct); @@ -195,9 +197,9 @@ public class UpdateEndpoint : Endpoint() .AddInteractiveWebAssemblyRenderMode() - .AddAdditionalAssemblies(typeof(TaxBaik.WasmClient._Imports).Assembly) .AllowAnonymous(); // SPA 라우팅 폴백 (가장 마지막에!)