article_backup.go 1.8 KB
package domain

import (
	"context"

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

// 编辑文章后保存的历史记录
type ArticleBackup struct {
	Id         int64            `json:"id"`
	CompanyId  int64            `json:"companyId"`
	CreatedAt  int64            `json:"createdAt,omitempty"`
	UpdatedAt  int64            `json:"updatedAt,omitempty"`
	DeletedAt  int64            `json:"deletedAt,omitempty"`
	Version    int              `json:"version,omitempty"`
	Operator   UserSimple       `json:"operator"` // 操作人
	ArticleId  int64            `json:"articleId"`
	Title      string           `json:"title"`      // 标题
	Section    []ArticleSection `json:"section"`    // 分段内容
	Images     []Image          `json:"images"`     // 图片
	Action     string           `json:"action"`     // 操作
	TargetUser ArticleTarget    `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
	Location   Location         `json:"location"`   // 定位坐标
	WhoRead    []int64          `json:"whoRead"`    // 谁可以看
	WhoReview  []int64          `json:"whoReview"`  // 评论人
	Tags       []int64          `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)
	UpdateWithVersion(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)
}