theorose49 c865baccd2
All checks were successful
build-and-push / build (push) Successful in 33s
feat(mail): DB 저장 + 주기 동기화 + 전체 히스토리 수집 + 메일 숨김
- 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>
2026-06-30 12:44:31 +09:00

41 lines
1.4 KiB
Go

// Package models defines the GORM models for spin. Each domain slice adds its
// own file (member.go, attendance.go, project.go, incentive.go, accounting.go);
// this file holds the shared Base type and the AutoMigrate registry.
package models
import (
"github.com/google/uuid"
"gorm.io/gorm"
)
// Base provides a string UUID primary key populated in a BeforeCreate hook.
type Base struct {
ID string `gorm:"primaryKey" json:"id"`
}
func (b *Base) ensureID() {
if b.ID == "" {
b.ID = uuid.NewString()
}
}
// All returns every model for AutoMigrate. Each slice appends its models here.
func All() []interface{} {
return []interface{}{
// slice 1 — members / org
&Member{}, &Department{}, &AuditLog{}, &Notification{}, &WorkStatusEvent{}, &Device{},
// slice 2 — attendance / leave
&Attendance{}, &LeaveRequest{}, &OvertimeRequest{}, &WorkPolicy{}, &LeaveBalance{},
// slice 3 — projects
&Company{}, &Product{}, &Version{}, &Project{}, &ProjectMember{},
&ClientContact{}, &ProjectTask{}, &TaskComment{}, &MailNote{}, &ProjectMailMsg{}, &ProjectMailState{},
&Contract{}, &ContractFile{}, &PaymentSplit{},
// slice 4 — incentive
&IncentiveConfig{}, &PaymentStage{}, &UserIncentive{}, &QuarterlySettlement{},
// slice 5 — accounting
&Account{}, &Transaction{}, &TaxRecord{},
}
}
var _ = gorm.ErrRecordNotFound // keep gorm imported for slice files