Commit Graph

30 Commits

Author SHA1 Message Date
king a475f0b2f6 feat(inout): 옵션 상품 정보 탭 — 단가·무게(PP)·은 함유량, 발주서·메일 금액, 입고 담당 화면 줄이기
- 마이그레이션 004: inout_products(단가·개당 무게 g·은 함유량 %), inout_products_excluded(지운 단품),
  inout_order_lines 에 발주할 때 값 사본(unit_price·weight_g·silver_pct)
- 옵션 → 상품 정보: [단품 불러오기](값을 넣은 상품은 그대로, 지운 단품은 다음에도 빠짐), 바뀐 줄만 저장,
  은 g = 무게 × % 자동, 지우기·되살리기
- 상품 정보가 있으면 발주서 제품은 그 목록에서(단가 함께), 금액 = 수량 × 단가 실시간 합계
- 발주서 화면(발주 담당)·발주 메일에 단가·금액·PP(g/개)·은 함유량과 합계(금액·PP kg·은 g)
- 입고 담당(발주 담당 아님)은 품목을 제품 이름·발주 수량(+ 이번 입고)만, 입고 기록 칩도 이름
- 고침: 그날 100번째 발주서부터 번호가 겹치던 문제(순번 숫자 비교), 시각을 DB 시간대와 무관하게 KST 로 읽음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:59:45 +09:00
king 451b37955e feat(inout): 발주 메일(발주 담당 본인 Gmail) · 공장 이메일 · 입고증 사진
- inout_db 003: 공장 이메일, 사람별 Gmail 연결(갱신 토큰 암호문만), 발주 메일 기록, 입고증 사진(bytea). init 에도 같게.
- 발주 메일: 새 발주서 저장 → 미리보기 팝업(받는 사람 = 공장 이메일, 요약 표 HTML + 글 본문) → 사람이 [메일 발송]을
  눌러야 Gmail API(gmail.send)로 본인 Gmail 에서 발송. [Gmail 연결]은 사람마다 1회 — 고른 구글 계정 = ERP 계정 확인,
  APP_ENCRYPTION_KEY(AES-GCM, AAD inout:gmail:{email})로 암호화 저장. 보낸 기록, 재발송은 확인 후(resend),
  연결 끊김(invalid_grant)은 토큰 삭제 후 재연결 안내.
- 입고증 사진: 입고 저장 때 첨부(브라우저가 긴 변 2000px JPEG 로 줄임 — 7.9MB → 0.8MB), 10장·10MB, 파일 머리로 형식 검사,
  입고와 한 트랜잭션. 썸네일·크게 보기(←/→)·나중에 더하기·지우기, 보기는 nosniff·CSP sandbox. 초과 확인은 브라우저가 먼저(사진 유지).
- 테스트: 메일 본문·escape·받는 주소·Gmail 연결 검사·토큰 갱신/발송(가짜 구글)·암호화, 사진 검사, 실제 PostgreSQL 저장,
  실제 앱 흐름(사진 업로드·보기 헤더·권한, 메일 미리보기·연결·발송·재발송·끊김). 실제 브라우저로 팝업·사진·축소 확인.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:41:28 +09:00
king 4c17158753 feat(inout): 옵션을 톱니 팝업으로, 겹치던 옵션 화면 정리, 공장 담당자·연락처 분리
- 옵션 탭 → 상단 오른쪽 톱니(관리자) → 팝업(탭: 담당자·공장). 내용은 /inout/settings?panel=1,
  저장은 팝업 안에서(X-Inout-Options: 1 → JSON, 같은 탭 그대로 다시 그림), 바뀌면 닫을 때 새로고침.
  예전 /inout/settings 주소는 목록으로 가서 팝업 열기(?options=1).
- 겹침 원인: 공용 .erp-input(min-width 240px + content-box)이 좁은 칸에서 옆 칸을 덮고,
  .erp-table-wrap(카드 그림자·둥근 모서리)이 카드 안에서 상자를 겹쳐 보이게 함 → .io/.io-dlg 안에서만 바로잡음.
  공장 표는 진짜 <table> + 입력칸 form 속성으로 열 맞춤(줄 선·배경 어긋남 없음).
- 공장 담당자·연락처 분리: inout_db 002(manager 열, 이름만 있던 연락처는 담당자로). 발주서 화면에 공장 담당자·연락처.
  002 미적용이어도 발주서 화면은 열리고 공장 저장만 안내.
