- ProjectMailMsg(헤더 저장)·ProjectMailState(동기화 상태) 모델, AutoMigrate 등록 - mailsync.FetchForDomain: nextPageToken 따라 전체 히스토리 페이지네이션(maxPerBox=0=전부) - 백그라운드 주기 동기화 StartMailSyncLoop(MAIL_SYNC_INTERVAL 기본 15m, 0=비활성) · 미동기화 프로젝트=full 백필, 이후=최신 페이지 top-up - GET /mails는 DB에서 읽어 참여자(from/to/cc) 필터 + 공동 메모 인라인 결합 + lastSyncedAt - POST /mails/sync(강제 풀싱크), PUT /mail-hide(프로젝트 단위 숨김) - mailCache 제거(DB가 캐시), config MailSyncInterval Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b4b47e5ed1
commit
c865baccd2
@@ -28,7 +28,8 @@ func All() []interface{} {
|
||||
&Attendance{}, &LeaveRequest{}, &OvertimeRequest{}, &WorkPolicy{}, &LeaveBalance{},
|
||||
// slice 3 — projects
|
||||
&Company{}, &Product{}, &Version{}, &Project{}, &ProjectMember{},
|
||||
&ClientContact{}, &ProjectTask{}, &TaskComment{}, &MailNote{}, &Contract{}, &ContractFile{}, &PaymentSplit{},
|
||||
&ClientContact{}, &ProjectTask{}, &TaskComment{}, &MailNote{}, &ProjectMailMsg{}, &ProjectMailState{},
|
||||
&Contract{}, &ContractFile{}, &PaymentSplit{},
|
||||
// slice 4 — incentive
|
||||
&IncentiveConfig{}, &PaymentStage{}, &UserIncentive{}, &QuarterlySettlement{},
|
||||
// slice 5 — accounting
|
||||
|
||||
@@ -140,6 +140,37 @@ type MailNote struct {
|
||||
|
||||
func (m *MailNote) BeforeCreate(*gorm.DB) error { m.ensureID(); return nil }
|
||||
|
||||
// ProjectMailMsg is a stored mail header for a project's client domain (본문 미저장,
|
||||
// 헤더/스니펫만). 동기화 시 (project, Message-ID)로 upsert. Hidden=프로젝트에서 숨김.
|
||||
type ProjectMailMsg struct {
|
||||
Base
|
||||
ProjectID string `gorm:"index:idx_pmm,unique" json:"projectId"`
|
||||
MessageID string `gorm:"index:idx_pmm,unique" json:"messageId"`
|
||||
ThreadID string `json:"threadId"`
|
||||
FromAddr string `json:"from"`
|
||||
ToAddr string `json:"to"`
|
||||
CcAddr string `json:"cc"`
|
||||
Subject string `json:"subject"`
|
||||
Snippet string `json:"snippet"`
|
||||
DateHdr string `json:"date"`
|
||||
Mailbox string `json:"mailbox"`
|
||||
TS int64 `gorm:"index" json:"ts"`
|
||||
Hidden bool `json:"hidden"`
|
||||
HiddenBy string `json:"hiddenBy"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (m *ProjectMailMsg) BeforeCreate(*gorm.DB) error { m.ensureID(); return nil }
|
||||
|
||||
// ProjectMailState tracks the last mail sync per project.
|
||||
type ProjectMailState struct {
|
||||
ProjectID string `gorm:"primaryKey" json:"projectId"`
|
||||
LastSyncedAt *time.Time `json:"lastSyncedAt"`
|
||||
LastError string `json:"lastError"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
// Contract holds the [admin-only] commercial terms of a project. BE is the
|
||||
// break-even floor (손해가 안 나는 최소 금액). Exposed ONLY to admins.
|
||||
type Contract struct {
|
||||
|
||||
Reference in New Issue
Block a user