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