- 테스트: 팝업·JSON 저장·예전 주소·권한, 담당자/연락처, 002 전후. 실제 브라우저로 겹침 0·줄 맞춤 확인.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:45:53 +09:00
king 65a1fd1991 docs(inout): DB 생성 명령 — 비밀번호 URL 인코딩·.env 줄 붙음 방지·실제 연결 확인
비밀번호의 @ 등 특수문자가 DSN 을 깨뜨려 /inout/ 이 30초 뒤 500(PoolTimeout)이 된 운영 사례(2026-10-16).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:28:26 +09:00
king 6f3bffd840 feat(inout): 입출고 관리 모듈 — 공장 제작 발주 · 물류 입고 · 미입고/초과 관리
- 새 모듈 app/modules/inout(/inout/, 권한키 inout) + 새 DB inout_db(사용자 승인, scripts/sql/inout_db_init.sql — 멱등).
- 발주 담당이 공장에 발주서(PO-YYMMDD-NN, 제품 = itemcode_db 단품만 — 검색 + 저장 때 서버 재확인),
  입고 담당이 물류에 들어온 수량을 여러 번 나눠 입력 → 품목별 발주·입고·미입고, 진행률, 입고 예정일 지연.
- 미입고 현황: 제품별 합계 · 발주별(예정일 순) · 초과 입고. 잔량 종결/풀기, 입고 없는 발주 취소, 입고 기록 지우기.
- 초과 입고: 확인 화면(409, 입력 유지) 후 [초과 입고로 저장] — 트랜잭션 안에서 발주서 잠그고 판단, Enter 는 일반 저장.
- 옵션(ERP 관리자): 공장 목록, 발주 담당·입고 담당 지정(inout_roles). 관리자는 둘 다.
- 상태는 저장하지 않고 누적 입고로 계산(store.order_status). 이카운트 "발주 대비 미입고"·Odoo 분할 입고/종결 참고.
- 테스트: 순수 로직, 실제 PostgreSQL(앱 계정 inout_app — 권한 포함), 실제 앱 화면 흐름(권한별). 문서 INOUT_MODULE.md 등.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:21:05 +09:00
king 94fac65238 feat(project): Project 옵션 시스템 전체 적용 + 모달 안 말풍선 가림 수정
- 프로젝트 화면(처음 여는 탭)·보드(카드 표지)는 서버 저장(project_db.project_options, 마이그레이션 029)
  → 수퍼관리자·Admin 이 바꾸면 모든 사용자에게 적용. 일반(폰트)은 그대로 이 브라우저(localStorage).
- GET/PUT /project/api/options(쓰기는 Admin 이상, 보낸 키만, 029 미적용 503). 검사·기본값은
  store.normalize/validate_project_options 한 곳. 프로젝트 화면은 data-default-view·data-board-cover 로 받음
  (읽기 실패해도 기본값으로 열림).
- 옵션 창: 열 때 서버 최신값 읽기(실패 시 시스템 칸 잠금·폰트만 저장), 바뀐 키만 PUT, 실패면 창 유지.
  분류 제목 옆 적용 범위 배지(이 브라우저에만 / 모든 사용자에게).
- 공용 말풍선: 모달 대화창(showModal) 안에서는 popover(top layer)로 띄워 대화창 뒤에 가려지지 않게.
- 테스트: tests/test_project_options_api.py, jsdom 옵션 테스트 갱신. 도움말·문서·DEPLOYMENT(029) 갱신.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:29:37 +09:00
king e7b1e17579 feat(performance): 광고비 탭 구글 광고비·ROAS 를 Google Ads API 로 가져오기 + 설정에서 키 입력
- 실적 설정 "광고 API 연동" 카드: 개발자 토큰·고객 ID·로그인 고객 ID(MCC)·서비스 계정 JSON·API 버전(기본 v26)
  → 쇼핑몰과 같은 마스터 키로 암호화(perf_ad_credentials, AAD perf:ad:…), 연결 테스트·상태(perf_ad_source_status)
- ad_sources/(채널 하나 = 파일 하나) + google_ads.py: 서비스 계정 JWT 토큰(httpx) → REST searchStream GAQL,
  비용(cost_micros 원 반올림, 부가세 별도)·ROAS(전환 가치÷비용)·노출·클릭·전환 항목, KRW 계정만, 오류 코드별 안내
