作者 yangfu
... ... @@ -8,17 +8,20 @@ import (
)
type Article struct {
Id int64
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
AuthorId int64 // 发布人
Author UserSimple // 发布人
Title string // 文章标题
Images []Image // 图片
WhoRead []int64 // 谁可以看
WhoReview []int64 // 评论人
Location Location // 坐标
Id int64 `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt"`
AuthorId int64 `json:"authorId"` // 发布人
Author UserSimple `json:"author"` // 发布人
Title string `json:"title"` // 文章标题
Images []Image `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Tags []int `json:"tags"` // 标签
// ...more
}
... ...
package domain
import "time"
// 编辑文章后保存的历史记录
type ArticleBackup struct {
Id int64
Id int64
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"` // 操作
}
... ...
package domain
import "time"
import (
"context"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
// 文章评论
type ArticleComment struct {
Id int64 // 评论id
UpdatedAt time.Time // 更新时间
DeletedAt *time.Time
CreatedAt time.Time
Pid int64 // 对哪个评论进行回复
TopId int64 // 归属于最上级的哪个评论
ArticleId int64 // 文章id
ArticleSectionId int64 // 文本内容id
SectionContent string // 引用的文章内容文本
FromUserId int64 // 谁填写的评论
FromUser UserSimple // 谁填写的评论
ToUserId int64 // 回复谁的评论
ToUser UserSimple // 回复谁的评论
Content string // 评论内容
CountReply int // 回复数量
CountUserLove int // 用户点赞数量
CountAdminLove int // 运营点赞数量
Id int64 `json:"id"` // 评论id
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
DeletedAt *time.Time `json:"deletedAt"`
CreatedAt time.Time `json:"createdAt"`
Pid int64 `json:"pid"` // 对哪个评论进行回复
TopId int64 `json:"topId"` // 归属于最上级的哪个评论
ArticleId int64 `json:"articleId"` // 文章id
ArticleSectionId int64 `json:"articleSectionId"` // 文本内容id
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
FromUserId int64 `json:"fromUserId"` // 谁填写的评论
FromUser UserSimple `json:"fromUser"` // 谁填写的评论
ToUserId int64 `json:"toUserId"` // 回复谁的评论
ToUser UserSimple `json:"toUser"` // 回复谁的评论
Content string `json:"content"` // 评论内容
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
Show int `json:"showState"` // 评论的展示状态(0显示、1不显示)
// ...more
}
// 评论的展示状态(0显示、1不显示)
type CommentShow int
const (
CommentShowEnable CommentShow = 0
CommentShowDisable CommentShow = 1
)
type ArticleCommentRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
Update(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
Delete(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleComment, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleComment, error)
}
... ...
package domain
import "time"
import (
"context"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
// 填写文章时保存的草稿
type ArticleDraft struct {
Id int64
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
Template int // 填写内容时用的样板 1、演绎式 2、归纳式
Content []string // 文章内容
AuthorId int64 // 发布人
Title string // 文章标题
Images []Image // 图片
WhoRead []int64 // 谁可以看
WhoReview []int64 // 评论人
Location Location // 坐标
Id int64 `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt"`
Template int `json:"template"` // 填写内容时用的样板 1、演绎式 2、归纳式
Content []string `json:"content"` // 文章内容
AuthorId int64 `json:"authorId"` // 发布人
Title string `json:"title"` // 文章标题
Images []Image `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type ArticleDraftRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
Update(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
Delete(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleDraft, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleDraft, error)
}
... ...
... ... @@ -9,15 +9,14 @@ import (
// 文章段落
type ArticleSection struct {
Id int64
UpdatedAt time.Time // 更新时间
DeletedAt *time.Time //
CreatedAt time.Time //
ArticleId int64 // 文章id
Content string // 文本内容
SortBy int // 排序
TotalComment int // 评论的数量
// ...more
Id int64 `json:"id"`
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
DeletedAt *time.Time `json:"deletedAt"` //
CreatedAt time.Time `json:"createdAt"` //
ArticleId int64 `json:"articleId"` // 文章id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
type ArticleSectionRepository interface {
... ...
package domain
import (
"context"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
// 文章的标签
type ArticleTag struct {
Id int64 `json:"id"`
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
DeletedAt *time.Time `json:"deletedAt"` //
CreatedAt time.Time `json:"createdAt"` //
Image Image `json:"image"` //图片
Name string `json:"name"` //标签名称
Group string `json:"group"` //标签分类
Remark string `json:"remark"` //备注
}
type ArticleTagRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
Update(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleSection, error)
Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTag, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleTag, error)
}
... ...
... ... @@ -5,11 +5,11 @@ import "time"
// 人员点赞标记
type UserLoveFlag struct {
Id int64
ArticleId int64 //点赞文章时,填文章id
CommentId int64 //点赞评论时,填评论id
UserId int64
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
Id int64 `json:"id"`
ArticleId int64 `json:"articleId"` //点赞文章时,填文章id
CommentId int64 `json:"commentId"` //点赞评论时,填评论id
UserId int64 `json:"userId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt"`
}
... ...
... ... @@ -2,4 +2,10 @@ package domain
// 人员查看文章详情后,标记一个记录
type UserReadArticle struct{}
type UserReadArticle struct {
Id int64 `json:"id"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
ArticleAuthor UserSimple `json:"author"` // 发布人
}
... ...