article_backup.go 1.4 KB
package domain

import (
	"context"
	"time"

	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)

// 编辑文章后保存的历史记录
type ArticleBackup struct {
	Id        int64            `json:"id"`
	UpdatedAt time.Time        `json:"updatedAt"` // 更新时间
	DeletedAt *time.Time       `json:"deletedAt"` //
	CreatedAt time.Time        `json:"createdAt"` //
	Operator  UserSimple       `json:"operator"`  // 操作人
	Title     string           `json:"title"`     // 标题
	Section   []ArticleSection `json:"section"`   // 分段内容
	Images    []Image          `json:"images"`    // 图片
	Action    string           `json:"action"`    // 操作
	WhoRead   []int64          `json:"whoRead"`   // 谁可以看
	WhoReview []int64          `json:"whoReview"` // 评论人
	Tags      []int            `json:"tags"`      // 标签
}

type ArticleBackupRepository interface {
	Insert(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
	Update(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
	Delete(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
	FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleBackup, error)
	Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleBackup, error)
}