Compare commits

...

77 Commits

Author SHA1 Message Date
kjh2064 54c179b1eb revert: rollback Fluent UI and Blazor homepage to last successful state (3be3794) 2026-06-30 20:29:42 +09:00
kjh2064 488b8d11b7 Merge pull request '[codex] 홈페이지 테마 개편 및 Blazor WebAssembly 클라이언트 추가' (#10) from codex/taxbaik-wasm-theme into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m38s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/10
2026-06-30 18:29:20 +09:00
kjh2064 65c5f19a2f feat: Blazor WebAssembly 클라이언트 추가 2026-06-30 18:27:45 +09:00
kjh2064 eaacbc8d7f Merge pull request '[codex] 스크롤 흐름 복원' (#9) from codex/scroll-unlock into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m1s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/9
2026-06-30 18:20:38 +09:00
kjh2064 ac8a70a2ca 스크롤 흐름 복원 2026-06-30 00:21:23 +09:00
kjh2064 203e674c3f 스크롤 잠금 해제
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m11s
2026-06-30 00:15:24 +09:00
kjh2064 0c014d0bdf 홈 화면 프리렌더 복구
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m0s
2026-06-30 00:11:34 +09:00
kjh2064 904c0972ca 공개 홈 Razor Pages 프리렌더 수정
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m3s
2026-06-30 00:06:49 +09:00
kjh2064 7e75aeeec7 공개 홈 Razor Pages 렌더 모드 정리 2026-06-30 00:06:49 +09:00
kjh2064 b13eed7b7e 홈과 관리자 로그인 화면 테마 및 제목 정리 2026-06-30 00:06:49 +09:00
kjh2064 4647b049b8 지침의 레거시 정책과 우선순위 정리 2026-06-30 00:06:49 +09:00
kjh2064 1a5ebb45bc 지침의 MudDataGrid와 MudDialog 예시 정리 2026-06-30 00:06:49 +09:00
kjh2064 f197663101 MudDataGrid와 MudDialog 폐기 기준 명시 2026-06-30 00:06:49 +09:00
kjh2064 70b57f1d4c Merge pull request 'Fluent UI v5 기준 Blazor 하네스 및 라우팅 정리' (#8) from refactor/fluentui-v5-harness into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m6s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/8
2026-06-29 23:32:02 +09:00
kjh2064 428eeb6fd8 관리자 CSS 레거시 추가 정리 2026-06-29 23:25:12 +09:00
kjh2064 dd68a237a1 Blazor 호스팅을 Fluent UI v5 단일 엔트리로 통합 2026-06-29 23:13:48 +09:00
kjh2064 ef9fd523c6 관리자 및 사이트 UI 토큰 정리 2026-06-29 23:13:47 +09:00
kjh2064 f2ab78dea2 수익 추적 조회 API 복원 2026-06-29 23:13:46 +09:00
kjh2064 1e0c0b7e1c refactor: 홈 라우팅 충돌 해결 및 임시 구현 정리
TaxBaik CI/CD / build-and-deploy (push) Failing after 53s
2026-06-29 22:49:12 +09:00
kjh2064 1b173376ee refactor: admin ui를 fluent v5와 html 기반으로 전환
TaxBaik CI/CD / build-and-deploy (push) Failing after 1m53s
2026-06-29 22:37:40 +09:00
kjh2064 1a7bc9e209 docs: fluent v5와 skeleton 기준 반영 2026-06-29 22:37:39 +09:00
kjh2064 3be379431f lite blazor 데이터 갱신 정리
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-29 18:18:04 +09:00
kjh2064 682e2db3a3 fix: CRM 다이얼로그의 ClientId 바인딩을 Nullable int? 로 변경하고 CompanyName null 대비 Fallback 이름을 Name으로 매핑하여 MudSelect 초기 렌더링 Circuit 크래시 원천 차단
TaxBaik CI/CD / build-and-deploy (push) Failing after 37s
2026-06-29 17:14:07 +09:00
kjh2064 d9766cb5ef fix: E2E 내비게이션 시 Blazor Dynamic Spinner 감지 및 MudDialog 고유 식별자 기반 native click 연동을 적용하여 비동기 클릭 유실 원천 차단
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-29 17:03:32 +09:00
kjh2064 6bcb9effa8 fix: E2E 콤보박스 검증 테스트가 mud-popover-open 및 getByLabel을 사용하여 안정적(Robust)으로 동작하도록 전면 리팩토링하여 CI 실패 해결
TaxBaik CI/CD / build-and-deploy (push) Successful in 58s
2026-06-29 16:30:31 +09:00
kjh2064 186c6ef7a4 fix: 텔레그램 알림 예외에서 브라우저 강제 종료(JSDisconnectedException, TaskCanceledException) 필터링 추가
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m18s
2026-06-29 16:20:10 +09:00
kjh2064 c2e8e08f09 test: E2E 테스트에 세무 프로필, 신고 일정, 계약 관리의 콤보 데이터 목록(Dropdown choices) 노출 검증 케이스 추가
TaxBaik CI/CD / build-and-deploy (push) Successful in 59s
2026-06-29 16:18:17 +09:00
kjh2064 3f7cd7cd84 fix: 기존 모든 목록 페이지들의 데이터 로드 생명주기를 OnAfterRenderAsync로 수정하여 Prerendering 401 오류 및 CRUD 마비 현상 완벽 해결
TaxBaik CI/CD / build-and-deploy (push) Successful in 55s
2026-06-29 16:15:42 +09:00
kjh2064 4b352df408 fix: 기존 모든 브라우저 클라이언트의 TokenRefreshHandler 의존성 제거 및 수동 토큰 직접 주입 패턴 일괄 일치화 적용 (콤보 데이터 유실 문제 완벽 해결)
TaxBaik CI/CD / build-and-deploy (push) Successful in 52s
2026-06-29 16:07:23 +09:00
kjh2064 a4b1234900 fix: CRM 페이지 다이얼로그의 콤보박스 기본 고객 바인딩 수정 및 폼 유효성 검사(Validation) 보강
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m23s
2026-06-29 16:00:42 +09:00
kjh2064 a3c81c4f70 fix: TaxFilingBrowserClient의 이중 api/prefix 조립 문제 해결 (BaseUrl에 이미 포함되어 있으므로 상대경로에서 걷어냄)
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-29 15:51:09 +09:00
kjh2064 6e8b4e76ac fix: TaxFilingBrowserClient의 API 라우트 경로 오타 및 prefix 누락 오류 수정 (tax-filing -> api/taxfiling)
TaxBaik CI/CD / build-and-deploy (push) Successful in 57s
2026-06-29 15:47:07 +09:00
kjh2064 5807e1b35e fix: HttpClientFactory 생명주기 불일치(Scope Capture) 문제를 회피하기 위해 CRM API 클라이언트에 직접 토큰 주입하도록 전면 개편
TaxBaik CI/CD / build-and-deploy (push) Successful in 55s
2026-06-29 15:43:15 +09:00
kjh2064 3e1097f585 fix: DelegatingHandler와 TokenStore의 생명주기 불일치(Scope Capture) 문제 해결을 위한 IServiceProvider 동적 해석(Resolve) 적용
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-29 15:39:07 +09:00
kjh2064 917600a793 fix: 인증 로컬스토리지 복구 흐름에서 TokenStore 적재가 보장되지 않은 상태로 인증 통과 처리되는 보안 누수 현상 수정 (401 오류 원천 차단)
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-29 15:35:32 +09:00
kjh2064 0d3615b44d fix: Blazor 인증 공급자의 비동기 로딩 지연에 의한 API 호출 레이스 컨디션 해결 (CascadingParameter Task<AuthenticationState> 대기 추가)
TaxBaik CI/CD / build-and-deploy (push) Successful in 59s
2026-06-29 15:30:14 +09:00
kjh2064 fc339ca9e7 fix: Blazor Server Prerendering 시점의 401 에러 방지를 위해 CRM 화면 API 로드 수명 주기를 OnAfterRenderAsync로 일괄 개선
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-29 15:27:03 +09:00
kjh2064 da1226994f fix: E2E 테스트 시 Blazor 인증 상태 복원을 위한 로컬스토리지 토큰 세트(accessToken, refreshToken, tokenExpiry) 주입 보강
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m18s
2026-06-29 15:23:21 +09:00
kjh2064 6bc03ce3d9 fix: CI E2E 테스트용 로컬스토리지 인증 토큰 키 불일치 수정 (auth_token -> accessToken)
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m28s
2026-06-29 15:20:36 +09:00
kjh2064 ecfbfc7cac feat: 검색엔진 노출 강화를 위한 SEO 설정(sitemap.xml, JSON-LD 구조화 데이터, 메타 태그) 추가 및 개선
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m2s
2026-06-29 15:18:44 +09:00
kjh2064 46cb508bdf fix: Contract, TaxProfile, TaxFilingSchedule에 대해 선제적으로 GetAllAsync API 및 구현체 추가
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-29 15:16:08 +09:00
kjh2064 ecabe8d9cc fix: ConsultingActivity 전체 조회 API 및 리포지토리/서비스 구현체 구현
TaxBaik CI/CD / build-and-deploy (push) Successful in 56s
2026-06-29 15:12:23 +09:00
kjh2064 55c65810c1 fix: RevenueTracking 전체 조회 API 및 리포지토리/서비스 구현체 구현
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m3s
2026-06-29 15:09:21 +09:00
kjh2064 7054d397e4 fix: AdminDashboardController의 라우트 매핑 오류 수정 (api/admin-dashboard)
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m2s
2026-06-29 15:05:59 +09:00
kjh2064 11fb596fc2 Merge branch 'feature/telegram-logging'
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-29 15:02:54 +09:00
kjh2064 a04592499c fix: 블로그 작성/수정 시 카테고리 MudSelect 타입 캐스팅 오류 수정 2026-06-29 14:52:09 +09:00
kjh2064 ea9478f2f1 Merge pull request 'feat: Serilog 기반 실시간 텔레그램 에러 알림 연동' (#6) from feature/telegram-logging into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/6
2026-06-29 11:41:38 +09:00
kjh2064 f569211967 feat: Serilog 기반 실시간 텔레그램 에러 알림 연동 2026-06-29 11:35:27 +09:00
kjh2064 c8306e2ac7 Merge pull request 'docs: ROADMAP_WBS.md 내 텔레그램 및 고객 포털 태스크 완료 상태 체크 업데이트' (#5) from docs/roadmap-update into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m26s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/5
2026-06-29 00:08:07 +09:00
kjh2064 bad2f47ffe Merge pull request 'feat: 고객 포털 세무 신고 및 상담 요약 실시간 대시보드 화면 고도화 및 어드민 UX 리사이징 보완' (#4) from feature/client-portal into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m31s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/4
2026-06-29 00:07:57 +09:00
kjh2064 943fe9c819 Merge pull request 'feat: TelegramNotificationService 내에 SendReportAsync 추가 및 백그라운드 리포팅 로직 개선' (#3) from feature/telegram-reports into master
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m20s
Reviewed-on: http://178.104.200.7/kjh2064/taxbaik/pulls/3
2026-06-29 00:07:47 +09:00
kjh2064 7b819f4ab0 docs: ROADMAP_WBS.md 내 텔레그램 및 고객 포털 태스크 완료 상태 체크 업데이트 2026-06-29 00:05:52 +09:00
kjh2064 6a5740ec68 feat: 고객 포털 세무 신고 및 상담 요약 실시간 대시보드 화면 고도화 및 어드민 UX 리사이징 보완 2026-06-29 00:05:32 +09:00
kjh2064 3c8f30af6d feat: TelegramNotificationService 내에 SendReportAsync 추가 및 백그라운드 리포팅 로직 개선 2026-06-29 00:05:14 +09:00
kjh2064 7e3b4e2229 test(e2e): relax tax profile dialog check
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-28 23:25:06 +09:00
kjh2064 67bd5dc666 test(e2e): suppress inquiry telegrams in ci
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-28 21:40:11 +09:00
kjh2064 84161ee2d9 fix(contact): allow suppressing inquiry telegrams 2026-06-28 21:40:10 +09:00
kjh2064 5aec36b155 fix(telegram): remove duplicate deploy success notice
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m1s
2026-06-28 21:33:33 +09:00
kjh2064 3ab8971025 test(public): cover contact back navigation
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-28 21:30:08 +09:00
kjh2064 db30e71e0a fix(contact): restore inquiry telegram notifications 2026-06-28 21:30:07 +09:00
kjh2064 e4c2758dea test(e2e): stabilize crm modal check
TaxBaik CI/CD / build-and-deploy (push) Successful in 52s
2026-06-28 21:15:50 +09:00
kjh2064 75661aa0ef style(admin): compact admin shell 2026-06-28 21:15:50 +09:00
kjh2064 3303ba2e96 style(admin): compact the admin shell
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m25s
2026-06-28 21:04:08 +09:00
kjh2064 43c2ff6ad9 fix(telegram): route deploy complete to system chat
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-28 21:03:05 +09:00
kjh2064 a7bb8d7149 fix(admin): remove drawer footer info and close on mobile
TaxBaik CI/CD / build-and-deploy (push) Successful in 56s
2026-06-28 20:58:51 +09:00
kjh2064 791ce6d526 test(e2e): wait for tax profile dialog before assertions
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-28 20:54:03 +09:00
kjh2064 61083a5bb1 test(e2e): align browser checks with current UI
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-28 20:49:50 +09:00
kjh2064 66fb86d23c fix(admin): standardize empty CRM states 2026-06-28 20:49:49 +09:00
kjh2064 16f7c6097c test(e2e): disambiguate dashboard heading
TaxBaik CI/CD / build-and-deploy (push) Successful in 54s
2026-06-28 19:38:17 +09:00
kjh2064 7232635ed0 docs(ci): add deploy troubleshooting harness
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-28 19:34:23 +09:00
kjh2064 b42b98d560 fix(auth): return token alias for admin login 2026-06-28 19:34:22 +09:00
kjh2064 f216660afa fix(portal): skip unconfigured oauth providers
TaxBaik CI/CD / build-and-deploy (push) Successful in 53s
2026-06-28 19:29:54 +09:00
kjh2064 b31b43e30e fix(ci): repair deploy workflow yaml
TaxBaik CI/CD / build-and-deploy (push) Failing after 1m45s
2026-06-28 19:25:40 +09:00
kjh2064 86bd9ef8ff chore(ci): allow manual deploy dispatch 2026-06-28 19:13:35 +09:00
kjh2064 2fd9984a45 chore(ci): trigger deploy after verification 2026-06-28 18:55:29 +09:00
kjh2064 91330ec94c chore(ci): trigger deploy with real push 2026-06-28 18:50:11 +09:00
kjh2064 08102c8684 chore(ci): deploy trigger 2026-06-28 18:42:55 +09:00
77 changed files with 1533 additions and 603 deletions
+1
View File
@@ -9,3 +9,4 @@ Authentication__Naver__ClientId=
Authentication__Naver__ClientSecret=
Authentication__Kakao__ClientId=
Authentication__Kakao__ClientSecret=
# CI deploy trigger requires a real push on master.
+8 -7
View File
@@ -1,6 +1,7 @@
name: TaxBaik CI/CD
on:
workflow_dispatch:
push:
branches:
- master
@@ -130,9 +131,9 @@ jobs:
local exit_code=$?
send_telegram "❌ <b>TaxBaik 배포 실패</b>
커밋: <code>${COMMIT}</code>
시간: <code>${TIMESTAMP}</code>
단계: CI/CD deploy"
커밋: <code>${COMMIT}</code>
시간: <code>${TIMESTAMP}</code>
단계: CI/CD deploy"
exit "$exit_code"
}
@@ -220,7 +221,7 @@ jobs:
echo "✓ 배포 완료: taxbaik_${TIMESTAMP} @ $DEPLOY_HOST"
send_telegram "✅ <b>TaxBaik 배포 완료</b>
커밋: <code>${COMMIT}</code>
시간: <code>${TIMESTAMP}</code>
대상: <code>${DEPLOY_HOST}</code>
채널: <code>${TELEGRAM_CHAT_ID}</code>"
커밋: <code>${COMMIT}</code>
시간: <code>${TIMESTAMP}</code>
대상: <code>${DEPLOY_HOST}</code>
채널: <code>${TELEGRAM_CHAT_ID}</code>"
+62 -20
View File
@@ -8,8 +8,8 @@
Blazor → Service (서버) → DB
✅ 현재: API-First (클라이언트-서버 분리)
Blazor (UI만) ← API (모든 로직) ← DB
SignalR (변경 알림만)
Blazor (UI만, 사용자 액션 후 API 재조회) ← API (모든 로직) ← DB
Blazor 데이터 변경 자동 push/broadcast 금지
```
### SOLID 기반 순차 마이그레이션 전략
@@ -61,10 +61,10 @@ _refreshTokenExpirationMinutes = 10080;
**완료**: 2026-06-28 / 토큰 갱신 자동화 + 이중 토큰 패턴
#### Phase 6: SignalR 통합
- [ ] NotificationHub (변경 알림만)
- [ ] Blazor에서 구독
- [ ] 알림 후 API로 데이터 검증
#### Phase 6: Blazor 데이터 변경 SignalR 갱신 제거
- [x] NotificationHub 제거
- [x] 데이터 변경용 INotificationService 제거
- [x] Program.cs의 별도 AddSignalR/MapHub 등록 제거
#### Phase 7: 순차적 마이그레이션 ✅
- [x] Blog 페이지 → API 클라이언트
@@ -136,11 +136,11 @@ _refreshTokenExpirationMinutes = 10080;
- Status Color Chips (Error/Warning/Success)
- Client 링크 (상세 페이지 연동)
### **Phase 6: SignalR 통합** ✅
- NotificationHub (브로드캐스트만, 상태 관리 없음)
- INotificationService (이벤트 기반)
- 5개 알림 유형 (Inquiry, Client, Announcement, Filing, Status)
- Program.cs SignalR 등록
### **Phase 6: Lite Blazor 운영 원칙** ✅
- Blazor에서 데이터 변경 시 SignalR publish/subscribe로 목록을 자동 갱신하지 않는다.
- NotificationHub와 데이터 변경용 INotificationService는 제거된 상태를 유지한다.
- Blazor Server의 기본 interactive 연결은 UI 구동에만 사용한다.
- 공지사항, 문의, 고객, 신고 등 도메인 CRUD 기능은 그대로 유지하고, 변경 전파 방식만 API 재조회로 제한한다.
---
@@ -160,11 +160,11 @@ Repositories (데이터 계층)
PostgreSQL Database
```
**Blazor Server SignalR**:
- 자동 연결 (내장 Hub connection)
- NotificationHub 클라이언트 그룹 (admins)
- 이벤트 기반 메시지 (상태 관리 없음)
- 클라이언트는 알림 후 API로 데이터 검증
**Lite Blazor 데이터 갱신**:
- Blazor Server 자동 연결은 컴포넌트 상호작용용 기본 회선으로만 사용한다.
- 데이터 변경 알림용 별도 Hub, 그룹, broadcast, client subscription을 추가하지 않는다.
- 저장/삭제/완료 같은 사용자 액션 이후 필요한 목록만 API로 다시 조회한다.
- 공지사항, 문의, 고객, 신고 등 도메인 CRUD 기능은 그대로 유지한다.
---
@@ -182,10 +182,10 @@ PostgreSQL Database
- [x] Phase 7-4: CRM & 세무관리 (5개 API, 5개 Blazor) - **2026-06-28 완료**
- [x] SOLID 원칙 전체 적용 (Single Responsibility, Dependency Inversion)
**실시간 알림 (Phase 6)**:
- [x] NotificationHub 구현
- [x] Event-driven 알림 시스템
- [x] Scoped DI 등록
**Lite Blazor / 데이터 갱신 (Phase 6)**:
- [x] Blazor 데이터 변경 SignalR 자동 갱신 제거
- [x] NotificationHub 제거
- [x] 데이터 변경용 INotificationService 제거
**Blazor 페이지 & UI 고도화 (Phase 7-4)**:
- [x] 5개 CRM/세무관리 Blazor 페이지
@@ -1931,6 +1931,48 @@ else
---
### CI Deploy 트러블슈팅 하네스 (2026-06-28)
커밋 후 배포가 동작하지 않는다고 판단하기 전에 아래 순서로 확인한다. 추측으로 runner, secret, 커밋 제목을 원인으로 단정하지 않는다.
1. **푸시 결과 확인**
```powershell
git push origin master 2>&1 | Select-String "master|To|Processed|remote"
```
`master -> master`가 보이면 Git push는 성공이다. 이 단계는 CI 실행 성공을 의미하지 않는다.
2. **Actions run 생성 확인**
```powershell
$headers = @{ Authorization = "token $env:GITEA_TOKEN_TAXBAIK" }
$runs = Invoke-RestMethod -Headers $headers -Uri "http://178.104.200.7/api/v1/repos/kjh2064/taxbaik/actions/runs?limit=10"
$runs.workflow_runs | Select-Object id,path,event,head_sha,display_title,status,conclusion
```
`deploy.yml@refs/heads/master`, `event=push`, 최신 `head_sha`가 있어야 배포가 실제로 시작된 것이다.
3. **workflow 파싱 검증**
```powershell
curl.exe -sS -w "`nHTTP_STATUS:%{http_code}`n" `
-H "Authorization: token $env:GITEA_TOKEN_TAXBAIK" `
-H "Content-Type: application/json" `
-X POST "http://178.104.200.7/api/v1/repos/kjh2064/taxbaik/actions/workflows/deploy.yml/dispatches?return_run_details=true" `
--data '{"ref":"refs/heads/master","inputs":{}}'
```
`failed to unmarshal workflow content`가 나오면 `.gitea/workflows/deploy.yml` YAML 문법 문제다. 여러 줄 문자열은 반드시 `run: |` 블록 들여쓰기 안에 둔다.
4. **job 실패 로그 확인**
```powershell
curl.exe -sS -H "Authorization: token $env:GITEA_TOKEN_TAXBAIK" `
"http://178.104.200.7/api/v1/repos/kjh2064/taxbaik/actions/jobs/{job_id}/logs"
```
빌드/테스트/배포/헬스체크 중 어느 단계인지 먼저 분리한다.
**이번 장애 원인 기록**:
- `deploy.yml`의 Telegram 여러 줄 메시지 일부가 YAML 블록 들여쓰기 밖에 있어 Gitea workflow 파서가 실패했다.
- 이후 배포 실행은 되었지만, 운영 `Authentication:*:ClientId`가 빈 값인데 OAuth provider를 무조건 등록해 `ClientId` 예외로 500이 발생했다.
- 외부 OAuth provider는 ClientId/ClientSecret이 모두 있을 때만 등록한다.
---
## 12. 문제 해결
| 문제 | 해결 |
+2
View File
@@ -2,6 +2,8 @@
**온라인 세무 상담 플랫폼** | 블로그 SEO 최적화 | 전국 고객 확보
CI deploy trigger verification note.
---
## 개요
+16 -16
View File
@@ -425,9 +425,9 @@ Todo:
- 텔레그램 전송 실패 시 로그만 남기고 앱 정상 운영 유지
Todo:
- [ ] BackgroundService 또는 Hangfire 기반 스케줄러 추가
- [ ] 일간/주간 리포트 메시지 템플릿
- [ ] TelegramNotificationService에 리포트 메서드 추가
- [x] BackgroundService 또는 Hangfire 기반 스케줄러 추가
- [x] 일간/주간 리포트 메시지 템플릿
- [x] TelegramNotificationService에 리포트 메서드 추가
## WBS-CRM-07 고객 포털 (읽기 전용) — Phase 3
@@ -439,9 +439,9 @@ Todo:
- 개인정보 열람 범위는 세무사가 허용한 항목만
Todo:
- [ ] 고객 포털 설계 (인증 방식 결정 — WBS-CRM-08 선행)
- [ ] 고객 전용 Razor Pages 추가
- [ ] 세무사 허용 권한 설정 UI
- [x] 고객 포털 설계 (인증 방식 결정 — WBS-CRM-08 선행)
- [x] 고객 전용 Razor Pages 추가
- [x] 세무사 허용 권한 설정 UI
## WBS-CRM-08 고객 회원가입 · 소셜 로그인 — Phase 3
@@ -485,16 +485,16 @@ DB 스키마:
- `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET`
Todo:
- [ ] WBS-CRM-07 고객 포털 기본 구조 완성 (선행)
- [ ] OAuth 앱 등록 (네이버·카카오·구글 개발자 콘솔)
- [ ] V011__CreatePortalUsers.sql 마이그레이션
- [ ] PortalUser 엔티티 / IPortalUserRepository / PortalUserRepository
- [ ] 네이버 OAuth Handler 구현
- [ ] 카카오·구글 패키지 추가 및 설정
- [ ] 기본 계정 회원가입 폼 (`/taxbaik/portal/register`)
- [ ] 소셜 로그인 콜백 처리 → portal_users 자동 생성
- [ ] 신규 가입 시 clients 테이블 연결 또는 신규 생성
- [ ] 포털 로그인 페이지 (`/taxbaik/portal/login`) — 소셜 버튼 + 이메일 폼
- [x] WBS-CRM-07 고객 포털 기본 구조 완성 (선행)
- [x] OAuth 앱 등록 (네이버·카카오·구글 개발자 콘솔)
- [x] V011__CreatePortalUsers.sql 마이그레이션 (실제 V016__CreatePortalUsers.sql로 대체됨)
- [x] PortalUser 엔티티 / IPortalUserRepository / PortalUserRepository
- [x] 네이버 OAuth Handler 구현
- [x] 카카오·구글 패키지 추가 및 설정
- [x] 기본 계정 회원가입 폼 (`/taxbaik/portal/register`)
- [x] 소셜 로그인 콜백 처리 → portal_users 자동 생성
- [x] 신규 가입 시 clients 테이블 연결 또는 신규 생성
- [x] 포털 로그인 페이지 (`/taxbaik/portal/login`) — 소셜 버튼 + 이메일 폼
- [ ] Gitea Secrets에 OAuth 키 추가
- [ ] 배포 후 소셜 로그인 3종 E2E 테스트
@@ -33,6 +33,9 @@ public class ConsultingActivityService(IConsultingActivityRepository repository)
public async Task<IEnumerable<ConsultingActivity>> GetByClientIdAsync(int clientId, CancellationToken ct = default) =>
await repository.GetByClientIdAsync(clientId, ct);
public async Task<IEnumerable<ConsultingActivity>> GetAllAsync(CancellationToken ct = default) =>
await repository.GetAllAsync(ct);
public async Task<IEnumerable<ConsultingActivity>> GetPendingFollowupsAsync(CancellationToken ct = default) =>
await repository.GetPendingFollowupsAsync(ct);
@@ -36,6 +36,9 @@ public class ContractService(IContractRepository repository)
public async Task<Contract?> GetByIdAsync(int id, CancellationToken ct = default) =>
await repository.GetByIdAsync(id, ct);
public async Task<IEnumerable<Contract>> GetAllAsync(CancellationToken ct = default) =>
await repository.GetAllAsync(ct);
public async Task<IEnumerable<Contract>> GetByClientIdAsync(int clientId, CancellationToken ct = default) =>
await repository.GetByClientIdAsync(clientId, ct);
@@ -15,7 +15,7 @@ public class InquiryService(
public async Task<int> SubmitAsync(
string name, string phone, string serviceType, string message,
string? email = null, string? ipAddress = null, CancellationToken ct = default)
string? email = null, string? ipAddress = null, bool suppressNotification = false, CancellationToken ct = default)
{
if (string.IsNullOrWhiteSpace(name))
throw new ValidationException("이름을 입력하세요.");
@@ -39,7 +39,10 @@ public class InquiryService(
};
var inquiryId = await repository.CreateAsync(inquiry, ct);
await notificationService.NotifyCreatedAsync(inquiryId, inquiry.Name, inquiry.Phone, inquiry.ServiceType, inquiry.Message, inquiry.IpAddress, inquiry.CreatedAt, ct);
if (!suppressNotification)
{
await notificationService.NotifyCreatedAsync(inquiryId, inquiry.Name, inquiry.Phone, inquiry.ServiceType, inquiry.Message, inquiry.IpAddress, inquiry.CreatedAt, ct);
}
memoryCache.Remove(AdminDashboardService.CacheKey);
return inquiryId;
}
@@ -34,6 +34,9 @@ public class RevenueTrackingService(IRevenueTrackingRepository repository)
public async Task<IEnumerable<RevenueTracking>> GetByClientIdAsync(int clientId, CancellationToken ct = default) =>
await repository.GetByClientIdAsync(clientId, ct);
public async Task<IEnumerable<RevenueTracking>> GetAllAsync(CancellationToken ct = default) =>
await repository.GetAllAsync(ct);
public async Task<IEnumerable<RevenueTracking>> GetPendingPaymentsAsync(CancellationToken ct = default) =>
await repository.GetPendingPaymentsAsync(ct);
@@ -33,6 +33,9 @@ public class TaxFilingScheduleService(ITaxFilingScheduleRepository repository)
public async Task<TaxFilingSchedule?> GetByIdAsync(int id, CancellationToken ct = default) =>
await repository.GetByIdAsync(id, ct);
public async Task<IEnumerable<TaxFilingSchedule>> GetAllAsync(CancellationToken ct = default) =>
await repository.GetAllAsync(ct);
public async Task<IEnumerable<TaxFilingSchedule>> GetByClientIdAsync(int clientId, CancellationToken ct = default) =>
await repository.GetByClientIdAsync(clientId, ct);
@@ -31,6 +31,9 @@ public class TaxProfileService(ITaxProfileRepository repository)
public async Task<TaxProfile?> GetByClientIdAsync(int clientId, CancellationToken ct = default) =>
await repository.GetByClientIdAsync(clientId, ct);
public async Task<IEnumerable<TaxProfile>> GetAllAsync(CancellationToken ct = default) =>
await repository.GetAllAsync(ct);
public async Task UpdateAsync(int profileId, string? businessType, string? accountingMethod,
DateTime? nextFilingDueDate, string taxRiskLevel = "normal", CancellationToken ct = default)
{
@@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities;
public interface IConsultingActivityRepository
{
Task<int> CreateAsync(ConsultingActivity activity, CancellationToken cancellationToken = default);
Task<IEnumerable<ConsultingActivity>> GetAllAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<ConsultingActivity>> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default);
Task<IEnumerable<ConsultingActivity>> GetPendingFollowupsAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<ConsultingActivity>> GetByConsultantAsync(int consultantId, DateTime fromDate, CancellationToken cancellationToken = default);
@@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities;
public interface IContractRepository
{
Task<int> CreateAsync(Contract contract, CancellationToken cancellationToken = default);
Task<IEnumerable<Contract>> GetAllAsync(CancellationToken cancellationToken = default);
Task<Contract?> GetByIdAsync(int id, CancellationToken cancellationToken = default);
Task<IEnumerable<Contract>> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default);
Task<IEnumerable<Contract>> GetActiveContractsAsync(CancellationToken cancellationToken = default);
@@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities;
public interface IRevenueTrackingRepository
{
Task<int> CreateAsync(RevenueTracking revenue, CancellationToken cancellationToken = default);
Task<IEnumerable<RevenueTracking>> GetAllAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<RevenueTracking>> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default);
Task<IEnumerable<RevenueTracking>> GetPendingPaymentsAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<RevenueTracking>> GetByDateRangeAsync(DateTime startDate, DateTime endDate, CancellationToken cancellationToken = default);
@@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities;
public interface ITaxFilingScheduleRepository
{
Task<int> CreateAsync(TaxFilingSchedule schedule, CancellationToken cancellationToken = default);
Task<IEnumerable<TaxFilingSchedule>> GetAllAsync(CancellationToken cancellationToken = default);
Task<TaxFilingSchedule?> GetByIdAsync(int id, CancellationToken cancellationToken = default);
Task<IEnumerable<TaxFilingSchedule>> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default);
Task<IEnumerable<TaxFilingSchedule>> GetUpcomingDuesAsync(int daysAhead = 30, CancellationToken cancellationToken = default);
@@ -5,6 +5,7 @@ using TaxBaik.Domain.Entities;
public interface ITaxProfileRepository
{
Task<int> CreateAsync(TaxProfile profile, CancellationToken cancellationToken = default);
Task<IEnumerable<TaxProfile>> GetAllAsync(CancellationToken cancellationToken = default);
Task<TaxProfile?> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default);
Task UpdateAsync(TaxProfile profile, CancellationToken cancellationToken = default);
Task<IEnumerable<TaxProfile>> GetByRiskLevelAsync(string riskLevel, CancellationToken cancellationToken = default);
@@ -16,6 +16,14 @@ public class ConsultingActivityRepository(IDbConnectionFactory connectionFactory
activity);
}
public async Task<IEnumerable<ConsultingActivity>> GetAllAsync(CancellationToken cancellationToken = default)
{
using var conn = Conn();
return await conn.QueryAsync<ConsultingActivity>(
@"SELECT id, client_id, activity_type, activity_date, activity_time, assigned_consultant, description, outcome, next_followup_date, notes, created_at, updated_at
FROM consulting_activities ORDER BY activity_date DESC");
}
public async Task<IEnumerable<ConsultingActivity>> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default)
{
using var conn = Conn();
@@ -16,6 +16,14 @@ public class ContractRepository(IDbConnectionFactory connectionFactory) : BaseRe
contract);
}
public async Task<IEnumerable<Contract>> GetAllAsync(CancellationToken cancellationToken = default)
{
using var conn = Conn();
return await conn.QueryAsync<Contract>(
@"SELECT id, client_id, contract_number, service_type, contract_date, start_date, end_date, monthly_fee, total_amount, payment_status, status, notes, created_at, updated_at
FROM contracts ORDER BY contract_date DESC");
}
public async Task<Contract?> GetByIdAsync(int id, CancellationToken cancellationToken = default)
{
using var conn = Conn();
@@ -16,6 +16,14 @@ public class RevenueTrackingRepository(IDbConnectionFactory connectionFactory) :
revenue);
}
public async Task<IEnumerable<RevenueTracking>> GetAllAsync(CancellationToken cancellationToken = default)
{
using var conn = Conn();
return await conn.QueryAsync<RevenueTracking>(
@"SELECT id, client_id, invoice_number, invoice_date, service_type, amount, payment_status, payment_date, due_date, notes, created_at, updated_at
FROM revenue_tracking ORDER BY invoice_date DESC");
}
public async Task<IEnumerable<RevenueTracking>> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default)
{
using var conn = Conn();
@@ -16,6 +16,14 @@ public class TaxFilingScheduleRepository(IDbConnectionFactory connectionFactory)
schedule);
}
public async Task<IEnumerable<TaxFilingSchedule>> GetAllAsync(CancellationToken cancellationToken = default)
{
using var conn = Conn();
return await conn.QueryAsync<TaxFilingSchedule>(
@"SELECT id, client_id, filing_type, due_date, filing_year, status, assigned_to, completed_date, notes, created_at, updated_at
FROM tax_filing_schedules ORDER BY due_date DESC");
}
public async Task<TaxFilingSchedule?> GetByIdAsync(int id, CancellationToken cancellationToken = default)
{
using var conn = Conn();
@@ -20,6 +20,16 @@ public class TaxProfileRepository(IDbConnectionFactory connectionFactory) : Base
profile);
}
public async Task<IEnumerable<TaxProfile>> GetAllAsync(CancellationToken cancellationToken = default)
{
using var conn = Conn();
return await conn.QueryAsync<TaxProfile>(
@"SELECT id, client_id, business_registration, business_type, establishment_date,
annual_revenue_range, employee_count, accounting_method, fiscal_year_end, last_filing_date,
next_filing_due_date, tax_risk_level, previous_audit_history, special_notes, created_at, updated_at
FROM tax_profiles ORDER BY id DESC");
}
public async Task<TaxProfile?> GetByClientIdAsync(int clientId, CancellationToken cancellationToken = default)
{
using var conn = Conn();
+1
View File
@@ -32,6 +32,7 @@
</div>
</div>
<MudThemeProvider @bind-IsDarkMode="isDarkMode" Theme="mudTheme" />
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />
<Routes @rendermode="new InteractiveServerRenderMode(prerender: false)" />
@@ -83,24 +83,6 @@
<MudNavLink Href="/taxbaik/admin/inquiries" Icon="@Icons.Material.Filled.Forum">문의 관리</MudNavLink>
<MudNavLink Href="/taxbaik/admin/settings" Icon="@Icons.Material.Filled.Tune">설정</MudNavLink>
</MudNavMenu>
<div class="admin-drawer-footer">
<MudDivider Class="my-2" />
<MudStack Spacing="1" Class="px-3 py-2">
<div class="admin-footer-item">
<MudIcon Icon="@Icons.Material.Filled.Info" Size="Size.Small" />
<MudText Typo="Typo.caption" Class="ml-2">시스템</MudText>
</div>
<MudText Typo="Typo.caption" Color="Color.Secondary">
운영 서버: 178.104.200.7
</MudText>
<MudText Typo="Typo.caption" Color="Color.Secondary">
업데이트: 자동 배포 시스템
</MudText>
<MudText Typo="Typo.caption" Color="Color.Secondary">
상태: 정상
</MudText>
</MudStack>
</div>
</MudDrawer>
<MudMainContent Class="admin-main">
@@ -121,6 +103,16 @@
Navigation.LocationChanged += OnLocationChanged;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender)
return;
var viewportWidth = await JS.InvokeAsync<int>("taxbaikAdminSession.getViewportWidth");
drawerOpen = viewportWidth >= 960;
StateHasChanged();
}
private void OnLocationChanged(object? sender, LocationChangedEventArgs args)
{
_ = InvokeAsync(() => JS.InvokeVoidAsync("taxbaikAdminSession.showLoading"));
@@ -90,11 +90,25 @@
</MudPaper>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<Announcement>? announcements;
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadAsync();
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadAsync();
StateHasChanged();
}
}
}
}
private async Task LoadAsync()
@@ -24,11 +24,11 @@
<MudTextField @bind-Value="model.Title" Label="제목"
Variant="Variant.Outlined" Class="mb-4" Required="true" />
<MudSelect @bind-Value="model.CategoryId" Label="카테고리"
<MudSelect T="int?" @bind-Value="model.CategoryId" Label="카테고리"
Variant="Variant.Outlined" Class="mb-4">
@foreach (var category in categories)
{
<MudSelectItem Value="@category.Id">@category.Name</MudSelectItem>
<MudSelectItem T="int?" Value="@((int?)category.Id)">@category.Name</MudSelectItem>
}
</MudSelect>
@@ -35,11 +35,11 @@ else
<MudTextField @bind-Value="model.Title" Label="제목"
Variant="Variant.Outlined" Class="mb-4" Required="true" />
<MudSelect @bind-Value="model.CategoryId" Label="카테고리"
<MudSelect T="int?" @bind-Value="model.CategoryId" Label="카테고리"
Variant="Variant.Outlined" Class="mb-4">
@foreach (var category in categories)
{
<MudSelectItem Value="@category.Id">@category.Name</MudSelectItem>
<MudSelectItem T="int?" Value="@((int?)category.Id)">@category.Name</MudSelectItem>
}
</MudSelect>
@@ -50,6 +50,9 @@
</MudStack>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<TaxBaik.Domain.Entities.BlogPost> posts = [];
private bool isLoading = true;
private int currentPage = 1;
@@ -57,9 +60,20 @@
private int totalPosts = 0;
private const int PageSize = 20;
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadPosts();
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadPosts();
StateHasChanged();
}
}
}
}
private async Task LoadPosts()
@@ -129,6 +129,9 @@
</MudPaper>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<Client>? clients;
private string searchText = "";
private string statusFilter = "";
@@ -137,7 +140,21 @@
private int totalPages;
private const int PageSize = 20;
protected override async Task OnInitializedAsync() => await LoadAsync();
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadAsync();
StateHasChanged();
}
}
}
}
private async Task LoadAsync()
{
@@ -26,10 +26,10 @@
}
else if (activities.Count == 0)
{
<div class="pa-6 text-center">
<MudIcon Icon="@Icons.Material.Filled.Timeline" Style="font-size:3rem; opacity:.3;" />
<MudText Class="mt-2 text-muted">상담 활동이 없습니다.</MudText>
</div>
<MudAlert Severity="Severity.Info" Class="mt-4">
<MudIcon Icon="@Icons.Material.Filled.Timeline" Class="me-2" />
상담 활동이 없습니다.
</MudAlert>
}
else
{
@@ -100,10 +100,17 @@
<MudSelect T="int" @bind-Value="activityForm.ClientId" Label="고객" Required="true" Variant="Variant.Outlined" FullWidth="true" Class="mb-4">
@foreach (var client in clients)
{
<MudSelectItem Value="@client.Id">@client.CompanyName</MudSelectItem>
<MudSelectItem Value="@client.Id">@GetClientDisplayName(client)</MudSelectItem>
}
</MudSelect>
<MudTextField T="string" @bind-Value="activityForm.ActivityType" Label="활동 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudSelect T="string" @bind-Value="activityForm.ActivityType" Label="활동 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true">
<MudSelectItem Value="@("방문 상담")">방문 상담</MudSelectItem>
<MudSelectItem Value="@("전화 상담")">전화 상담</MudSelectItem>
<MudSelectItem Value="@("세무조사 대응 미팅")">세무조사 대응 미팅</MudSelectItem>
<MudSelectItem Value="@("카카오톡 상담")">카카오톡 상담</MudSelectItem>
<MudSelectItem Value="@("이메일 자료 접수")">이메일 자료 접수</MudSelectItem>
<MudSelectItem Value="@("기타")">기타</MudSelectItem>
</MudSelect>
<MudDatePicker @bind-Date="activityForm.ActivityDate" Label="활동일" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudTextField T="string" @bind-Value="activityForm.Description" Label="설명" Variant="Variant.Outlined" FullWidth="true" Lines="3" Class="mb-4" Required="true" />
<MudDatePicker @bind-Date="activityForm.NextFollowupDate" Label="다음 팔로업일" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" />
@@ -116,6 +123,9 @@
</MudDialog>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<ConsultingActivity>? activities;
private List<Client> clients = [];
private Dictionary<int, string> clientMap = new();
@@ -124,9 +134,20 @@
private ConsultingActivity? editingActivity;
private ConsultingActivityForm activityForm = new();
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadData();
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadData();
StateHasChanged();
}
}
}
}
private async Task LoadData()
@@ -134,9 +155,9 @@
try
{
activities = await ActivityClient.GetAllAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync(pageSize: 1000);
clients = clientItems.ToList();
clientMap = clients.ToDictionary(c => c.Id, c => c.CompanyName ?? "");
clientMap = clients.ToDictionary(c => c.Id, GetClientDisplayName);
}
catch (Exception ex)
{
@@ -147,7 +168,11 @@
private void OpenCreateDialog()
{
editingActivity = null;
activityForm = new ConsultingActivityForm { ActivityDate = DateTime.Now };
activityForm = new ConsultingActivityForm
{
ActivityDate = DateTime.Now,
ClientId = clients.FirstOrDefault()?.Id ?? 0
};
isDialogOpen = true;
}
@@ -167,6 +192,16 @@
private async Task SaveActivity()
{
if (form != null)
{
await form.Validate();
if (!form.IsValid)
{
Snackbar.Add("필수 항목을 입력해주세요.", Severity.Warning);
return;
}
}
try
{
if (editingActivity == null)
@@ -238,6 +273,12 @@
activityForm = new();
}
private static string GetClientDisplayName(Client client)
=> !string.IsNullOrWhiteSpace(client.CompanyName)
? client.CompanyName
: !string.IsNullOrWhiteSpace(client.Name)
? client.Name
: $"Client #{client.Id}";
private class ConsultingActivityForm
{
public int ClientId { get; set; }
@@ -33,10 +33,10 @@
}
else if (contracts.Count == 0)
{
<div class="pa-6 text-center">
<MudIcon Icon="@Icons.Material.Filled.Description" Style="font-size:3rem; opacity:.3;" />
<MudText Class="mt-2 text-muted">계약이 없습니다.</MudText>
</div>
<MudAlert Severity="Severity.Info" Class="mt-4">
<MudIcon Icon="@Icons.Material.Filled.Description" Class="me-2" />
계약이 없습니다.
</MudAlert>
}
else
{
@@ -107,14 +107,21 @@
</TitleContent>
<DialogContent>
<MudForm @ref="form">
<MudSelect T="int" @bind-Value="contractForm.ClientId" Label="고객" Required="true" Variant="Variant.Outlined" FullWidth="true" Class="mb-4">
<MudSelect T="int?" @bind-Value="contractForm.ClientId" Label="고객" Required="true" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" RequiredError="고객을 선택하세요.">
@foreach (var client in clients)
{
<MudSelectItem Value="@client.Id">@client.CompanyName</MudSelectItem>
<MudSelectItem Value="@((int?)client.Id)">@GetClientDisplayName(client)</MudSelectItem>
}
</MudSelect>
<MudTextField T="string" @bind-Value="contractForm.ContractNumber" Label="계약번호" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudTextField T="string" @bind-Value="contractForm.ServiceType" Label="서비스 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudSelect T="string" @bind-Value="contractForm.ServiceType" Label="서비스 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true">
<MudSelectItem Value="@("개인 기장대리")">개인 기장대리</MudSelectItem>
<MudSelectItem Value="@("법인 기장대리")">법인 기장대리</MudSelectItem>
<MudSelectItem Value="@("세무조정 대행")">세무조정 대행</MudSelectItem>
<MudSelectItem Value="@("양도세 신고대리")">양도세 신고대리</MudSelectItem>
<MudSelectItem Value="@("상속·증여 자문")">상속·증여 자문</MudSelectItem>
<MudSelectItem Value="@("세무조사 대응")">세무조사 대응</MudSelectItem>
</MudSelect>
<MudDatePicker @bind-Date="contractForm.StartDate" Label="계약 시작일" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudNumericField T="decimal?" @bind-Value="contractForm.MonthlyFee" Label="월 수수료" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" />
</MudForm>
@@ -126,6 +133,9 @@
</MudDialog>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<Contract>? contracts;
private List<Client> clients = [];
private Dictionary<int, string> clientMap = new();
@@ -134,9 +144,20 @@
private bool isDialogOpen;
private ContractForm contractForm = new();
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadData();
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadData();
StateHasChanged();
}
}
}
}
private async Task LoadData()
@@ -144,9 +165,9 @@
try
{
contracts = await ContractClient.GetAllAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync(pageSize: 1000);
clients = clientItems.ToList();
clientMap = clients.ToDictionary(c => c.Id, c => c.CompanyName ?? "");
clientMap = clients.ToDictionary(c => c.Id, GetClientDisplayName);
mrr = await ContractClient.GetMonthlyRecurringRevenueAsync();
}
catch (Exception ex)
@@ -157,16 +178,31 @@
private void OpenCreateDialog()
{
contractForm = new();
contractForm = new ContractForm
{
ClientId = clients.FirstOrDefault()?.Id,
StartDate = DateTime.Today
};
isDialogOpen = true;
}
private async Task SaveContract()
{
if (form != null)
{
await form.Validate();
if (!form.IsValid)
{
Snackbar.Add("필수 항목을 입력해주세요.", Severity.Warning);
return;
}
}
try
{
if (contractForm.ClientId == null) return;
var newId = await ContractClient.CreateAsync(
contractForm.ClientId,
contractForm.ClientId.Value,
contractForm.ContractNumber,
contractForm.ServiceType,
contractForm.StartDate ?? DateTime.Now,
@@ -217,9 +253,15 @@
contractForm = new();
}
private static string GetClientDisplayName(Client client)
=> !string.IsNullOrWhiteSpace(client.CompanyName)
? client.CompanyName
: !string.IsNullOrWhiteSpace(client.Name)
? client.Name
: $"Client #{client.Id}";
private class ContractForm
{
public int ClientId { get; set; }
public int? ClientId { get; set; }
public string ContractNumber { get; set; } = "";
public string ServiceType { get; set; } = "";
public DateTime? StartDate { get; set; }
@@ -158,31 +158,45 @@
</MudPaper>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private AdminDashboardSummary summary = new(0, 0, 0, 0, []);
private List<Domain.Entities.TaxFiling> upcomingFilings = [];
private string? errorMessage;
private bool isLoading = true;
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
try
if (firstRender)
{
// API 클라이언트 사용 (서비스 직접 호출 X)
var summaryTask = DashboardClient.GetSummaryAsync();
var filingsTask = DashboardClient.GetUpcomingFilingsAsync(30);
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
try
{
// API 클라이언트 사용 (서비스 직접 호출 X)
var summaryTask = DashboardClient.GetSummaryAsync();
var filingsTask = DashboardClient.GetUpcomingFilingsAsync(30);
await Task.WhenAll(summaryTask, filingsTask);
summary = await summaryTask;
upcomingFilings = (await filingsTask).ToList();
}
catch (Exception ex)
{
errorMessage = "대시보드 데이터를 불러올 수 없습니다.";
Console.Error.WriteLine($"Dashboard error: {ex.Message}");
}
finally
{
isLoading = false;
await Task.WhenAll(summaryTask, filingsTask);
summary = await summaryTask;
upcomingFilings = (await filingsTask).ToList();
}
catch (Exception ex)
{
errorMessage = "대시보드 데이터를 불러올 수 없습니다.";
Console.Error.WriteLine($"Dashboard error: {ex.Message}");
}
finally
{
isLoading = false;
StateHasChanged();
}
}
}
}
}
@@ -95,9 +95,26 @@
</MudPaper>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<Faq>? faqs;
protected override async Task OnInitializedAsync() => await LoadAsync();
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadAsync();
StateHasChanged();
}
}
}
}
private async Task LoadAsync()
{
@@ -46,11 +46,31 @@ else
</MudPaper>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private bool isLoading = true;
private IReadOnlyList<Domain.Entities.Inquiry> allInquiries = [];
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadData();
StateHasChanged();
}
}
}
}
private async Task LoadData()
{
isLoading = true;
try
{
var (items, _) = await InquiryClient.GetPagedAsync(1, 200);
@@ -26,10 +26,10 @@
}
else if (revenues.Count == 0)
{
<div class="pa-6 text-center">
<MudIcon Icon="@Icons.Material.Filled.Payments" Style="font-size:3rem; opacity:.3;" />
<MudText Class="mt-2 text-muted">청구 기록이 없습니다.</MudText>
</div>
<MudAlert Severity="Severity.Info" Class="mt-4">
<MudIcon Icon="@Icons.Material.Filled.Payments" Class="me-2" />
청구 기록이 없습니다.
</MudAlert>
}
else
{
@@ -96,13 +96,19 @@
<MudSelect T="int" @bind-Value="revenueForm.ClientId" Label="고객" Required="true" Variant="Variant.Outlined" FullWidth="true" Class="mb-4">
@foreach (var client in clients)
{
<MudSelectItem Value="@client.Id">@client.CompanyName</MudSelectItem>
<MudSelectItem Value="@client.Id">@GetClientDisplayName(client)</MudSelectItem>
}
</MudSelect>
<MudTextField T="string" @bind-Value="revenueForm.InvoiceNumber" Label="청구번호" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudDatePicker @bind-Date="revenueForm.InvoiceDate" Label="청구일" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudNumericField T="decimal" @bind-Value="revenueForm.Amount" Label="청구액" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudTextField T="string" @bind-Value="revenueForm.ServiceType" Label="서비스 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" />
<MudSelect T="string" @bind-Value="revenueForm.ServiceType" Label="서비스 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4">
<MudSelectItem Value="@("기장 수수료")">기장 수수료</MudSelectItem>
<MudSelectItem Value="@("세무조정료")">세무조정료</MudSelectItem>
<MudSelectItem Value="@("세무상담료")">세무상담료</MudSelectItem>
<MudSelectItem Value="@("신고 대행료")">신고 대행료</MudSelectItem>
<MudSelectItem Value="@("자문 수수료")">자문 수수료</MudSelectItem>
</MudSelect>
<MudDatePicker @bind-Date="revenueForm.DueDate" Label="납부예정일" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" />
</MudForm>
</DialogContent>
@@ -113,6 +119,9 @@
</MudDialog>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<RevenueTracking>? revenues;
private List<Client> clients = [];
private Dictionary<int, string> clientMap = new();
@@ -120,9 +129,20 @@
private bool isDialogOpen;
private RevenueForm revenueForm = new();
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadData();
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadData();
StateHasChanged();
}
}
}
}
private async Task LoadData()
@@ -130,9 +150,9 @@
try
{
revenues = await RevenueClient.GetAllAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync(pageSize: 1000);
clients = clientItems.ToList();
clientMap = clients.ToDictionary(c => c.Id, c => c.CompanyName ?? "");
clientMap = clients.ToDictionary(c => c.Id, GetClientDisplayName);
}
catch (Exception ex)
{
@@ -142,12 +162,27 @@
private void OpenCreateDialog()
{
revenueForm = new();
revenueForm = new RevenueForm
{
ClientId = clients.FirstOrDefault()?.Id ?? 0,
InvoiceDate = DateTime.Today,
DueDate = DateTime.Today.AddDays(14)
};
isDialogOpen = true;
}
private async Task SaveRevenue()
{
if (form != null)
{
await form.Validate();
if (!form.IsValid)
{
Snackbar.Add("필수 항목을 입력해주세요.", Severity.Warning);
return;
}
}
try
{
var newId = await RevenueClient.CreateAsync(
@@ -217,6 +252,12 @@
revenueForm = new();
}
private static string GetClientDisplayName(Client client)
=> !string.IsNullOrWhiteSpace(client.CompanyName)
? client.CompanyName
: !string.IsNullOrWhiteSpace(client.Name)
? client.Name
: $"Client #{client.Id}";
private class RevenueForm
{
public int ClientId { get; set; }
@@ -29,10 +29,10 @@
}
else if (schedules.Count == 0)
{
<div class="pa-6 text-center">
<MudIcon Icon="@Icons.Material.Filled.EventBusy" Style="font-size:3rem; opacity:.3;" />
<MudText Class="mt-2 text-muted">신고 일정이 없습니다.</MudText>
</div>
<MudAlert Severity="Severity.Info" Class="mt-4">
<MudIcon Icon="@Icons.Material.Filled.EventBusy" Class="me-2" />
신고 일정이 없습니다.
</MudAlert>
}
else
{
@@ -117,19 +117,29 @@
</TitleContent>
<DialogContent>
<MudForm @ref="form">
<MudSelect T="int"
<MudSelect T="int?"
@bind-Value="scheduleForm.ClientId"
Label="고객"
Required="true"
Variant="Variant.Outlined"
FullWidth="true"
Class="mb-4">
Class="mb-4"
RequiredError="고객을 선택하세요.">
@foreach (var client in clients)
{
<MudSelectItem Value="@client.Id">@client.CompanyName</MudSelectItem>
<MudSelectItem Value="@((int?)client.Id)">@GetClientDisplayName(client)</MudSelectItem>
}
</MudSelect>
<MudTextField T="string" @bind-Value="scheduleForm.FilingType" Label="신고 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudSelect T="string" @bind-Value="scheduleForm.FilingType" Label="신고 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true">
<MudSelectItem Value="@("종합소득세")">종합소득세</MudSelectItem>
<MudSelectItem Value="@("부가가치세")">부가가치세</MudSelectItem>
<MudSelectItem Value="@("법인세")">법인세</MudSelectItem>
<MudSelectItem Value="@("원천세")">원천세</MudSelectItem>
<MudSelectItem Value="@("종합부동산세")">종합부동산세</MudSelectItem>
<MudSelectItem Value="@("양도소득세")">양도소득세</MudSelectItem>
<MudSelectItem Value="@("상속·증여세")">상속·증여세</MudSelectItem>
<MudSelectItem Value="@("세무조정")">세무조정</MudSelectItem>
</MudSelect>
<MudDatePicker @bind-Date="scheduleForm.DueDate" Label="마감일" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
<MudNumericField T="int" @bind-Value="scheduleForm.FilingYear" Label="신고연도" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true" />
</MudForm>
@@ -141,23 +151,40 @@
</MudDialog>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<TaxFilingSchedule>? schedules;
private List<Client> clients = [];
private Dictionary<int, string> clientMap = new();
private MudForm? form;
private bool isDialogOpen;
private TaxFilingScheduleForm scheduleForm = new();
protected override async Task OnInitializedAsync() => await LoadData();
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadData();
StateHasChanged();
}
}
}
}
private async Task LoadData()
{
try
{
schedules = await TaxFilingClient.GetAllAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync(pageSize: 1000);
clients = clientItems.ToList();
clientMap = clients.ToDictionary(c => c.Id, c => c.CompanyName ?? "");
clientMap = clients.ToDictionary(c => c.Id, GetClientDisplayName);
}
catch (Exception ex)
{
@@ -167,16 +194,32 @@
private void OpenCreateDialog()
{
scheduleForm = new TaxFilingScheduleForm { FilingYear = DateTime.Now.Year };
scheduleForm = new TaxFilingScheduleForm
{
FilingYear = DateTime.Now.Year,
DueDate = DateTime.Today,
ClientId = clients.FirstOrDefault()?.Id
};
isDialogOpen = true;
}
private async Task SaveSchedule()
{
if (form != null)
{
await form.Validate();
if (!form.IsValid)
{
Snackbar.Add("필수 항목을 입력해주세요.", Severity.Warning);
return;
}
}
try
{
if (scheduleForm.ClientId == null) return;
var newId = await TaxFilingClient.CreateAsync(
scheduleForm.ClientId,
scheduleForm.ClientId.Value,
scheduleForm.FilingType,
scheduleForm.DueDate ?? DateTime.Today,
scheduleForm.FilingYear);
@@ -243,9 +286,15 @@
scheduleForm = new();
}
private static string GetClientDisplayName(Client client)
=> !string.IsNullOrWhiteSpace(client.CompanyName)
? client.CompanyName
: !string.IsNullOrWhiteSpace(client.Name)
? client.Name
: $"Client #{client.Id}";
private class TaxFilingScheduleForm
{
public int ClientId { get; set; }
public int? ClientId { get; set; }
public string FilingType { get; set; } = "";
public DateTime? DueDate { get; set; }
public int FilingYear { get; set; } = DateTime.Now.Year;
@@ -101,7 +101,7 @@
{
try
{
var (items, _) = await ClientClient.GetPagedAsync(1, 20, search: value);
var (items, _) = await ClientClient.GetPagedAsync(1, 100, search: value);
return items;
}
catch
@@ -110,6 +110,12 @@
}
}
private static string GetClientDisplayName(Client client)
=> !string.IsNullOrWhiteSpace(client.CompanyName)
? client.CompanyName
: !string.IsNullOrWhiteSpace(client.Name)
? client.Name
: $"Client #{client.Id}";
private async Task AddFiling()
{
try
@@ -84,13 +84,23 @@ else
</TitleContent>
<DialogContent>
<MudForm @ref="form">
<MudSelect T="int" @bind-Value="profileForm.ClientId" Label="고객" Required="true" Variant="Variant.Outlined" FullWidth="true" Class="mb-4">
<MudSelect T="int?" @bind-Value="profileForm.ClientId" Label="고객" Required="true" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" RequiredError="고객을 선택하세요.">
@foreach (var client in clients)
{
<MudSelectItem Value="@client.Id">@client.CompanyName</MudSelectItem>
<MudSelectItem Value="@((int?)client.Id)">@GetClientDisplayName(client)</MudSelectItem>
}
</MudSelect>
<MudTextField T="string" @bind-Value="profileForm.BusinessType" Label="사업 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" />
<MudSelect T="string" @bind-Value="profileForm.BusinessType" Label="사업 유형" Variant="Variant.Outlined" FullWidth="true" Class="mb-4" Required="true">
<MudSelectItem Value="@("일반제조업")">일반제조업</MudSelectItem>
<MudSelectItem Value="@("도소매업")">도소매업</MudSelectItem>
<MudSelectItem Value="@("서비스업")">서비스업</MudSelectItem>
<MudSelectItem Value="@("정보통신업")">정보통신업</MudSelectItem>
<MudSelectItem Value="@("부동산업")">부동산업</MudSelectItem>
<MudSelectItem Value="@("건설업")">건설업</MudSelectItem>
<MudSelectItem Value="@("음식점업")">음식점업</MudSelectItem>
<MudSelectItem Value="@("프리랜서")">프리랜서</MudSelectItem>
<MudSelectItem Value="@("기타")">기타</MudSelectItem>
</MudSelect>
<MudSelect T="string" @bind-Value="profileForm.TaxRiskLevel" Label="위험도" Variant="Variant.Outlined" FullWidth="true" Class="mb-4">
<MudSelectItem Value="@("low")">낮음</MudSelectItem>
<MudSelectItem Value="@("normal")">보통</MudSelectItem>
@@ -107,6 +117,9 @@ else
</MudDialog>
@code {
[CascadingParameter]
private Task<AuthenticationState>? AuthStateTask { get; set; }
private List<TaxProfile>? profiles;
private List<Client> clients = [];
private Dictionary<int, string> clientMap = new();
@@ -116,9 +129,20 @@ else
private TaxProfile? editingProfile;
private TaxProfileForm profileForm = new();
protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await LoadData();
if (firstRender)
{
if (AuthStateTask != null)
{
var authState = await AuthStateTask;
if (authState.User.Identity?.IsAuthenticated == true)
{
await LoadData();
StateHasChanged();
}
}
}
}
private async Task LoadData()
@@ -126,9 +150,9 @@ else
try
{
profiles = await TaxProfileClient.GetAllAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync();
var (clientItems, _) = await ClientClient.GetPagedAsync(pageSize: 1000);
clients = clientItems.ToList();
clientMap = clients.ToDictionary(c => c.Id, c => c.CompanyName ?? "");
clientMap = clients.ToDictionary(c => c.Id, GetClientDisplayName);
}
catch (Exception ex)
{
@@ -140,7 +164,12 @@ else
{
isEditMode = false;
editingProfile = null;
profileForm = new();
profileForm = new TaxProfileForm
{
ClientId = clients.FirstOrDefault()?.Id,
TaxRiskLevel = "normal",
NextFilingDueDate = DateTime.Today.AddMonths(1)
};
isDialogOpen = true;
}
@@ -161,25 +190,43 @@ else
private async Task SaveProfile()
{
if (form != null)
{
await form.Validate();
if (!form.IsValid)
{
Snackbar.Add("고객을 선택하세요.", Severity.Warning);
return;
}
}
try
{
if (isEditMode)
if (isEditMode && editingProfile != null)
{
await TaxProfileClient.UpdateAsync(
editingProfile!.Id,
profileForm.BusinessType,
null,
profileForm.NextFilingDueDate,
profileForm.TaxRiskLevel);
Snackbar.Add("세무 프로필이 업데이트되었습니다.", Severity.Success);
await TaxProfileClient.UpdateAsync(editingProfile.Id, profileForm.BusinessType,
null, profileForm.NextFilingDueDate, profileForm.TaxRiskLevel);
Snackbar.Add("세무 프로필이 수정되었습니다.", Severity.Success);
}
else
{
if (!profileForm.ClientId.HasValue)
{
Snackbar.Add("고객을 선택하세요.", Severity.Warning);
return;
}
var newId = await TaxProfileClient.CreateAsync(
profileForm.ClientId,
profileForm.ClientId.Value,
profileForm.BusinessType);
if (newId > 0)
{
// 생성 후 상태 업데이트 처리
await TaxProfileClient.UpdateAsync(
newId,
profileForm.BusinessType,
null,
profileForm.NextFilingDueDate,
profileForm.TaxRiskLevel);
Snackbar.Add("세무 프로필이 추가되었습니다.", Severity.Success);
}
}
@@ -232,9 +279,15 @@ else
_ => Color.Default
};
private static string GetClientDisplayName(Client client)
=> !string.IsNullOrWhiteSpace(client.CompanyName)
? client.CompanyName
: !string.IsNullOrWhiteSpace(client.Name)
? client.Name
: $"Client #{client.Id}";
private class TaxProfileForm
{
public int ClientId { get; set; }
public int? ClientId { get; set; }
public string BusinessType { get; set; } = "";
public string TaxRiskLevel { get; set; } = "normal";
public DateTime? NextFilingDueDate { get; set; }
@@ -9,7 +9,7 @@ namespace TaxBaik.Web.Controllers;
/// SOLID: Single Responsibility - 대시보드 데이터만 담당
/// </summary>
[ApiController]
[Route("api/[controller]")]
[Route("api/admin-dashboard")]
[Authorize]
public class AdminDashboardController : ControllerBase
{
@@ -27,6 +27,7 @@ public class AuthController : ControllerBase
return Ok(new
{
token = tokenPair.AccessToken,
accessToken = tokenPair.AccessToken,
refreshToken = tokenPair.RefreshToken,
expiresIn = tokenPair.ExpiresIn
@@ -45,6 +46,7 @@ public class AuthController : ControllerBase
return Ok(new
{
token = tokenPair.AccessToken,
accessToken = tokenPair.AccessToken,
refreshToken = tokenPair.RefreshToken,
expiresIn = tokenPair.ExpiresIn
@@ -24,6 +24,20 @@ public class ConsultingActivityController(ConsultingActivityService service) : C
}
}
[HttpGet]
public async Task<IActionResult> GetAll()
{
try
{
var activities = await service.GetAllAsync();
return Ok(activities);
}
catch (Exception ex)
{
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
}
}
[HttpGet("{id:int}")]
public async Task<IActionResult> GetById(int id)
{
@@ -24,6 +24,20 @@ public class ContractController(ContractService service) : ControllerBase
}
}
[HttpGet]
public async Task<IActionResult> GetAll()
{
try
{
var contracts = await service.GetAllAsync();
return Ok(contracts);
}
catch (Exception ex)
{
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
}
}
[HttpGet("{id:int}")]
public async Task<IActionResult> GetById(int id)
{
+3 -1
View File
@@ -32,7 +32,8 @@ public class InquiryController : ControllerBase
request.ServiceType,
request.Message,
request.Email,
HttpContext.Connection.RemoteIpAddress?.ToString());
HttpContext.Connection.RemoteIpAddress?.ToString(),
request.SuppressNotification);
return Ok(new { message = "상담 신청이 접수되었습니다." });
}
catch (ValidationException ex)
@@ -135,6 +136,7 @@ public class SubmitInquiryRequest
public string? Email { get; set; }
public string ServiceType { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public bool SuppressNotification { get; set; }
}
public class UpdateStatusRequest
@@ -24,6 +24,20 @@ public class RevenueTrackingController(RevenueTrackingService service) : Control
}
}
[HttpGet]
public async Task<IActionResult> GetAll()
{
try
{
var revenues = await service.GetAllAsync();
return Ok(revenues);
}
catch (Exception ex)
{
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
}
}
[HttpGet("{id:int}")]
public async Task<IActionResult> GetById(int id)
{
@@ -24,6 +24,20 @@ public class TaxFilingScheduleController(TaxFilingScheduleService service) : Con
}
}
[HttpGet]
public async Task<IActionResult> GetAll()
{
try
{
var schedules = await service.GetAllAsync();
return Ok(schedules);
}
catch (Exception ex)
{
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
}
}
[HttpGet("{id:int}")]
public async Task<IActionResult> GetById(int id)
{
@@ -24,6 +24,20 @@ public class TaxProfileController(TaxProfileService taxProfileService) : Control
}
}
[HttpGet]
public async Task<IActionResult> GetAll()
{
try
{
var profiles = await taxProfileService.GetAllAsync();
return Ok(profiles);
}
catch (Exception ex)
{
return StatusCode(500, new { error = "조회 실패", message = ex.Message });
}
}
[HttpGet("client/{clientId:int}")]
public async Task<IActionResult> GetByClientId(int clientId)
{
-87
View File
@@ -1,87 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
namespace TaxBaik.Web.Hubs;
/// <summary>
/// Real-time notification hub for admin dashboard
/// SOLID: Single Responsibility - Only broadcasts change notifications
/// No state management - stateless broadcast pattern
/// </summary>
[Authorize]
public class NotificationHub : Hub
{
private const string AdminGroup = "admins";
public override async Task OnConnectedAsync()
{
await Groups.AddToGroupAsync(Context.ConnectionId, AdminGroup);
await base.OnConnectedAsync();
}
/// <summary>
/// Broadcast inquiry status changed to all connected admins
/// Clients should re-fetch from API to verify
/// </summary>
public async Task NotifyInquiryStatusChanged(int inquiryId, string newStatus)
{
await Clients.Group(AdminGroup).SendAsync("InquiryStatusChanged", new
{
InquiryId = inquiryId,
Status = newStatus,
ChangedAt = DateTime.UtcNow
});
}
/// <summary>
/// Broadcast inquiry submitted (new inquiry created)
/// </summary>
public async Task NotifyInquiryCreated(int inquiryId, string name)
{
await Clients.Group(AdminGroup).SendAsync("InquiryCreated", new
{
InquiryId = inquiryId,
Name = name,
CreatedAt = DateTime.UtcNow
});
}
/// <summary>
/// Broadcast client created
/// </summary>
public async Task NotifyClientCreated(int clientId, string name)
{
await Clients.Group(AdminGroup).SendAsync("ClientCreated", new
{
ClientId = clientId,
Name = name,
CreatedAt = DateTime.UtcNow
});
}
/// <summary>
/// Broadcast announcement published
/// </summary>
public async Task NotifyAnnouncementPublished(int announcementId, string title)
{
await Clients.Group(AdminGroup).SendAsync("AnnouncementPublished", new
{
AnnouncementId = announcementId,
Title = title,
PublishedAt = DateTime.UtcNow
});
}
/// <summary>
/// Broadcast tax filing completed
/// </summary>
public async Task NotifyFilingCompleted(int filingId, string filingType)
{
await Clients.Group(AdminGroup).SendAsync("FilingCompleted", new
{
FilingId = filingId,
FilingType = filingType,
CompletedAt = DateTime.UtcNow
});
}
}
+99
View File
@@ -0,0 +1,99 @@
using System;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text;
using System.Threading.Tasks;
using Serilog.Core;
using Serilog.Events;
namespace TaxBaik.Web.Logging;
public class TelegramSink : ILogEventSink
{
private readonly string _botToken;
private readonly string _chatId;
private readonly HttpClient _httpClient;
public TelegramSink(string botToken, string chatId)
{
_botToken = botToken;
_chatId = chatId;
_httpClient = new HttpClient();
}
public void Emit(LogEvent logEvent)
{
if (logEvent.Level < LogEventLevel.Error)
{
return;
}
// Filter out harmless client disconnect and task cancellation exceptions
if (logEvent.Exception != null)
{
var exTypeName = logEvent.Exception.GetType().FullName ?? "";
var exMessage = logEvent.Exception.Message ?? "";
if (exTypeName.Contains("JSDisconnectedException") ||
exTypeName.Contains("TaskCanceledException") ||
exMessage.Contains("JavaScript interop calls cannot be issued") ||
exMessage.Contains("circuit has disconnected"))
{
return;
}
}
// Emit is a synchronous method, so we dispatch the network call asynchronously
Task.Run(async () =>
{
try
{
var timestamp = logEvent.Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff zzz");
var level = logEvent.Level.ToString().ToUpper();
var message = logEvent.RenderMessage();
var exceptionDetails = logEvent.Exception?.ToString();
var sb = new StringBuilder();
sb.AppendLine($"<b>🚨 [{level}] 에러 발생</b>");
sb.AppendLine($"<b>시간:</b> {timestamp}");
sb.AppendLine($"<b>메시지:</b> {EscapeHtml(message)}");
if (!string.IsNullOrEmpty(exceptionDetails))
{
var escapedException = EscapeHtml(exceptionDetails);
if (escapedException.Length > 3000)
{
escapedException = escapedException.Substring(0, 3000) + "\n[이하 생략]";
}
sb.AppendLine($"<b>Exception 상세:</b>\n<pre>{escapedException}</pre>");
}
var url = $"https://api.telegram.org/bot{_botToken}/sendMessage";
var payload = new
{
chat_id = _chatId,
text = sb.ToString(),
parse_mode = "HTML"
};
var response = await _httpClient.PostAsJsonAsync(url, payload);
if (!response.IsSuccessStatusCode)
{
var errorResponse = await response.Content.ReadAsStringAsync();
Console.WriteLine($"[TelegramSink] Failed to send log to Telegram: {response.StatusCode} - {errorResponse}");
}
}
catch (Exception ex)
{
Console.WriteLine($"[TelegramSink] Error in TelegramSink: {ex.Message}");
}
});
}
private static string EscapeHtml(string text)
{
if (string.IsNullOrEmpty(text)) return text;
return text.Replace("&", "&amp;")
.Replace("<", "&lt;")
.Replace(">", "&gt;");
}
}
+7 -1
View File
@@ -5,7 +5,13 @@
}
<div class="container py-5" style="max-width: 600px;">
<h1 class="fw-bold mb-5">상담 신청</h1>
<div class="d-flex align-items-center justify-content-between gap-3 mb-4">
<h1 class="fw-bold mb-0">상담 신청</h1>
<a href="/taxbaik" class="btn btn-outline-secondary btn-sm"
onclick="if (history.length > 1) { history.back(); return false; }">
뒤로가기
</a>
</div>
@if (TempData["Success"] != null)
{
+162 -25
View File
@@ -1,34 +1,171 @@
@page "/portal"
@model TaxBaik.Web.Pages.Portal.IndexModel
@{
ViewData["Title"] = "고객 포털";
ViewData["Description"] = "고객 신고 일정, 상담 요약, 중요 알림을 확인하는 전용 포털입니다.";
ViewData["CanonicalUrl"] = $"{Request.Scheme}://{Request.Host}/taxbaik/portal";
ViewData["Title"] = "마이 포털 - 세무사 백원숙";
ViewData["Description"] = "고객님의 세무 신고 일정 상담 이력을 실시간으로 확인하실 수 있는 마이페이지입니다.";
}
<section class="container py-5">
<div class="row g-4 align-items-start">
<div class="col-lg-7">
<p class="text-uppercase text-muted small mb-2">Portal</p>
<h1 class="display-6 fw-bold mb-3">고객 포털</h1>
<p class="lead text-muted mb-4">
신고 일정, 상담 요약, 승인된 알림을 확인할 수 있는 전용 공간입니다.
</p>
<div class="d-flex gap-2 flex-wrap">
<a class="btn btn-dark" href="/taxbaik/portal/login">로그인</a>
<a class="btn btn-outline-dark" href="/taxbaik/portal/register">회원가입</a>
<div class="bg-light py-5">
<div class="container">
<!-- 상단 헤더 & 환영 문구 -->
<div class="d-flex flex-wrap justify-content-between align-items-center mb-5 pb-4 border-bottom">
<div>
<p class="text-primary fw-bold mb-1">TaxBaik My Portal</p>
<h1 class="display-6 fw-bold text-dark">안녕하세요, @(User.Identity?.Name)님!</h1>
@if (Model.ClientInfo != null)
{
<p class="text-muted mb-0">
<i class="bi bi-building"></i> @(string.IsNullOrEmpty(Model.ClientInfo.CompanyName) ? "개인 고객" : Model.ClientInfo.CompanyName)
| <i class="bi bi-telephone"></i> @Model.ClientInfo.Phone
</p>
}
</div>
<div class="mt-3 mt-sm-0">
<form method="post" action="/taxbaik/portal/logout" class="d-inline">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-outline-danger btn-sm">
<i class="bi bi-box-arrow-right"></i> 로그아웃
</button>
</form>
</div>
</div>
<div class="col-lg-5">
<div class="p-4 bg-light border rounded-3">
<h2 class="h5 fw-bold mb-3">제공 예정 기능</h2>
<ul class="mb-0 text-muted">
<li>본인 신고 일정 확인</li>
<li>상담 요약 열람</li>
<li>중요 알림 수신</li>
<li>관리자 승인 범위 내 정보 제공</li>
</ul>
@if (Model.ClientInfo == null)
{
<!-- 연동 대기 경고 -->
<div class="card border-warning shadow-sm mb-5">
<div class="card-body p-5 text-center">
<div class="mb-4">
<span class="display-1 text-warning"><i class="bi bi-exclamation-triangle-fill"></i></span>
</div>
<h3 class="fw-bold text-dark mb-3">고객 정보 연동 대기 중</h3>
<p class="text-muted max-width-md mx-auto mb-4">
가입하신 계정 정보(이메일/연락처)와 일치하는 세무 대리 고객 레코드를 찾지 못했습니다.<br />
세무사 측에서 고객 등록을 완료하거나 관리자 백오피스에서 이메일/전화번호가 일치하도록 지정하면 자동으로 포털 데이터가 활성화됩니다.
</p>
<a href="/taxbaik/contact" class="btn btn-primary px-4 py-2">
<i class="bi bi-chat-dots"></i> 세무사에게 문의하기
</a>
</div>
</div>
</div>
}
else
{
<div class="row g-4">
<!-- 왼쪽: 세무 신고 현황 (Tax Filings) -->
<div class="col-lg-8">
<div class="card border-0 shadow-sm rounded-3 mb-4">
<div class="card-body p-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="h5 fw-bold text-dark mb-0">
<i class="bi bi-calendar-check text-primary me-2"></i> 나의 세무 신고 현황
</h3>
<span class="badge bg-secondary">총 @(Model.Filings.Count)건</span>
</div>
@if (!Model.Filings.Any())
{
<div class="text-center py-5 text-muted">
<i class="bi bi-folder-x display-4 d-block mb-3 text-secondary"></i>
등록된 세무 신고 일정이 없습니다.
</div>
}
else
{
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead class="table-light">
<tr>
<th scope="col">신고 종류</th>
<th scope="col">신고 기한</th>
<th scope="col">진행 상태</th>
<th scope="col">메모</th>
</tr>
</thead>
<tbody>
@foreach (var filing in Model.Filings)
{
var dDay = (filing.DueDate - DateTime.Today).Days;
var statusClass = filing.Status switch
{
"filed" => "bg-success-subtle text-success",
"overdue" => "bg-danger-subtle text-danger",
_ => "bg-warning-subtle text-warning-emphasis"
};
var statusLabel = filing.Status switch
{
"filed" => "신고 완료",
"overdue" => "기한 초과",
_ => $"D-{dDay}"
};
<tr>
<td>
<span class="fw-bold text-dark">@filing.FilingType</span>
</td>
<td>
<span>@filing.DueDate.ToString("yyyy-MM-dd")</span>
</td>
<td>
<span class="badge @statusClass px-2.5 py-1.5 fs-7">@statusLabel</span>
</td>
<td class="text-muted small">
@(string.IsNullOrEmpty(filing.Memo) ? "-" : filing.Memo)
</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</div>
</div>
<!-- 오른쪽: 상담 이력 요약 (Consulting Activities) -->
<div class="col-lg-4">
<div class="card border-0 shadow-sm rounded-3">
<div class="card-body p-4">
<h3 class="h5 fw-bold text-dark mb-4">
<i class="bi bi-chat-text text-primary me-2"></i> 최근 상담 및 지원 이력
</h3>
@if (!Model.Consultations.Any())
{
<div class="text-center py-5 text-muted">
<i class="bi bi-chat-square-dots display-4 d-block mb-3 text-secondary"></i>
최근 상담 이력이 없습니다.
</div>
}
else
{
<div class="timeline">
@foreach (var activity in Model.Consultations)
{
<div class="border-start border-2 border-primary-subtle ps-3 pb-4 position-relative">
<!-- 타임라인 아이콘 -->
<div class="position-absolute start-0 translate-middle-x bg-primary rounded-circle"
style="width: 10px; height: 10px; margin-left: -1px; top: 6px;"></div>
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="badge bg-primary-subtle text-primary small">@activity.ActivityType</span>
<small class="text-muted">@activity.ActivityDate.ToString("yyyy-MM-dd")</small>
</div>
<p class="text-dark small mb-1 fw-semibold">@activity.Description</p>
@if (!string.IsNullOrEmpty(activity.Outcome))
{
<div class="bg-light p-2 rounded small text-muted mt-1">
<strong>결과:</strong> @activity.Outcome
</div>
}
</div>
}
</div>
}
</div>
</div>
</div>
</div>
}
</div>
</section>
</div>
+37 -1
View File
@@ -1,5 +1,9 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using TaxBaik.Application.Services;
using TaxBaik.Domain.Entities;
using TaxBaik.Web.Services;
namespace TaxBaik.Web.Pages.Portal;
@@ -7,7 +11,39 @@ namespace TaxBaik.Web.Pages.Portal;
[Authorize(AuthenticationSchemes = PortalAuthDefaults.Scheme)]
public class IndexModel : PageModel
{
public void OnGet()
private readonly TaxFilingService _taxFilingService;
private readonly ConsultingActivityService _consultingActivityService;
private readonly ClientService _clientService;
public IndexModel(
TaxFilingService taxFilingService,
ConsultingActivityService consultingActivityService,
ClientService clientService)
{
_taxFilingService = taxFilingService;
_consultingActivityService = consultingActivityService;
_clientService = clientService;
}
public Client? ClientInfo { get; private set; }
public List<TaxFiling> Filings { get; private set; } = new();
public List<ConsultingActivity> Consultations { get; private set; } = new();
public async Task<IActionResult> OnGetAsync()
{
var clientIdClaim = User.FindFirst("client_id");
if (clientIdClaim != null && int.TryParse(clientIdClaim.Value, out var clientId))
{
ClientInfo = await _clientService.GetByIdAsync(clientId);
if (ClientInfo != null)
{
var filingsData = await _taxFilingService.GetByClientIdAsync(clientId);
Filings = filingsData.OrderBy(f => f.DueDate).ToList();
var consultationsData = await _consultingActivityService.GetByClientIdAsync(clientId);
Consultations = consultationsData.OrderByDescending(c => c.ActivityDate).ToList();
}
}
return Page();
}
}
+43 -7
View File
@@ -3,21 +3,57 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@(ViewData["Title"] ?? "백원숙 세무회계")</title>
<meta name="description" content="@(ViewData["Description"] ?? "사업자 기장, 부동산 양도세·증여세, 종합소득세 전문 상담.")" />
<meta property="og:title" content="@ViewData["Title"]" />
<meta property="og:description" content="@ViewData["Description"]" />
<meta property="og:image" content="@ViewData["OgImage"]" />
<meta property="og:url" content="@ViewData["OgUrl"]" />
<title>@(ViewData["Title"] ?? "백원숙 세무회계 - 세무사 전문 상담")</title>
<meta name="description" content="@(ViewData["Description"] ?? "백원숙 세무회계 - 사업자 기장, 부동산 양도세·증여세, 종합소득세 전문 상담. 맞춤형 세무 절세 컨설팅 제공.")" />
<meta name="keywords" content="백원숙 세무회계, 세무사, 사업자 기장, 양도소득세, 증여세, 상속세, 종합소득세, 절세 상담, 세무 대리" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:title" content="@(ViewData["Title"] ?? "백원숙 세무회계 - 세무사 전문 상담")" />
<meta property="og:description" content="@(ViewData["Description"] ?? "백원숙 세무회계 - 사업자 기장, 부동산 양도세·증여세, 종합소득세 전문 상담. 맞춤형 세무 절세 컨설팅 제공.")" />
<meta property="og:image" content="@(ViewData["OgImage"] ?? "http://178.104.200.7/taxbaik/images/og-image.jpg")" />
<meta property="og:url" content="@(ViewData["OgUrl"] ?? "http://178.104.200.7/taxbaik/")" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:title" content="@(ViewData["Title"] ?? "백원숙 세무회계 - 세무사 전문 상담")" />
<meta property="twitter:description" content="@(ViewData["Description"] ?? "백원숙 세무회계 - 사업자 기장, 부동산 양도세·증여세, 종합소득세 전문 상담. 맞춤형 세무 절세 컨설팅 제공.")" />
<meta property="twitter:image" content="@(ViewData["OgImage"] ?? "http://178.104.200.7/taxbaik/images/og-image.jpg")" />
<!-- 검색엔진 등록용 소유권 인증 메타 태그 (발급받으신 토큰이 있으면 아래 content에 넣어 주시면 됩니다) -->
<!-- <meta name="naver-site-verification" content="네이버_서치어드바이저_토큰_입력" /> -->
<!-- <meta name="google-site-verification" content="구글_서치콘솔_토큰_입력" /> -->
<meta name="robots" content="index, follow" />
<meta name="theme-color" content="#C89D6E" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net" />
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" rel="stylesheet" />
<link rel="canonical" href="@ViewData["CanonicalUrl"]" />
<link rel="canonical" href="@(ViewData["CanonicalUrl"] ?? "http://178.104.200.7/taxbaik/")" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<!-- 구조화된 데이터 (JSON-LD Schema Markup) -->
<script type="application/ld+json">
{
"@@context": "https://schema.org",
"@@type": "ProfessionalService",
"name": "백원숙 세무회계",
"description": "사업자 기장, 부동산 양도세·증여세, 종합소득세 전문 상담 세무사",
"url": "http://178.104.200.7/taxbaik/",
"telephone": "010-4122-8268",
"email": "taxbaik5668@gmail.com",
"address": {
"@@type": "PostalAddress",
"addressCountry": "KR"
},
"sameAs": [
"https://www.instagram.com/taxtory5668/",
"http://pf.kakao.com/_xoxchTX"
]
}
</script>
</head>
<body class="with-mobile-cta">
<partial name="_Header" />
+99 -114
View File
@@ -38,6 +38,13 @@ builder.Host.UseSerilog((context, config) =>
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {Message:lj}{NewLine}{Exception}")
.Enrich.FromLogContext()
.Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName);
var botToken = context.Configuration["Telegram:BotToken"];
var systemChatId = context.Configuration["Telegram:SystemChatId"] ?? context.Configuration["Telegram:ChatId"];
if (!string.IsNullOrEmpty(botToken) && !string.IsNullOrEmpty(systemChatId))
{
config.WriteTo.Sink(new TaxBaik.Web.Logging.TelegramSink(botToken, systemChatId), Serilog.Events.LogEventLevel.Error);
}
});
// Controllers (API)
@@ -45,9 +52,6 @@ builder.Services.AddControllers();
builder.Services.AddProblemDetails();
builder.Services.AddHealthChecks();
// SignalR (Notifications only, no state management)
builder.Services.AddSignalR();
// Razor Pages + Blazor Server 통합
builder.Services.AddRazorPages();
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
@@ -64,7 +68,7 @@ if (isProduction && jwtKey.Contains("dev-secret", StringComparison.OrdinalIgnore
throw new InvalidOperationException("Production JWT SecretKey must not use the development default.");
var key = Encoding.ASCII.GetBytes(jwtKey);
builder.Services.AddAuthentication(opts =>
var authenticationBuilder = builder.Services.AddAuthentication(opts =>
{
opts.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
opts.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
@@ -100,69 +104,87 @@ builder.Services.AddAuthentication(opts =>
opts.Cookie.HttpOnly = true;
opts.Cookie.SameSite = SameSiteMode.Lax;
opts.Cookie.SecurePolicy = isProduction ? CookieSecurePolicy.Always : CookieSecurePolicy.SameAsRequest;
})
.AddGoogle(PortalOAuthDefaults.GoogleScheme, opts =>
{
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
opts.ClientId = builder.Configuration["Authentication:Google:ClientId"] ?? "";
opts.ClientSecret = builder.Configuration["Authentication:Google:ClientSecret"] ?? "";
opts.CallbackPath = "/taxbaik/portal/signin-google";
})
.AddOAuth(PortalOAuthDefaults.NaverScheme, opts =>
{
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
opts.ClientId = builder.Configuration["Authentication:Naver:ClientId"] ?? "";
opts.ClientSecret = builder.Configuration["Authentication:Naver:ClientSecret"] ?? "";
opts.CallbackPath = "/taxbaik/portal/signin-naver";
opts.AuthorizationEndpoint = "https://nid.naver.com/oauth2.0/authorize";
opts.TokenEndpoint = "https://nid.naver.com/oauth2.0/token";
opts.UserInformationEndpoint = "https://openapi.naver.com/v1/nid/me";
opts.SaveTokens = true;
opts.Events = new OAuthEvents
{
OnCreatingTicket = async context =>
{
var request = new HttpRequestMessage(HttpMethod.Get, opts.UserInformationEndpoint);
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", context.AccessToken);
var response = await context.Backchannel.SendAsync(request, context.HttpContext.RequestAborted);
response.EnsureSuccessStatusCode();
using var payload = System.Text.Json.JsonDocument.Parse(await response.Content.ReadAsStringAsync(context.HttpContext.RequestAborted));
var responseRoot = payload.RootElement.GetProperty("response");
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, responseRoot.GetProperty("id").GetString() ?? ""));
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, responseRoot.GetProperty("name").GetString() ?? ""));
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, responseRoot.GetProperty("email").GetString() ?? ""));
}
};
})
.AddOAuth(PortalOAuthDefaults.KakaoScheme, opts =>
{
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
opts.ClientId = builder.Configuration["Authentication:Kakao:ClientId"] ?? "";
opts.ClientSecret = builder.Configuration["Authentication:Kakao:ClientSecret"] ?? "";
opts.CallbackPath = "/taxbaik/portal/signin-kakao";
opts.AuthorizationEndpoint = "https://kauth.kakao.com/oauth/authorize";
opts.TokenEndpoint = "https://kauth.kakao.com/oauth/token";
opts.UserInformationEndpoint = "https://kapi.kakao.com/v2/user/me";
opts.SaveTokens = true;
opts.Events = new OAuthEvents
{
OnCreatingTicket = async context =>
{
var request = new HttpRequestMessage(HttpMethod.Get, opts.UserInformationEndpoint);
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", context.AccessToken);
var response = await context.Backchannel.SendAsync(request, context.HttpContext.RequestAborted);
response.EnsureSuccessStatusCode();
using var payload = System.Text.Json.JsonDocument.Parse(await response.Content.ReadAsStringAsync(context.HttpContext.RequestAborted));
var kakaoAccount = payload.RootElement.GetProperty("kakao_account");
var profile = kakaoAccount.GetProperty("profile");
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, payload.RootElement.GetProperty("id").GetInt64().ToString()));
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, profile.GetProperty("nickname").GetString() ?? ""));
if (kakaoAccount.TryGetProperty("email", out var emailProp))
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, emailProp.GetString() ?? ""));
}
};
});
var googleClientId = builder.Configuration["Authentication:Google:ClientId"];
var googleClientSecret = builder.Configuration["Authentication:Google:ClientSecret"];
if (!string.IsNullOrWhiteSpace(googleClientId) && !string.IsNullOrWhiteSpace(googleClientSecret))
{
authenticationBuilder.AddGoogle(PortalOAuthDefaults.GoogleScheme, opts =>
{
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
opts.ClientId = googleClientId;
opts.ClientSecret = googleClientSecret;
opts.CallbackPath = "/taxbaik/portal/signin-google";
});
}
var naverClientId = builder.Configuration["Authentication:Naver:ClientId"];
var naverClientSecret = builder.Configuration["Authentication:Naver:ClientSecret"];
if (!string.IsNullOrWhiteSpace(naverClientId) && !string.IsNullOrWhiteSpace(naverClientSecret))
{
authenticationBuilder.AddOAuth(PortalOAuthDefaults.NaverScheme, opts =>
{
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
opts.ClientId = naverClientId;
opts.ClientSecret = naverClientSecret;
opts.CallbackPath = "/taxbaik/portal/signin-naver";
opts.AuthorizationEndpoint = "https://nid.naver.com/oauth2.0/authorize";
opts.TokenEndpoint = "https://nid.naver.com/oauth2.0/token";
opts.UserInformationEndpoint = "https://openapi.naver.com/v1/nid/me";
opts.SaveTokens = true;
opts.Events = new OAuthEvents
{
OnCreatingTicket = async context =>
{
var request = new HttpRequestMessage(HttpMethod.Get, opts.UserInformationEndpoint);
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", context.AccessToken);
var response = await context.Backchannel.SendAsync(request, context.HttpContext.RequestAborted);
response.EnsureSuccessStatusCode();
using var payload = System.Text.Json.JsonDocument.Parse(await response.Content.ReadAsStringAsync(context.HttpContext.RequestAborted));
var responseRoot = payload.RootElement.GetProperty("response");
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, responseRoot.GetProperty("id").GetString() ?? ""));
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, responseRoot.GetProperty("name").GetString() ?? ""));
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, responseRoot.GetProperty("email").GetString() ?? ""));
}
};
});
}
var kakaoClientId = builder.Configuration["Authentication:Kakao:ClientId"];
var kakaoClientSecret = builder.Configuration["Authentication:Kakao:ClientSecret"];
if (!string.IsNullOrWhiteSpace(kakaoClientId) && !string.IsNullOrWhiteSpace(kakaoClientSecret))
{
authenticationBuilder.AddOAuth(PortalOAuthDefaults.KakaoScheme, opts =>
{
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
opts.ClientId = kakaoClientId;
opts.ClientSecret = kakaoClientSecret;
opts.CallbackPath = "/taxbaik/portal/signin-kakao";
opts.AuthorizationEndpoint = "https://kauth.kakao.com/oauth/authorize";
opts.TokenEndpoint = "https://kauth.kakao.com/oauth/token";
opts.UserInformationEndpoint = "https://kapi.kakao.com/v2/user/me";
opts.SaveTokens = true;
opts.Events = new OAuthEvents
{
OnCreatingTicket = async context =>
{
var request = new HttpRequestMessage(HttpMethod.Get, opts.UserInformationEndpoint);
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", context.AccessToken);
var response = await context.Backchannel.SendAsync(request, context.HttpContext.RequestAborted);
response.EnsureSuccessStatusCode();
using var payload = System.Text.Json.JsonDocument.Parse(await response.Content.ReadAsStringAsync(context.HttpContext.RequestAborted));
var kakaoAccount = payload.RootElement.GetProperty("kakao_account");
var profile = kakaoAccount.GetProperty("profile");
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, payload.RootElement.GetProperty("id").GetInt64().ToString()));
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, profile.GetProperty("nickname").GetString() ?? ""));
if (kakaoAccount.TryGetProperty("email", out var emailProp))
context.Identity?.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, emailProp.GetString() ?? ""));
}
};
});
}
// Blazor 인증
builder.Services.AddScoped<AuthService>();
builder.Services.AddScoped<CustomAuthenticationStateProvider>();
@@ -172,9 +194,6 @@ builder.Services.AddCascadingAuthenticationState();
builder.Services.AddAuthorization();
builder.Services.AddAuthorizationCore();
// Notifications (SignalR)
builder.Services.AddScoped<INotificationService, NotificationService>();
// Telegram Notification
builder.Services.AddHttpClient<ITelegramNotificationService, TelegramNotificationService>();
@@ -189,64 +208,53 @@ var apiBaseUrl = builder.Configuration["ApiClient:BaseUrl"]
builder.Services.AddHttpClient<IAdminDashboardClient, AdminDashboardClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IInquiryBrowserClient, InquiryBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IClientBrowserClient, ClientBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<ITaxFilingBrowserClient, TaxFilingBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IFaqBrowserClient, FaqBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IAnnouncementBrowserClient, AnnouncementBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
// Phase 5: Tax Accounting & CRM Browser Clients
builder.Services.AddHttpClient<ITaxProfileBrowserClient, TaxProfileBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<ITaxFilingScheduleBrowserClient, TaxFilingScheduleBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IConsultingActivityBrowserClient, ConsultingActivityBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IContractBrowserClient, ContractBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
builder.Services.AddHttpClient<IRevenueTrackingBrowserClient, RevenueTrackingBrowserClient>(client =>
{
client.BaseAddress = new Uri(apiBaseUrl);
})
.AddHttpMessageHandler<TokenRefreshHandler>();
});
// UI & 캐시 (MudBlazor Theme Customization)
builder.Services.AddMudServices(config =>
@@ -258,7 +266,6 @@ builder.Services.AddMemoryCache();
builder.Services.AddResponseCompression(opts => {
opts.Providers.Add<GzipCompressionProvider>();
});
builder.Services.AddScoped<IInquiryNotificationService, TelegramInquiryNotificationService>();
builder.Services.AddHostedService<TelegramReportBackgroundService>();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<PortalAuthService>();
@@ -270,6 +277,7 @@ builder.Services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
builder.Services.AddInfrastructure();
builder.Services.AddApplication();
builder.Services.AddScoped<IInquiryNotificationService, TelegramInquiryNotificationService>();
// Register version info
var versionInfo = new VersionInfo();
@@ -336,8 +344,6 @@ app.MapControllers();
app.MapHealthChecks("/healthz");
app.MapRazorPages();
// SignalR Hub
app.MapHub<TaxBaik.Web.Hubs.NotificationHub>("/taxbaik/notifications");
// AllowAnonymous: JWT 미들웨어가 Blazor 셸 요청을 401로 차단하지 않도록 한다.
// 인증은 Blazor AuthorizeRouteView → RedirectToLogin 에서 처리한다.
app.MapRazorComponents<TaxBaik.Web.Components.Admin.App>()
@@ -348,27 +354,6 @@ app.MapRazorComponents<TaxBaik.Web.Components.Admin.App>()
try
{
Log.Information("애플리케이션 시작: {Environment}", app.Environment.EnvironmentName);
if (!app.Environment.IsDevelopment())
{
// 배포 완료 알림을 백그라운드에서 비동기 전송 (앱 시작 블록 방지)
_ = Task.Run(async () =>
{
try
{
using (var scope = app.Services.CreateScope())
{
var telegramService = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
await telegramService.SendInfoAsync(
"✅ 배포 완료",
$"환경: {app.Environment.EnvironmentName}\n상태: 정상 운영 중");
}
}
catch (Exception ex)
{
Log.Error(ex, "배포 완료 알림 전송 실패");
}
});
}
app.Run();
}
catch (Exception ex)
@@ -14,15 +14,24 @@ public interface IConsultingActivityBrowserClient
Task DeleteAsync(int id, CancellationToken ct = default);
}
public class ConsultingActivityBrowserClient(HttpClient httpClient, ILogger<ConsultingActivityBrowserClient> logger)
public class ConsultingActivityBrowserClient(HttpClient httpClient, ITokenStore tokenStore, ILogger<ConsultingActivityBrowserClient> logger)
: IConsultingActivityBrowserClient
{
private const string BaseUrl = "/api/consultingactivity";
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(tokenStore.AccessToken))
httpClient.DefaultRequestHeaders.Authorization = new("Bearer", tokenStore.AccessToken);
else
httpClient.DefaultRequestHeaders.Authorization = null;
}
public async Task<List<ConsultingActivity>> GetAllAsync(CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<ConsultingActivity>>($"{BaseUrl}", ct) ?? [];
}
catch (Exception ex)
@@ -36,6 +45,7 @@ public class ConsultingActivityBrowserClient(HttpClient httpClient, ILogger<Cons
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<ConsultingActivity>>($"{BaseUrl}/client/{clientId}", ct) ?? [];
}
catch (Exception ex)
@@ -49,6 +59,7 @@ public class ConsultingActivityBrowserClient(HttpClient httpClient, ILogger<Cons
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/pending-followups", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<ConsultingActivity>>(data.GetRawText()) ?? [];
@@ -66,6 +77,7 @@ public class ConsultingActivityBrowserClient(HttpClient httpClient, ILogger<Cons
{
try
{
EnsureAuthHeader();
var request = new { clientId, activityType, activityDate, description, consultantId, nextFollowupDate };
var response = await httpClient.PostAsJsonAsync(BaseUrl, request, ct);
response.EnsureSuccessStatusCode();
@@ -83,6 +95,7 @@ public class ConsultingActivityBrowserClient(HttpClient httpClient, ILogger<Cons
{
try
{
EnsureAuthHeader();
var request = new { outcome, nextFollowupDate };
var response = await httpClient.PutAsJsonAsync($"{BaseUrl}/{id}", request, ct);
response.EnsureSuccessStatusCode();
@@ -97,6 +110,7 @@ public class ConsultingActivityBrowserClient(HttpClient httpClient, ILogger<Cons
{
try
{
EnsureAuthHeader();
var response = await httpClient.DeleteAsync($"{BaseUrl}/{id}", ct);
response.EnsureSuccessStatusCode();
}
@@ -16,15 +16,24 @@ public interface IContractBrowserClient
Task DeleteAsync(int id, CancellationToken ct = default);
}
public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowserClient> logger)
public class ContractBrowserClient(HttpClient httpClient, ITokenStore tokenStore, ILogger<ContractBrowserClient> logger)
: IContractBrowserClient
{
private const string BaseUrl = "/api/contract";
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(tokenStore.AccessToken))
httpClient.DefaultRequestHeaders.Authorization = new("Bearer", tokenStore.AccessToken);
else
httpClient.DefaultRequestHeaders.Authorization = null;
}
public async Task<List<Contract>> GetAllAsync(CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<Contract>>($"{BaseUrl}", ct) ?? [];
}
catch (Exception ex)
@@ -38,6 +47,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<Contract>($"{BaseUrl}/{id}", ct);
}
catch (Exception ex)
@@ -51,6 +61,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<Contract>>($"{BaseUrl}/client/{clientId}", ct) ?? [];
}
catch (Exception ex)
@@ -64,6 +75,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/active", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<Contract>>(data.GetRawText()) ?? [];
@@ -80,6 +92,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/expiring?daysAhead={daysAhead}", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<Contract>>(data.GetRawText()) ?? [];
@@ -96,6 +109,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/mrr", ct);
if (response.TryGetProperty("mrr", out var mrrValue))
return System.Text.Json.JsonSerializer.Deserialize<decimal>(mrrValue.GetRawText());
@@ -113,6 +127,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
var request = new { clientId, contractNumber, serviceType, startDate, monthlyFee, totalAmount };
var response = await httpClient.PostAsJsonAsync(BaseUrl, request, ct);
response.EnsureSuccessStatusCode();
@@ -130,6 +145,7 @@ public class ContractBrowserClient(HttpClient httpClient, ILogger<ContractBrowse
{
try
{
EnsureAuthHeader();
var response = await httpClient.DeleteAsync($"{BaseUrl}/{id}", ct);
response.EnsureSuccessStatusCode();
}
@@ -16,15 +16,24 @@ public interface IRevenueTrackingBrowserClient
Task DeleteAsync(int id, CancellationToken ct = default);
}
public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<RevenueTrackingBrowserClient> logger)
public class RevenueTrackingBrowserClient(HttpClient httpClient, ITokenStore tokenStore, ILogger<RevenueTrackingBrowserClient> logger)
: IRevenueTrackingBrowserClient
{
private const string BaseUrl = "/api/revenuetracking";
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(tokenStore.AccessToken))
httpClient.DefaultRequestHeaders.Authorization = new("Bearer", tokenStore.AccessToken);
else
httpClient.DefaultRequestHeaders.Authorization = null;
}
public async Task<List<RevenueTracking>> GetAllAsync(CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<RevenueTracking>>($"{BaseUrl}", ct) ?? [];
}
catch (Exception ex)
@@ -38,6 +47,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<RevenueTracking>>($"{BaseUrl}/client/{clientId}", ct) ?? [];
}
catch (Exception ex)
@@ -51,6 +61,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/pending", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<RevenueTracking>>(data.GetRawText()) ?? [];
@@ -67,6 +78,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/monthly?year={year}&month={month}", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<RevenueTracking>>(data.GetRawText()) ?? [];
@@ -83,6 +95,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>(
$"{BaseUrl}/total?startDate={startDate:yyyy-MM-dd}&endDate={endDate:yyyy-MM-dd}", ct);
if (response.TryGetProperty("total", out var totalValue))
@@ -101,6 +114,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
var request = new { clientId, invoiceNumber, invoiceDate, amount, serviceType, dueDate };
var response = await httpClient.PostAsJsonAsync(BaseUrl, request, ct);
response.EnsureSuccessStatusCode();
@@ -118,6 +132,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
var request = new { paymentDate };
var response = await httpClient.PutAsJsonAsync($"{BaseUrl}/{id}/paid", request, ct);
response.EnsureSuccessStatusCode();
@@ -132,6 +147,7 @@ public class RevenueTrackingBrowserClient(HttpClient httpClient, ILogger<Revenue
{
try
{
EnsureAuthHeader();
var response = await httpClient.DeleteAsync($"{BaseUrl}/{id}", ct);
response.EnsureSuccessStatusCode();
}
@@ -15,15 +15,24 @@ public interface ITaxFilingScheduleBrowserClient
Task DeleteAsync(int id, CancellationToken ct = default);
}
public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFilingScheduleBrowserClient> logger)
public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ITokenStore tokenStore, ILogger<TaxFilingScheduleBrowserClient> logger)
: ITaxFilingScheduleBrowserClient
{
private const string BaseUrl = "/api/taxfilingschedule";
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(tokenStore.AccessToken))
httpClient.DefaultRequestHeaders.Authorization = new("Bearer", tokenStore.AccessToken);
else
httpClient.DefaultRequestHeaders.Authorization = null;
}
public async Task<List<TaxFilingSchedule>> GetAllAsync(CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<TaxFilingSchedule>>($"{BaseUrl}", ct) ?? [];
}
catch (Exception ex)
@@ -37,6 +46,7 @@ public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFi
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<TaxFilingSchedule>($"{BaseUrl}/{id}", ct);
}
catch (Exception ex)
@@ -50,6 +60,7 @@ public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFi
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<TaxFilingSchedule>>($"{BaseUrl}/client/{clientId}", ct) ?? [];
}
catch (Exception ex)
@@ -63,6 +74,7 @@ public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFi
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/upcoming?daysAhead={daysAhead}", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<TaxFilingSchedule>>(data.GetRawText()) ?? [];
@@ -80,6 +92,7 @@ public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFi
{
try
{
EnsureAuthHeader();
var request = new { clientId, filingType, dueDate, filingYear, assignedTo };
var response = await httpClient.PostAsJsonAsync(BaseUrl, request, ct);
response.EnsureSuccessStatusCode();
@@ -97,6 +110,7 @@ public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFi
{
try
{
EnsureAuthHeader();
var response = await httpClient.PutAsJsonAsync($"{BaseUrl}/{id}/complete", new { }, ct);
response.EnsureSuccessStatusCode();
}
@@ -110,6 +124,7 @@ public class TaxFilingScheduleBrowserClient(HttpClient httpClient, ILogger<TaxFi
{
try
{
EnsureAuthHeader();
var response = await httpClient.DeleteAsync($"{BaseUrl}/{id}", ct);
response.EnsureSuccessStatusCode();
}
@@ -17,14 +17,23 @@ public interface ITaxProfileBrowserClient
Task DeleteAsync(int id, CancellationToken ct = default);
}
public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBrowserClient> logger) : ITaxProfileBrowserClient
public class TaxProfileBrowserClient(HttpClient httpClient, ITokenStore tokenStore, ILogger<TaxProfileBrowserClient> logger) : ITaxProfileBrowserClient
{
private const string BaseUrl = "/api/taxprofile";
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(tokenStore.AccessToken))
httpClient.DefaultRequestHeaders.Authorization = new("Bearer", tokenStore.AccessToken);
else
httpClient.DefaultRequestHeaders.Authorization = null;
}
public async Task<List<TaxProfile>> GetAllAsync(CancellationToken ct = default)
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<TaxProfile>>($"{BaseUrl}", ct) ?? [];
}
catch (Exception ex)
@@ -38,6 +47,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<TaxProfile>($"{BaseUrl}/{id}", ct);
}
catch (Exception ex)
@@ -51,6 +61,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
return await httpClient.GetFromJsonAsync<List<TaxProfile>>($"{BaseUrl}/client/{clientId}", ct) ?? [];
}
catch (Exception ex)
@@ -64,6 +75,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/high-risk", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<TaxProfile>>(data.GetRawText()) ?? [];
@@ -80,6 +92,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
var response = await httpClient.GetFromJsonAsync<JsonElement>($"{BaseUrl}/upcoming-filings?daysAhead={daysAhead}", ct);
if (response.TryGetProperty("data", out var data))
return System.Text.Json.JsonSerializer.Deserialize<List<TaxProfile>>(data.GetRawText()) ?? [];
@@ -97,6 +110,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
var request = new { clientId, businessType, businessRegistration, accountingMethod, establishmentDate };
var response = await httpClient.PostAsJsonAsync(BaseUrl, request, ct);
response.EnsureSuccessStatusCode();
@@ -115,6 +129,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
var request = new { businessType, accountingMethod, nextFilingDueDate, taxRiskLevel };
var response = await httpClient.PutAsJsonAsync($"{BaseUrl}/{id}", request, ct);
response.EnsureSuccessStatusCode();
@@ -129,6 +144,7 @@ public class TaxProfileBrowserClient(HttpClient httpClient, ILogger<TaxProfileBr
{
try
{
EnsureAuthHeader();
var response = await httpClient.DeleteAsync($"{BaseUrl}/{id}", ct);
response.EnsureSuccessStatusCode();
}
+3 -3
View File
@@ -33,10 +33,10 @@ public class AdminDashboardClient : IAdminDashboardClient
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken) && !_http.DefaultRequestHeaders.Contains("Authorization"))
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
}
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<AdminDashboardSummary> GetSummaryAsync(CancellationToken ct = default)
@@ -29,10 +29,10 @@ public class AnnouncementBrowserClient : IAnnouncementBrowserClient
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken) && !_http.DefaultRequestHeaders.Contains("Authorization"))
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
}
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<IEnumerable<Announcement>> GetAllAsync(CancellationToken ct = default)
+3 -3
View File
@@ -34,10 +34,10 @@ public class ClientBrowserClient : IClientBrowserClient
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken) && !_http.DefaultRequestHeaders.Contains("Authorization"))
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
}
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<(IEnumerable<Client> Items, int Total)> GetPagedAsync(
@@ -32,21 +32,22 @@ public class CustomAuthenticationStateProvider : AuthenticationStateProvider
// TokenStore가 비어있으면 localStorage에서 복원 (페이지 리로드 후)
if (string.IsNullOrEmpty(accessToken))
{
accessToken = await _localStorage.GetItemAsStringAsync("accessToken");
if (!string.IsNullOrEmpty(accessToken))
var storedToken = await _localStorage.GetItemAsStringAsync("accessToken");
if (!string.IsNullOrEmpty(storedToken))
{
var refreshToken = await _localStorage.GetItemAsStringAsync("refreshToken");
var ticksStr = await _localStorage.GetItemAsStringAsync("tokenExpiry");
if (long.TryParse(ticksStr, out var ticks))
{
_tokenStore.AccessToken = accessToken;
_tokenStore.AccessToken = storedToken;
_tokenStore.RefreshToken = refreshToken;
_tokenStore.TokenExpiryTicks = ticks;
accessToken = storedToken;
}
}
}
if (string.IsNullOrEmpty(accessToken))
if (string.IsNullOrEmpty(_tokenStore.AccessToken))
{
return new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity()));
}
+3 -3
View File
@@ -28,10 +28,10 @@ public class FaqBrowserClient : IFaqBrowserClient
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken) && !_http.DefaultRequestHeaders.Contains("Authorization"))
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
}
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<IEnumerable<Faq>> GetAllAsync(CancellationToken ct = default)
+3 -3
View File
@@ -33,10 +33,10 @@ public class InquiryBrowserClient : IInquiryBrowserClient
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken) && !_http.DefaultRequestHeaders.Contains("Authorization"))
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
}
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<(IEnumerable<Inquiry> Items, int Total)> GetPagedAsync(
@@ -1,72 +0,0 @@
namespace TaxBaik.Web.Services;
/// <summary>
/// Notification service for real-time admin updates
/// SOLID: Single Responsibility - Event notification only
/// Uses Blazor Server's built-in SignalR for real-time communication
/// </summary>
public interface INotificationService
{
event Func<int, string, Task>? OnInquiryStatusChanged;
event Func<int, string, Task>? OnInquiryCreated;
event Func<int, string, Task>? OnClientCreated;
event Func<int, string, Task>? OnAnnouncementPublished;
event Func<int, string, Task>? OnFilingCompleted;
Task TriggerInquiryStatusChanged(int inquiryId, string status);
Task TriggerInquiryCreated(int inquiryId, string name);
Task TriggerClientCreated(int clientId, string name);
Task TriggerAnnouncementPublished(int announcementId, string title);
Task TriggerFilingCompleted(int filingId, string filingType);
}
public class NotificationService : INotificationService
{
private readonly ILogger<NotificationService> _logger;
public NotificationService(ILogger<NotificationService> logger)
{
_logger = logger;
}
public event Func<int, string, Task>? OnInquiryStatusChanged;
public event Func<int, string, Task>? OnInquiryCreated;
public event Func<int, string, Task>? OnClientCreated;
public event Func<int, string, Task>? OnAnnouncementPublished;
public event Func<int, string, Task>? OnFilingCompleted;
public async Task TriggerInquiryStatusChanged(int inquiryId, string status)
{
_logger.LogInformation($"Inquiry {inquiryId} status changed to {status}");
if (OnInquiryStatusChanged != null)
await OnInquiryStatusChanged(inquiryId, status);
}
public async Task TriggerInquiryCreated(int inquiryId, string name)
{
_logger.LogInformation($"New inquiry {inquiryId} from {name}");
if (OnInquiryCreated != null)
await OnInquiryCreated(inquiryId, name);
}
public async Task TriggerClientCreated(int clientId, string name)
{
_logger.LogInformation($"New client {clientId}: {name}");
if (OnClientCreated != null)
await OnClientCreated(clientId, name);
}
public async Task TriggerAnnouncementPublished(int announcementId, string title)
{
_logger.LogInformation($"Announcement {announcementId} published: {title}");
if (OnAnnouncementPublished != null)
await OnAnnouncementPublished(announcementId, title);
}
public async Task TriggerFilingCompleted(int filingId, string filingType)
{
_logger.LogInformation($"Filing {filingId} ({filingType}) completed");
if (OnFilingCompleted != null)
await OnFilingCompleted(filingId, filingType);
}
}
@@ -32,10 +32,10 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
private void EnsureAuthHeader()
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken) && !_http.DefaultRequestHeaders.Contains("Authorization"))
{
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
_http.DefaultRequestHeaders.Authorization = new("Bearer", _tokenStore.AccessToken);
}
else
_http.DefaultRequestHeaders.Authorization = null;
}
public async Task<IEnumerable<TaxFiling>> GetUpcomingAsync(int daysAhead = 30, CancellationToken ct = default)
@@ -44,7 +44,7 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
{
EnsureAuthHeader();
var result = await _http.GetFromJsonAsync<TaxFilingListResponse>(
$"tax-filing/upcoming?daysAhead={daysAhead}", cancellationToken: ct);
$"taxfiling/upcoming?daysAhead={daysAhead}", cancellationToken: ct);
return result?.Data ?? [];
}
catch (HttpRequestException ex)
@@ -60,7 +60,7 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
{
EnsureAuthHeader();
var result = await _http.GetFromJsonAsync<TaxFilingListResponse>(
$"tax-filing/client/{clientId}", cancellationToken: ct);
$"taxfiling/client/{clientId}", cancellationToken: ct);
return result?.Data ?? [];
}
catch (HttpRequestException ex)
@@ -76,7 +76,7 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
{
EnsureAuthHeader();
return await _http.GetFromJsonAsync<TaxFiling>(
$"tax-filing/{id}", cancellationToken: ct);
$"taxfiling/{id}", cancellationToken: ct);
}
catch (HttpRequestException ex)
{
@@ -90,7 +90,7 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
try
{
EnsureAuthHeader();
var response = await _http.PostAsJsonAsync("tax-filing", filing, cancellationToken: ct);
var response = await _http.PostAsJsonAsync("taxfiling", filing, cancellationToken: ct);
if (!response.IsSuccessStatusCode)
return null;
@@ -111,7 +111,7 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
try
{
EnsureAuthHeader();
var response = await _http.PutAsJsonAsync($"tax-filing/{id}", filing, cancellationToken: ct);
var response = await _http.PutAsJsonAsync($"taxfiling/{id}", filing, cancellationToken: ct);
if (!response.IsSuccessStatusCode)
return null;
@@ -132,7 +132,7 @@ public class TaxFilingBrowserClient : ITaxFilingBrowserClient
try
{
EnsureAuthHeader();
var response = await _http.DeleteAsync($"tax-filing/{id}", cancellationToken: ct);
var response = await _http.DeleteAsync($"taxfiling/{id}", cancellationToken: ct);
return response.IsSuccessStatusCode;
}
catch (HttpRequestException ex)
@@ -13,6 +13,7 @@ public interface ITelegramNotificationService
Task SendInfoAsync(string title, string message, CancellationToken ct = default);
Task SendInquiryNotificationAsync(string message, CancellationToken ct = default);
Task SendSystemNotificationAsync(string message, CancellationToken ct = default);
Task SendReportAsync(string reportTitle, string reportContent, CancellationToken ct = default);
}
public class TelegramNotificationService : ITelegramNotificationService
@@ -96,4 +97,10 @@ public class TelegramNotificationService : ITelegramNotificationService
var text = $"<b>️ {title}</b>\n\n{message}\n\n<i>{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC</i>";
await SendMessageAsync(text, ct);
}
public async Task SendReportAsync(string reportTitle, string reportContent, CancellationToken ct = default)
{
var text = $"<b>📊 {reportTitle}</b>\n\n{reportContent}\n\n<i>{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC</i>";
await SendToChat(_systemChatId, text, ct);
}
}
@@ -48,7 +48,7 @@ public class TelegramReportBackgroundService(
var telegram = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
var report = await reportService.BuildDailyReportAsync(date, ct);
await telegram.SendSystemNotificationAsync(TelegramReportService.FormatDailyMessage(report), ct);
await telegram.SendReportAsync("일간 세무/상담 현황 리포트", TelegramReportService.FormatDailyMessage(report), ct);
_lastDailyReportDate = date;
logger.LogInformation("Daily telegram report sent for {Date}", date);
}
@@ -63,7 +63,7 @@ public class TelegramReportBackgroundService(
var telegram = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
var report = await reportService.BuildWeeklyReportAsync(weekStart, ct);
await telegram.SendSystemNotificationAsync(TelegramReportService.FormatWeeklyMessage(report), ct);
await telegram.SendReportAsync("주간 세무/매출 종합 리포트", TelegramReportService.FormatWeeklyMessage(report), ct);
_lastWeeklyReportWeekStart = weekStart;
logger.LogInformation("Weekly telegram report sent for {WeekStart}", weekStart);
}
+14 -11
View File
@@ -10,12 +10,12 @@ using System.Text.Json;
/// </summary>
public class TokenRefreshHandler : DelegatingHandler
{
private readonly ITokenStore _tokenStore;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<TokenRefreshHandler> _logger;
public TokenRefreshHandler(ITokenStore tokenStore, ILogger<TokenRefreshHandler> logger)
public TokenRefreshHandler(IServiceProvider serviceProvider, ILogger<TokenRefreshHandler> logger)
{
_tokenStore = tokenStore;
_serviceProvider = serviceProvider;
_logger = logger;
}
@@ -23,10 +23,13 @@ public class TokenRefreshHandler : DelegatingHandler
HttpRequestMessage request,
CancellationToken cancellationToken)
{
// 최신 Scoped ITokenStore 실시간 해석 (Scope Capture 차단 및 기존 Blazor 회로 수명 공유)
var tokenStore = Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ITokenStore>(_serviceProvider);
// 요청에 access token 추가
if (!string.IsNullOrEmpty(_tokenStore.AccessToken))
if (!string.IsNullOrEmpty(tokenStore.AccessToken))
{
request.Headers.Authorization = new("Bearer", _tokenStore.AccessToken);
request.Headers.Authorization = new("Bearer", tokenStore.AccessToken);
}
var response = await base.SendAsync(request, cancellationToken);
@@ -34,15 +37,15 @@ public class TokenRefreshHandler : DelegatingHandler
// 401 응답이면 토큰 갱신 시도
if (response.StatusCode == HttpStatusCode.Unauthorized)
{
if (!string.IsNullOrEmpty(_tokenStore.RefreshToken))
if (!string.IsNullOrEmpty(tokenStore.RefreshToken))
{
var newTokenPair = await RefreshTokenAsync(_tokenStore.RefreshToken, request, cancellationToken);
var newTokenPair = await RefreshTokenAsync(tokenStore.RefreshToken, request, cancellationToken);
if (newTokenPair != null)
{
// TokenStore에 토큰 저장
_tokenStore.AccessToken = newTokenPair.AccessToken;
_tokenStore.RefreshToken = newTokenPair.RefreshToken;
_tokenStore.TokenExpiryTicks = DateTime.UtcNow.AddSeconds(newTokenPair.ExpiresIn).Ticks;
tokenStore.AccessToken = newTokenPair.AccessToken;
tokenStore.RefreshToken = newTokenPair.RefreshToken;
tokenStore.TokenExpiryTicks = DateTime.UtcNow.AddSeconds(newTokenPair.ExpiresIn).Ticks;
// 새 토큰으로 재요청
request.Headers.Authorization = new("Bearer", newTokenPair.AccessToken);
@@ -51,7 +54,7 @@ public class TokenRefreshHandler : DelegatingHandler
else
{
_logger.LogWarning("토큰 갱신 실패 - 로그아웃");
_tokenStore.Clear();
tokenStore.Clear();
}
}
}
+140 -43
View File
@@ -411,11 +411,41 @@ textarea:focus-visible {
background-color: var(--bg-secondary);
}
.admin-shell .mud-typography--h4 {
font-size: 1.35rem;
line-height: 1.2;
}
.admin-shell .mud-typography--h6 {
font-size: 0.88rem;
line-height: 1.2;
}
.admin-shell .mud-typography--subtitle1 {
font-size: 0.82rem;
line-height: 1.3;
}
.admin-shell .mud-typography--body1 {
font-size: 0.82rem;
line-height: 1.4;
}
.admin-shell .mud-typography--body2 {
font-size: 0.75rem;
line-height: 1.35;
}
.admin-shell .mud-typography--caption {
font-size: 0.68rem;
line-height: 1.2;
}
.admin-topbar {
display: flex;
align-items: center;
gap: var(--space-4);
padding: var(--space-3) var(--space-6);
gap: 12px;
padding: 6px 16px;
background-color: var(--bg-primary);
border-bottom: 1px solid var(--border-color);
z-index: var(--z-dropdown);
@@ -429,21 +459,33 @@ textarea:focus-visible {
.admin-topbar-title {
display: flex;
flex-direction: column;
gap: var(--space-1);
gap: 0;
}
.admin-topbar-title span {
color: var(--text-primary);
}
.admin-topbar-title .mud-typography--h6 {
font-size: 0.85rem;
line-height: 1.15;
font-weight: var(--font-weight-semibold);
}
.admin-topbar-action {
white-space: nowrap;
min-height: 40px;
padding: var(--space-2) var(--space-4);
min-height: 32px;
padding: 4px 10px;
font-size: 0.8rem;
}
.admin-shell .mud-button-root {
min-height: 32px;
font-size: 0.8rem;
}
.admin-drawer {
width: 280px;
width: 208px;
background-color: var(--bg-primary);
border-right: 1px solid var(--border-color);
display: flex;
@@ -453,8 +495,8 @@ textarea:focus-visible {
.admin-drawer-brand {
display: flex;
align-items: center;
gap: var(--space-3);
padding: var(--space-5) var(--space-4);
gap: 10px;
padding: 10px 12px;
border-bottom: 1px solid var(--border-color-light);
}
@@ -462,29 +504,39 @@ textarea:focus-visible {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
width: 36px;
height: 36px;
border-radius: var(--radius-md);
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
color: var(--primary-contrast);
font-weight: var(--font-weight-bold);
font-size: 1.125rem;
font-size: 1rem;
flex-shrink: 0;
}
.admin-nav {
padding: var(--space-4) 0;
padding: 4px 0;
flex: 1;
overflow-y: auto;
}
.admin-nav .mud-nav-link,
.admin-nav .mud-nav-group-header {
margin: var(--space-1) var(--space-2) !important;
border-radius: var(--radius-md) !important;
margin: 1px 6px !important;
border-radius: 6px !important;
transition: all var(--transition-base) !important;
}
.admin-nav .mud-nav-link {
min-height: 32px;
font-size: 0.78rem;
}
.admin-nav .mud-nav-group-header {
min-height: 32px;
font-size: 0.78rem;
}
.admin-nav .mud-nav-link:hover {
background-color: var(--primary-light) !important;
}
@@ -526,7 +578,7 @@ textarea:focus-visible {
}
.admin-content {
padding: var(--space-8);
padding: 16px;
max-width: 1400px;
margin: 0 auto;
width: 100%;
@@ -540,9 +592,9 @@ textarea:focus-visible {
display: flex;
justify-content: space-between;
align-items: center;
gap: var(--space-6);
margin-bottom: var(--space-8);
padding-bottom: var(--space-6);
gap: 16px;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 1px solid var(--border-color);
}
@@ -555,8 +607,8 @@ textarea:focus-visible {
color: var(--primary-color);
font-weight: var(--font-weight-semibold);
text-transform: uppercase;
font-size: var(--font-size-xs);
letter-spacing: 0.5px;
font-size: 0.7rem;
letter-spacing: 0;
margin-bottom: var(--space-1);
}
@@ -564,31 +616,31 @@ textarea:focus-visible {
display: block;
color: var(--text-primary);
font-weight: var(--font-weight-semibold);
margin-bottom: var(--space-3);
font-size: var(--font-size-3xl);
margin-bottom: 2px;
font-size: 1.45rem;
line-height: var(--line-height-tight);
}
.admin-page-subtitle {
display: block;
color: var(--text-secondary);
font-size: var(--font-size-base);
line-height: var(--line-height-normal);
font-size: 0.8rem;
line-height: 1.35;
}
/* Metrics Grid */
.admin-metric-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: var(--space-6);
margin-bottom: var(--space-8);
gap: var(--space-4);
margin-bottom: var(--space-6);
width: 100%;
}
/* Metric Card - Enterprise Grade */
.admin-metric-card {
padding: var(--space-6);
border-radius: var(--radius-lg);
padding: 10px;
border-radius: var(--radius-md);
background-color: var(--bg-primary);
border: 1px solid var(--border-color);
transition: all var(--transition-base);
@@ -596,12 +648,52 @@ textarea:focus-visible {
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: 160px;
min-height: 116px;
box-shadow: var(--shadow-xs);
position: relative;
overflow: hidden;
}
.admin-metric-card-body {
display: flex;
flex-direction: column;
gap: 8px;
height: 100%;
}
.admin-metric-card-label {
font-size: 0.68rem;
color: var(--text-tertiary);
text-transform: uppercase;
font-weight: var(--font-weight-semibold);
}
.admin-metric-card-value-row {
display: flex;
justify-content: space-between;
align-items: center;
flex: 1;
gap: 8px;
}
.admin-metric-card-value {
font-size: 1.45rem;
font-weight: var(--font-weight-bold);
line-height: 1;
}
.admin-metric-card-icon {
font-size: 1.9rem;
opacity: 0.14;
line-height: 1;
}
.admin-metric-card-caption {
font-size: 0.78rem;
color: var(--text-secondary);
line-height: 1.3;
}
.admin-metric-card::before {
content: '';
position: absolute;
@@ -675,11 +767,11 @@ textarea:focus-visible {
/* Surfaces & Containers */
.admin-surface {
padding: var(--space-6) !important;
border-radius: var(--radius-lg) !important;
padding: 10px !important;
border-radius: var(--radius-md) !important;
background-color: var(--bg-primary) !important;
border: 1px solid var(--border-color) !important;
margin-bottom: var(--space-6) !important;
margin-bottom: 10px !important;
box-shadow: var(--shadow-xs);
}
@@ -687,9 +779,9 @@ textarea:focus-visible {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: var(--space-4);
margin-bottom: var(--space-5);
padding-bottom: var(--space-4);
gap: 10px;
margin-bottom: 10px;
padding-bottom: 6px;
border-bottom: 1px solid var(--border-color-light);
}
@@ -698,14 +790,14 @@ textarea:focus-visible {
}
.admin-section-header h6 {
font-size: var(--font-size-lg);
font-size: 0.85rem;
font-weight: var(--font-weight-semibold);
color: var(--text-primary);
margin-bottom: var(--space-2);
margin-bottom: 2px;
}
.admin-section-header p {
font-size: var(--font-size-sm);
font-size: 0.75rem;
color: var(--text-secondary);
margin: 0;
}
@@ -714,7 +806,7 @@ textarea:focus-visible {
.admin-table {
width: 100%;
border-collapse: collapse;
font-size: var(--font-size-sm);
font-size: 0.75rem;
}
.admin-table thead {
@@ -723,13 +815,13 @@ textarea:focus-visible {
}
.admin-table thead th {
padding: var(--space-3) var(--space-4);
padding: 5px 8px;
text-align: left;
font-weight: var(--font-weight-semibold);
color: var(--text-secondary);
font-size: var(--font-size-xs);
font-size: 0.65rem;
text-transform: uppercase;
letter-spacing: 0.5px;
letter-spacing: 0;
}
.admin-table tbody tr {
@@ -746,11 +838,16 @@ textarea:focus-visible {
}
.admin-table tbody td {
padding: var(--space-3) var(--space-4);
padding: 5px 8px;
color: var(--text-primary);
vertical-align: middle;
}
.admin-table .mud-chip {
font-size: 0.68rem;
height: 22px;
}
.admin-table tbody a {
color: var(--primary-color);
text-decoration: none;
+4
View File
@@ -5,6 +5,10 @@ window.taxbaikAdminSession = {
window.location.pathname.toLowerCase().endsWith('/admin/login'));
},
getViewportWidth: function () {
return window.innerWidth || document.documentElement.clientWidth || 0;
},
clearAuthToken: function () {
try {
localStorage.removeItem('auth_token');
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- 메인 홈 -->
<url>
<loc>http://178.104.200.7/taxbaik/</loc>
<lastmod>2026-06-29</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<!-- 고객 포털 -->
<url>
<loc>http://178.104.200.7/taxbaik/portal</loc>
<lastmod>2026-06-29</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
<!-- 이용약관 -->
<url>
<loc>http://178.104.200.7/taxbaik/terms</loc>
<lastmod>2026-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.3</priority>
</url>
<!-- 개인정보처리방침 -->
<url>
<loc>http://178.104.200.7/taxbaik/privacy</loc>
<lastmod>2026-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.3</priority>
</url>
</urlset>
+72 -37
View File
@@ -6,6 +6,8 @@ const password = process.env.E2E_ADMIN_PASSWORD;
const baseUrl = (process.env.E2E_BASE_URL ?? 'http://178.104.200.7/taxbaik').replace(/\/$/, '');
test.describe('admin CRM pages', () => {
test.describe.configure({ mode: 'serial' });
test.beforeEach(async ({ page }) => {
test.skip(!password, 'E2E_ADMIN_PASSWORD is required.');
await loginThroughAdminUi(page, baseUrl, username, password);
@@ -15,75 +17,55 @@ test.describe('admin CRM pages', () => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`);
await expect(page).toHaveURL(/\/admin\/tax-profiles$/);
// 제목 확인
await expect(page.getByText('세무 프로필 관리')).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-page-title')).toHaveText('세무 프로필', { timeout: 15_000 });
// 새 프로필 추가 버튼 확인
await expect(page.getByRole('button', { name: /새 프로필 추가/ })).toBeVisible();
// MudDataGrid 로드 확인 (테이블 or 비어있음 메시지)
const gridOrEmpty = page.locator('.admin-grid, .mud-alert');
await expect(gridOrEmpty).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
});
test('TaxFilingSchedules page loads with D-day tracking', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-filing-schedules`);
await expect(page).toHaveURL(/\/admin\/tax-filing-schedules$/);
// 제목 확인
await expect(page.getByText('신고 일정 관리')).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-page-title')).toHaveText('신고 일정', { timeout: 15_000 });
// 새 일정 추가 버튼
await expect(page.getByRole('button', { name: /새 일정 추가/ })).toBeVisible();
// 그리드 로드
const gridOrEmpty = page.locator('.admin-grid, .mud-alert');
await expect(gridOrEmpty).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
});
test('Contracts page loads with MRR display', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/contracts`);
await expect(page).toHaveURL(/\/admin\/contracts$/);
// 제목 확인
await expect(page.getByText('계약 관리')).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-page-title')).toHaveText('계약 관리', { timeout: 15_000 });
// 새 계약 추가 버튼
await expect(page.getByRole('button', { name: /새 계약 추가/ })).toBeVisible();
// 그리드 로드
const gridOrEmpty = page.locator('.admin-grid, .mud-alert');
await expect(gridOrEmpty).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
});
test('ConsultingActivities page loads with activity records', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/consulting-activities`);
await expect(page).toHaveURL(/\/admin\/consulting-activities$/);
// 제목 확인
await expect(page.getByText('상담 활동 관리')).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-page-title')).toHaveText('상담 활동 관리', { timeout: 15_000 });
// 새 활동 기록 버튼
await expect(page.getByRole('button', { name: /새 활동 기록/ })).toBeVisible();
// 그리드 로드
const gridOrEmpty = page.locator('.admin-grid, .mud-alert');
await expect(gridOrEmpty).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
});
test('RevenueTrackings page loads with payment status tracking', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/revenue-trackings`);
await expect(page).toHaveURL(/\/admin\/revenue-trackings$/);
// 제목 확인
await expect(page.getByText('수익 추적 관리')).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-page-title')).toHaveText('수익 추적 관리', { timeout: 15_000 });
// 새 청구 추가 버튼
await expect(page.getByRole('button', { name: /새 청구 추가/ })).toBeVisible();
// 그리드 로드
const gridOrEmpty = page.locator('.admin-grid, .mud-alert');
await expect(gridOrEmpty).toBeVisible({ timeout: 15_000 });
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15_000 });
});
test('CRM navigation group is visible and expandable', async ({ page }) => {
@@ -111,15 +93,11 @@ test.describe('admin CRM pages', () => {
test('TaxProfiles modal dialog opens on add button click', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`);
// 추가 버튼 클릭
const addButton = page.getByRole('button', { name: /새 프로필 추가/ });
await expect(addButton).toBeVisible();
await addButton.click();
// 모달 열림 확인 (취소 버튼이 나타나야 함)
await expect(page.getByRole('button', { name: '취소' }).first()).toBeVisible({ timeout: 5_000 });
// 모달 폼 필드 확인
await expect(page.locator('input[aria-label*="고객"]').or(page.locator('select'))).toBeVisible({ timeout: 5_000 });
await expect(page).toHaveURL(/\/taxbaik\/admin\/tax-profiles$/);
await expect(addButton).toBeVisible();
});
test('No console errors on CRM page navigation', async ({ page }) => {
@@ -145,4 +123,61 @@ test.describe('admin CRM pages', () => {
expect(consoleErrors, 'no console errors during CRM navigation').toEqual([]);
});
test('TaxProfiles form displays valid business type combo choices', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-profiles`);
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15000 });
const addButton = page.getByRole('button', { name: /새 프로필 추가/ });
// JS 네이티브 클릭으로 강제 격발하여 오프셋 씹힘 소멸
await addButton.evaluate(el => (el as HTMLButtonElement).click());
// 대화상자(MudDialog) 자체의 노출 대기
await expect(page.locator('.mud-dialog')).toBeVisible({ timeout: 5000 });
// mud-select 컨테이너 자체 클릭 (이벤트 핸들러 직접 격발)
const select = page.locator('.mud-select').filter({ hasText: '사업 유형' }).first();
await select.evaluate(el => (el as HTMLDivElement).click());
// 활성화된 팝오버(.mud-popover-open) 내에서 텍스트 노출 검증
const popover = page.locator('.mud-popover-open');
await expect(popover.getByText('일반제조업')).toBeVisible({ timeout: 5000 });
await expect(popover.getByText('도소매업')).toBeVisible({ timeout: 5000 });
await expect(popover.getByText('서비스업')).toBeVisible({ timeout: 5000 });
});
test('TaxFilingSchedules form displays filing type combo choices', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/tax-filing-schedules`);
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15000 });
const addButton = page.getByRole('button', { name: /새 일정 추가/ });
await addButton.evaluate(el => (el as HTMLButtonElement).click());
await expect(page.locator('.mud-dialog')).toBeVisible({ timeout: 5000 });
const select = page.locator('.mud-select').filter({ hasText: '신고 유형' }).first();
await select.evaluate(el => (el as HTMLDivElement).click());
const popover = page.locator('.mud-popover-open');
await expect(popover.getByText('종합소득세')).toBeVisible({ timeout: 5000 });
await expect(popover.getByText('부가가치세')).toBeVisible({ timeout: 5000 });
});
test('Contracts form displays service type combo choices', async ({ page }) => {
await navigateInBlazor(page, `${baseUrl}/admin/contracts`);
await expect(page.locator('.admin-grid, .mud-alert')).toBeVisible({ timeout: 15000 });
const addButton = page.getByRole('button', { name: /새 계약 추가/ });
await addButton.evaluate(el => (el as HTMLButtonElement).click());
await expect(page.locator('.mud-dialog')).toBeVisible({ timeout: 5000 });
const select = page.locator('.mud-select').filter({ hasText: '서비스 유형' }).first();
await select.evaluate(el => (el as HTMLDivElement).click());
const popover = page.locator('.mud-popover-open');
await expect(popover.getByText('개인 기장대리')).toBeVisible({ timeout: 5000 });
await expect(popover.getByText('법인 기장대리')).toBeVisible({ timeout: 5000 });
});
});
+1 -1
View File
@@ -27,7 +27,7 @@ test.describe('admin authentication', () => {
await page.getByRole('button', { name: '로그인' }).click();
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/);
await expect(page.getByRole('heading', { name: '대시보드' })).toBeVisible({ timeout: 20_000 });
await expect(page.getByRole('heading', { name: '대시보드' }).first()).toBeVisible({ timeout: 20_000 });
await expect(page.getByRole('link', { name: /로그아웃/ })).toBeVisible();
expect(consoleErrors, 'browser console/page errors').toEqual([]);
});
+2
View File
@@ -16,6 +16,7 @@ test.describe('contact submit', () => {
email: `public-${stamp}@example.com`,
serviceType: '기타',
message: 'Playwright로 전송한 공개 문의 테스트입니다.',
suppressNotification: true,
},
});
expect(createResponse.ok()).toBeTruthy();
@@ -39,6 +40,7 @@ test.describe('contact submit', () => {
email,
serviceType: '기타',
message,
suppressNotification: true,
},
});
expect(createResponse.ok()).toBeTruthy();
+25 -2
View File
@@ -24,7 +24,14 @@ export async function getAdminToken(
}
export async function installAdminToken(page: Page, token: string) {
await page.addInitScript(value => localStorage.setItem('auth_token', value), token);
await page.addInitScript(value => {
localStorage.setItem('accessToken', value);
localStorage.setItem('refreshToken', 'ci-test-refresh-token');
// Calculate C# Ticks for 1 hour from now: (JS_ms * 10000) + 621355968000000000
const expiryMs = Date.now() + 3600 * 1000;
const ticks = (expiryMs * 10000) + 621355968000000000;
localStorage.setItem('tokenExpiry', ticks.toString());
}, token);
}
export async function loginThroughAdminUi(
@@ -38,7 +45,7 @@ export async function loginThroughAdminUi(
await page.locator('input[placeholder="비밀번호"]').fill(password);
await page.getByRole('button', { name: '로그인' }).click();
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/);
await expect(page.getByRole('heading', { name: '대시보드' })).toBeVisible({ timeout: 20_000 });
await expect(page.getByRole('heading', { name: '대시보드' }).first()).toBeVisible({ timeout: 20_000 });
}
export async function navigateInBlazor(page: Page, targetUrl: string) {
@@ -51,6 +58,22 @@ export async function navigateInBlazor(page: Page, targetUrl: string) {
window.location.href = url;
}, targetUrl);
// Wait until Blazor Server completes connection and hides the loading spinner overlay
await page.locator('#blazor-loading').waitFor({ state: 'hidden', timeout: 15000 }).catch(() => {});
// Give the SPA router a brief window to unmount the previous page and mount the loading spinner
await page.waitForTimeout(500);
// Also wait for MudBlazor's dynamic loading spinners to disappear (ensuring the grid is interactive)
const spinner = page.locator('.mud-progress-circular, .mud-progress-linear-bar');
try {
if (await spinner.count() > 0) {
await spinner.first().waitFor({ state: 'hidden', timeout: 10000 });
}
} catch (e) {
// Suppress timeout if the spinner was already gone or never showed up
}
}
export async function findInquiryByName(
+7 -4
View File
@@ -20,6 +20,7 @@ test.describe('inquiry detail', () => {
email,
serviceType: '기타',
message,
suppressNotification: true,
},
});
expect(createResponse.ok()).toBeTruthy();
@@ -39,9 +40,11 @@ test.describe('inquiry detail', () => {
await expect(page.getByText(phone, { exact: true }).first()).toBeVisible();
await expect(page.getByText(message, { exact: true }).first()).toBeVisible();
await expect(page.getByRole('button', { name: '신규' })).toBeVisible();
await expect(page.getByRole('button', { name: '연락함' })).toBeVisible();
await expect(page.getByRole('button', { name: '완료' })).toBeVisible();
await expect(page.getByRole('button', { name: '문의 목록으로 돌아가기' })).toBeVisible();
await expect(page.getByRole('link', { name: '다른 문의도 보기' })).toBeVisible();
await expect(page.getByRole('button', { name: '상담중' })).toBeVisible();
await expect(page.getByRole('button', { name: '계약완료' })).toBeVisible();
await expect(page.getByRole('button', { name: '거절' })).toBeVisible();
await expect(page.getByRole('button', { name: '종결' })).toBeVisible();
await expect(page.getByRole('button', { name: '문의 목록으로' })).toBeVisible();
await expect(page.getByRole('button', { name: '고객으로 등록' })).toBeVisible();
});
});
+1
View File
@@ -16,6 +16,7 @@ test.describe('public smoke', () => {
await page.goto(`${baseUrl}/contact`);
await expect(page).toHaveTitle(/상담 신청/);
await expect(page.getByRole('heading', { name: /상담 신청/ })).toBeVisible();
await expect(page.getByRole('link', { name: /뒤로가기/ })).toBeVisible();
await expect(page.getByRole('button', { name: /상담신청/ })).toBeVisible();
});
});