- 新增 mailboxes 表与 MailboxStore(系统文件夹幂等创建,自定义文件夹 CRUD) - 提取 MailboxService:IMAP 会话与 Web handler 共用,LIST 返回什么 Web 就显示什么 - IMAP 支持 CREATE/DELETE/RENAME/SUBSCRIBE(系统文件夹禁删改、非空禁删) - Web 删除改为 IMAP 语义:移入 Trash,新增恢复/彻底删除/清空 - 新增通用 /folder/:name 页面与动态侧边栏,/inbox /sent /drafts 保留兼容重定向
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package store
|
|
|
|
import (
|
|
"mail_go/internal/db"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Stores aggregates all store interfaces for convenient access.
|
|
type Stores struct {
|
|
Users UserStore
|
|
Mails MailStore
|
|
Domains DomainStore
|
|
Attachments AttachmentStore
|
|
Bans BanStore
|
|
Outbound OutboundStore
|
|
ProtocolLogs ProtocolLogStore
|
|
MailboxState MailboxStateStore
|
|
Mailboxes MailboxStore
|
|
}
|
|
|
|
// NewStores creates a new Stores instance with all GORM-backed implementations.
|
|
func NewStores(database *gorm.DB) *Stores {
|
|
return &Stores{
|
|
Users: newUserStore(database),
|
|
Mails: newMailStore(database),
|
|
Domains: newDomainStore(database),
|
|
Attachments: newAttachmentStore(database),
|
|
Bans: newBanStore(database),
|
|
Outbound: newOutboundStore(database),
|
|
ProtocolLogs: newProtocolLogStore(database),
|
|
MailboxState: newMailboxStateStore(database),
|
|
Mailboxes: newMailboxStore(database),
|
|
}
|
|
}
|
|
|
|
// Ensure models are referenced (prevents unused import errors).
|
|
var _ = db.User{}
|
|
var _ = db.Domain{}
|
|
var _ = db.Message{}
|
|
var _ = db.Attachment{}
|
|
var _ = db.BanEntry{}
|
|
var _ = db.ProtocolLog{}
|
|
var _ = db.MailboxState{}
|
|
var _ = db.Mailbox{}
|