feat(inout): 물류센터 이메일 옵션 · 입고 저장 뒤 입고 요청 메일(Gmail, 본문 안 사진 600px)
- 옵션 → 물류센터 탭: 물류센터 담당자 이메일·입고 요청 메일 참조(기본 king@·bj@dbxcorp.co.kr) - 입고 저장 → 미리보기 팝업 바로 → [메일 발송](입고 담당 본인 Gmail), 입고 기록 줄 보내기/다시 보내기 - 제목 "[입고 요청] yyyy년 mm월 dd일(요일) 입고 요청 합니다.", 본문 = 전산 등록 부탁 + 상품 이름·코드·입고 수량·비고 표 - 입고증 사진은 첨부가 아니라 본문 안 이미지(CID multipart/related), 가로 최대 600px·비율 유지로 줄임 - Gmail 연결 권한을 발주 담당 → 발주·입고 담당으로 - 마이그레이션 inout_db 005(inout_settings·inout_receipt_mails), 초기화 SQL 에도 반영 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -216,13 +216,40 @@ ALTER TABLE inout_order_lines ADD COLUMN IF NOT EXISTS unit_price NUMERIC(14,2)
|
||||
ALTER TABLE inout_order_lines ADD COLUMN IF NOT EXISTS weight_g NUMERIC(12,2) NULL;
|
||||
ALTER TABLE inout_order_lines ADD COLUMN IF NOT EXISTS silver_pct NUMERIC(9,4) NULL;
|
||||
|
||||
-- ════════════════════════════════════════════════════════════
|
||||
-- 7) 모듈 설정(물류센터 이메일·입고 요청 메일 참조) · 입고 요청 메일 기록 (= 마이그레이션 005)
|
||||
-- ════════════════════════════════════════════════════════════
|
||||
CREATE TABLE IF NOT EXISTS inout_settings (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL DEFAULT '',
|
||||
updated_by TEXT NOT NULL DEFAULT '',
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
COMMENT ON TABLE inout_settings IS '입출고 — 모듈 설정(물류센터 이메일 등)';
|
||||
INSERT INTO inout_settings (key, value) VALUES ('receipt_mail_cc', 'king@dbxcorp.co.kr, bj@dbxcorp.co.kr')
|
||||
ON CONFLICT (key) DO NOTHING;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS inout_receipt_mails (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
receipt_id BIGINT NOT NULL REFERENCES inout_receipts(id) ON DELETE CASCADE,
|
||||
sent_by TEXT NOT NULL,
|
||||
to_addrs TEXT NOT NULL,
|
||||
cc_addrs TEXT NOT NULL DEFAULT '',
|
||||
subject TEXT NOT NULL,
|
||||
gmail_id TEXT NOT NULL DEFAULT '',
|
||||
sent_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_inout_receipt_mails_receipt ON inout_receipt_mails (receipt_id, sent_at);
|
||||
COMMENT ON TABLE inout_receipt_mails IS '입출고 — 입고 요청 메일(물류센터) 보낸 기록';
|
||||
|
||||
-- ════════════════════════════════════════════════════════════
|
||||
-- 권한 — 앱 계정은 읽기·쓰기만(스키마 변경 없음)
|
||||
-- ════════════════════════════════════════════════════════════
|
||||
GRANT USAGE ON SCHEMA public TO inout_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON
|
||||
inout_factories, inout_roles, inout_orders, inout_order_lines, inout_receipts, inout_receipt_lines,
|
||||
inout_gmail_tokens, inout_order_mails, inout_receipt_photos, inout_products, inout_products_excluded
|
||||
inout_gmail_tokens, inout_order_mails, inout_receipt_photos, inout_products, inout_products_excluded,
|
||||
inout_settings, inout_receipt_mails
|
||||
TO inout_app;
|
||||
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO inout_app;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user