- ad_sync.py: 기간 한 트랜잭션 저장(source='api', 안 준 날은 예전 API 값만 지움), 같은 채널 동시 실행 차단, 비밀값 가림
- 광고비 탭 [구글 광고 불러오기](보는 기간, 92일 넘으면 관리자) + 매출 자동 업데이트 회차에 함께, API 값 초록 숫자,
  구글 머리글 = 일자별 항목 표
- 마이그레이션 007, 테스트 test_google_ads.py(가짜 구글 서버) — performance 테스트 83개 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:10:03 +09:00
king e9fb1c3407 feat(performance): 네이버 광고 보고서 업로드(ROAS·보고서 항목) + 머리글 클릭 일자별 상세
- 네이버 업로드: 3열 기간·4열 총비용(광고비)·12열 구매완료 광고수익률(ROAS), 나머지 항목은 metrics(JSONB)
- 네이버·구글·메타 칸 ROAS = 보고서 값(여러 날은 광고비 가중 평균), 쇼핑몰 매출로 계산하지 않음
- 네이버 머리글 클릭 → 지금 기간 일자별 보고서 표 + 합계(GET /api/ad-spend/naver/details)
- performance_db 마이그레이션 006: perf_ad_spend.roas·metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 17:23:11 +09:00
king ef38140673 feat(performance): 광고비 탭(구글·메타·쿠팡 윙/로켓) + 탭 개편·설정 톱니
- 탭: [매출 실적](검정) · [광고비](주황) 큰 탭 + 맨 오른쪽 설정 톱니(Material Symbols settings)
- /performance/ads: 연·월·일 표(채널 × 날짜)·추이·비중·월/연 누적, 매출 대비 광고비 KPI
- 날짜 칸 직접 입력(PUT /api/ad-spend/{channel}/{day}), 쿠팡(로켓) 광고 보고서 업로드
  (CSV/엑셀, 1열 날짜·19열 청구금액(+부가가치세), 잘못된 줄 있으면 전부 거절)
- performance_db 마이그레이션 005 perf_ad_spend
- 설정 화면 쇼핑몰 순서 jsdom 기대값을 003 열 순서로 갱신(기존 실패)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 18:20:44 +09:00
king f36f7d3ad4 feat(project): 담당자는 협업자에서 제외·세부 업무 추가 칸 아이콘·내 업무 오른쪽 창
- 협업자 = 담당자 외의 멤버: add_followers 가 담당자를 거르고, 담당자 지정 시 같은 트랜잭션에서 협업자에서 뺌, 담당자 협업자 추가는 400
- 마이그레이션 028: 이미 겹친 task_followers 행 정리(스키마 변경 없음, 멱등)
- 업무 창 세부 업무 추가 칸: 담당자·협업자·마감일을 동그라미 아이콘 버튼으로, 제목 칸을 넓게
- 내 업무 화면: 줄 클릭 시 화면 이동 없이 오른쪽 업무 창(iframe), 닫으면 목록 다시 받기
- 대시보드 "미완료 업무 합계(섹션별)" 카드 삭제

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 14:24:51 +09:00
king 70bf263a80 feat(performance): rename 네이버 스마트스토어 to 네이버 (migration 004)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:55:34 +09:00
king 6ebf705e27 feat(performance): new marketplace order, 쿠팡(윙) rename, manual-only 쿠팡(로켓)·애터미아자몰
- Column order: 카페24 · 네이버 · 쿠팡(윙) · 쿠팡(로켓) · 오늘의집 · G마켓 · 카카오 ·
  GS샵 · 11번가 · 롯데ON · 토스 · 애터미아자몰 (registry + migration 003 sort_order)
- Existing coupang (WING API) renamed to 쿠팡(윙)
- New manual-only marketplaces coupang_rocket / atomy (adapters/manual.py,
  manual_only flag): skipped by sync_all, no credentials / connection test in
  settings, status "수동 입력", manual input always on (API refuses turning it off)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:35:18 +09:00
king 3882836fd5 feat(project): meeting rows added from the task cell stay in the same item cell (migration 027), in-place redraw with animation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:28:24 +09:00
king 454b3cc700 feat(performance): per-shop manual sales input, column order, bold centered table headers (migration 002)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:26:57 +09:00
king e130bbe577 feat(project): meeting task table - pick an existing task to add a subtask; title opens task panel
- New "작업" column (migration 026 parent_task_id): empty = new task in the section,
  chosen task = register as its subtask (candidates = open main tasks of that section)
- Server validates the task belongs to the project, clears it when the project changes,
  and rejects apply if the chosen task was deleted/moved
- Removed the in-table subtask rows (hover button, Tab/Shift+Tab, right-click) from UI/API
- Registered row title opens the task editor on the right (iframe ?embed=1, waits for the
  task window to save before switching/closing, like the inbox panel)
- Help + docs (DEPLOYMENT 026); tests (real PostgreSQL, jsdom)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:35:18 +09:00
king b7c0f28ad2 fix(project): meeting task table shared per week on the server (others' rows were invisible)
- Cause: the table lived only in each browser's localStorage
- project_db migration 025 goal_meeting_tasks (week_start, parent_id for subtask rows, task_id)
- API list/add/update/delete + apply; apply locks the row and creates the task once via the
  same helper as the task window (_create_task_for: membership, assignee check, notifications)
- Non-members see other people's rows with project/section/task hidden; only member projects
  can be picked; completed meeting is read-only (409)
- Client saves per field, refreshes every 30s / on focus, uploads rows left in this browser once
- Docs (DEPLOYMENT 025, PROJECT_MODULE, help, CLAUDE.md); tests (real PostgreSQL incl. 4
  concurrent applies -> one task, jsdom)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:06:23 +09:00
king 2aa6b6efae feat(notice): urgent notices centered on every ERP screen until acknowledged
- Super admin only: /notice/ page (title, body with images, show time KST, all or picked people,
  preview, edit with optional re-show, cancel/undo, per-person acknowledgement status)
- Shown on every ERP page (erp_base, main, admin) dead center; [확인] only (no Esc/backdrop close),
  queue in order, ack failure keeps the dialog, closes when acked/cancelled elsewhere
- project_db migration 024 (urgent_notices, targets, acks, images as bytea); shares ProjectStore.pool
- Body sanitized like task descriptions, images restricted to /notice/images/{id}, type sniffed
- Entry points: ERP sidebar foot and Project options dialog (super admin)
- Docs (NOTICE_MODULE, DEPLOYMENT 024, overview, CLAUDE.md); tests (DB-less, real PostgreSQL, jsdom)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:07:10 +09:00
king 06af036f86 feat(project): PC tray notifier for mentions and assignments
Windows tray app (desktop/notifier, C# .NET Framework 4.8 WinForms,
single exe, no installer/admin) that shows the same big alert popup as
the web even when the browser is in the background: layered topmost
window that does not steal focus, blinking border, open/close actions,
sound, autostart toggle, DPAPI-encrypted token.

Server side (project_db migration 023):
- notifier_links / notifier_tokens (SHA-256 hashes only)
- device link flow: link/start -> browser approve at /project/notifier
  -> link/poll issues token once
- Bearer API for alerts/read/logout reusing _alerts_payload; token
  re-checks current user record and project permission each call
- /project/notifier page (approve, connected PCs, revoke, download)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 10:21:58 +09:00
king 5278d568de feat(project): weekly meetings editable by anyone, admin completes to lock
Meeting write APIs now accept any project user; deleting a meeting and the
new POST /api/goals/meetings/{week}/complete (complete/reopen) stay admin
only. A completed meeting (migration 022: completed_at, completed_by)
rejects edits with 409; last-week result fields follow the next meeting's
lock instead. The page shows a complete button / locked badge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 17:37:23 +09:00
king c9d5e6e017 feat(project): meeting board button opens a blank Google Slides deck
A "회의록 보드" button next to attendees opens the week's Google Slides
deck in its own window. The deck is found (Drive appProperties) or
created in the shared drive MEETING_BOARD_FOLDER_ID as one BLANK slide,
named like "10월 2주차 (10/5~10/11)". Needs a token with Drive and
Slides scopes; the authorize script now requests them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 12:04:09 +09:00
king 9528f735b8 feat(project): allow text in meeting target/result cells; fix result note save
- Target and result cells accept text such as "20개". Values that parse
  as amounts still go to the integer columns; anything else goes to the
  new target_text/result_text columns (migration 021).
- Fix: PUT /api/goals/meeting-items/{id} dropped result_note, so the
  last-week result text was never saved.
- Update meeting nav test to the month-bounded week numbering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:40:30 +09:00
king cd3577b299 feat(project): month-bounded meeting weeks, weekly sales targets, sticky header
- Weeks stay inside the month: week 1 starts on the 1st (through the next
  Sunday if the 1st is a weekend); a trailing Mon/Tue joins the last week.
  "Last week" is the previous period.
- Prev-week review columns: 전주 업무 | 결과(text, new result_note) |
  전주 목표 | 결과(amount).
- Header now shows month target, cumulative weekly target, month-to-date
  sales and gap (amount + %), with decisions/notes beside it; the area
  stays fixed while scrolling.
- Goals board: the monthly sales target is entered per week; the sum
  becomes the month target.
- Migration 020: result_note, goal_week_targets, drop Monday-only check,
  move absorbed Monday meetings to the new week start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:24:41 +09:00
king b576dd1a38 feat(asset): add photos, monitor links and deletion
Apply asset_db_002_photos_monitors.sql before rebuilding web.

Restrict soft deletion to the super admin; retain reports and audit.
2026-10-06 02:29:19 +09:00
king bd0c47e6fc feat(asset): add inventory and HWiNFO reports
Requires asset_db initialized with scripts/sql/asset_db_init.sql and ASSET_DB_URL configured before enabling storage.
2026-10-06 02:09:10 +09:00
king 090e508bf3 feat(project): add meeting cell editing
Apply project_db migration 019 to enable vertical cell merges. Other cell editing remains available before migration.
2026-10-03 15:11:41 +09:00
king aa669553db feat(performance): 실적(쇼핑몰 통합 매출) 모듈 1단계 — 대시보드·설정·보안·어댑터 구조
- 네 영역 분리: ① 수집(adapters/ 쇼핑몰 10곳 + sync.py) ② 보안(security/ + credentials.py)
  ③ 계산·저장(calc.py + db.py) ④ 화면(dashboard.py, router.py, templates, performance.css/js)
- 대시보드: 기간(오늘/이번주/이번달/올해/직접선택, 이전·다음), 쇼핑몰 필터, KPI 5개(진행 중 기간은
  직전 기간 같은 경과일 대비), 일자×쇼핑몰 표(주간합계, 총매출/수수료/차감매출 전환), 일별 추이·
  쇼핑몰 비중(SVG), 월 누적(비중)·연간 누적, 금액 클릭 → 주문 상세
- 설정(관리자): 사용/매출 집계, 수수료율 이력(적용 시작일), 쇼핑몰별 API 인증정보 입력·연결 테스트·
  연결 상태, 마스터 키 상태·재암호화, 테스트(모의) 데이터 생성/삭제
- 인증정보: 설정 화면 입력 → AES-256-GCM(키 버전, AAD=쇼핑몰+항목) 암호화 저장, secret 원문은
  화면으로 다시 보내지 않음, 오류·로그·raw 는 비밀값 가린 뒤 저장. 마스터 키는 APP_ENCRYPTION_KEY(.env)
- 매출 기준일: 결제=결제일, 취소·반품=발생일. 금액 원 단위 정수, 수수료 반올림은 calc.commission 한 곳
- 동기화: 같은 쇼핑몰 동시 실행 차단(running 부분 유니크), 쇼핑몰별 실패 격리, 중복 방지 UNIQUE+UPSERT
- 카페24 어댑터는 기존 app/integrations/cafe24 OAuth 토큰 재사용, 나머지는 입력칸만(수집은 다음 단계)
- performance_db 초기화 스크립트, 권한키 performance(설정은 is_admin), 문서·.env.example

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 16:07:46 +09:00
king 269e779129 feat(vacation): 휴가 관리 모듈 — 월간 달력 bar/연차·반차 신청/승인 워크플로/공휴일·연차 설정
- vacation_db 전용 저장소(VacationDBStore), VACATION_DB_URL 미설정 시 '설정 필요' 안내
- 월간 달력: 구글식 휴가 bar(주 단위 lane 배정), 일/공휴일 빨강·토요일 파랑
- 신청 폼: 종류/기간/시작·종료 구분(종일/오전/오후)/사유 + 예상 일수 미리보기
- 일수 계산은 서버(compute_days)에서 주말+공휴일(is_red) 제외 재계산
- 워크플로: 작성중/반려→제출→승인|반려, 취소 soft delete, 본인만 수정(작성중/반려)
- 권한: vacation(접근)/vacation_approver(승인), admin 통과. 설정은 admin 전용
- 공휴일(vacation_holidays) DB 기반 provider + settings CRUD, 연차잔여(vacation_balances)
- 엑셀 내보내기(openpyxl), scripts/sql/vacation_db_init.sql(멱등, 2026 공휴일 seed)
- main.py 등록, 메뉴 ready 전환, docs/.env.example/CLAUDE.md 갱신

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 08:20:20 +09:00
king 9e707be5ac feat(cupang): 쿠팡 밀크런 모듈 추가 (출고 달력/박스계산/입고센터)
- app/modules/cupang: router/db/store/itemcode + 템플릿 5종
- cupang_db 전용(JSON 폴백 없음). CUPANG_DB_URL 미설정 시 안내 페이지
- 월간 달력 + 출고 묶음(헤더+라인), 박스 입수량 자동계산(서버 재계산)
- 입고센터 관리(사용중 soft delete), 박스규칙 upsert, 엑셀 내보내기
- 상품 검색은 itemcode_db 읽기 전용(미설정 시 수동 입력)
- MODULE_KEYS/메뉴/아이콘/라벨 동기화, scripts/sql/cupang_db_init.sql(멱등)
- app/data/ gitignore 추가(PII)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 20:47:32 +09:00
king 550867ba0c feat(expense+admin): 결재 워크플로 + 첨부 + 집계 + 엑셀 + 사용자 직접 등록
[admin]
- POST /api/users 사용자 직접 등록 (이메일만으로). UserStore.create_user 추가
- admin.html: 등록 폼 + 삭제 버튼 + 한글 라벨 + 신규 권한 표시
- 신규 권한 키: expense_approver, vacation_approver (APPROVER_KEYS)
- is_approver(user_rec, kind) 헬퍼

[expense 워크플로]
- 상태 전이: 작성중 → 제출 → 승인/반려 → 정산완료
- API: /api/items/{id}/{submit,revert,approve,reject,settle}
- 권한: submit/revert=owner, approve/reject/settle=expense_approver 또는 admin
- expense_items 컬럼: approver_email, decided_at, reject_reason
- 작성중/반려 상태에서만 수정/삭제/첨부 가능

[expense 첨부]
- 영수증/기타 (kind: receipt|other). 최대 20MB, 확장자 화이트리스트
- 저장: DATA_DIR/uploads/expense/{item_id}/{att_id}_{filename}
- expense_attachments 테이블 (CASCADE on item delete)
- API: 업로드/목록/다운로드/삭제

[expense 집계]
- /expense/reports: 연도별 월×카테고리 피벗 표

[expense 엑셀]
- GET /expense/api/export.xlsx?from&to&scope=mine|all
- scope=all 은 승인자/관리자만

[DDL]
- expense_db_init.sql: 신규 컬럼/테이블 포함 (멱등)
- expense_db_002_workflow_attachments.sql: 운영 DB 마이그레이션용

[deps]
- openpyxl>=3.1, python-multipart>=0.0.20

[docs]
- DATABASES.md: 워크플로 다이어그램, attachments 테이블, 마이그레이션
- PROJECT_OVERVIEW.md: 권한 키 표
- DEPLOYMENT.md: DATA_DIR/uploads 안내
2026-05-29 02:52:44 +09:00
king 9c58b022e2 feat(expense): 개인경비 모듈 + ERP 좌측메뉴 셸 + expense_db 연결
- ERP 셸: 좌측 사이드바 + 상단 헤더 + 콘텐츠 영역(erp_base.html)
- 분기: 슈퍼관리자 → 업무모듈 카드, 일반사용자 → ERP 메인(erp_home.html)
- 신규 라우트: /modules (슈퍼관리자 모듈 카드 재진입)
- 개인경비 모듈: app/modules/expense/ (라우터/저장소/템플릿)
  - JSON 저장소(ExpenseStore) + PostgreSQL 저장소(ExpenseDBStore)
  - 팩토리: EXPENSE_DB_URL 있으면 DB, 없으면 JSON 폴백
- DB: scripts/sql/expense_db_init.sql (멱등 DDL, postgres-db 컨테이너)
  - expense_db, 역할 expense_app, 테이블 expense_items, 인덱스/트리거
- 마이그레이션: scripts/migrate_expense_json_to_db.py (멱등, --dry-run)
- 의존성: psycopg[binary,pool]>=3.2
- 환경변수: EXPENSE_DB_URL 추가
- 문서: CLAUDE.md 작업 기준 + docs/{PROJECT_OVERVIEW,SERVER_ARCHITECTURE,DATABASES,DEPLOYMENT}.md
  - main-app 배포 경로 /opt/www/main 고정 명시
  - 위험 명령(DROP/TRUNCATE/rm -rf/volume 삭제) 사용자 승인 정책
2026-05-29 02:21:03 +09:00