...
|
...
|
@@ -3,7 +3,6 @@ package repository |
|
|
import (
|
|
|
"context"
|
|
|
|
|
|
"github.com/jinzhu/copier"
|
|
|
"github.com/pkg/errors"
|
|
|
"github.com/tiptok/gocomm/pkg/cache"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
|
...
|
...
|
@@ -142,15 +141,57 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans |
|
|
}
|
|
|
|
|
|
func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.ArticleComment) (*domain.ArticleComment, error) {
|
|
|
to := &domain.ArticleComment{}
|
|
|
err := copier.Copy(to, from)
|
|
|
return to, err
|
|
|
to := &domain.ArticleComment{
|
|
|
Id: from.Id,
|
|
|
CompanyId: from.CompanyId,
|
|
|
CreatedAt: from.CreatedAt,
|
|
|
UpdatedAt: from.UpdatedAt,
|
|
|
DeletedAt: from.DeletedAt,
|
|
|
Version: from.Version,
|
|
|
Pid: from.Pid,
|
|
|
TopId: from.TopId,
|
|
|
ArticleId: from.ArticleId,
|
|
|
ArticleSectionId: from.ArticleSectionId,
|
|
|
SectionContent: from.SectionContent,
|
|
|
FromUserId: from.FromUserId,
|
|
|
FromUser: from.FromUser,
|
|
|
ToUserId: from.ToUser.Id,
|
|
|
ToUser: from.ToUser,
|
|
|
Content: from.Content,
|
|
|
CountReply: from.CountReply,
|
|
|
CountUserLove: from.CountUserLove,
|
|
|
CountAdminLove: from.CountAdminLove,
|
|
|
Show: domain.CommentShow(from.Show),
|
|
|
}
|
|
|
// err := copier.Copy(to, from)
|
|
|
return to, nil
|
|
|
}
|
|
|
|
|
|
func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.ArticleComment) (*models.ArticleComment, error) {
|
|
|
to := &models.ArticleComment{}
|
|
|
err := copier.Copy(to, from)
|
|
|
return to, err
|
|
|
to := &models.ArticleComment{
|
|
|
Id: from.Id,
|
|
|
CompanyId: from.CompanyId,
|
|
|
CreatedAt: from.CreatedAt,
|
|
|
UpdatedAt: from.UpdatedAt,
|
|
|
DeletedAt: from.DeletedAt,
|
|
|
Version: from.Version,
|
|
|
Pid: from.Pid,
|
|
|
TopId: from.TopId,
|
|
|
ArticleId: from.ArticleId,
|
|
|
ArticleSectionId: from.ArticleSectionId,
|
|
|
SectionContent: from.SectionContent,
|
|
|
FromUserId: from.FromUserId,
|
|
|
FromUser: from.FromUser,
|
|
|
ToUserId: from.ToUser.Id,
|
|
|
ToUser: from.ToUser,
|
|
|
Content: from.Content,
|
|
|
CountReply: from.CountReply,
|
|
|
CountUserLove: from.CountUserLove,
|
|
|
CountAdminLove: from.CountAdminLove,
|
|
|
Show: int(from.Show),
|
|
|
}
|
|
|
// err := copier.Copy(to, from)
|
|
|
return to, nil
|
|
|
}
|
|
|
|
|
|
func NewArticleCommentRepository(cache *cache.CachedRepository) domain.ArticleCommentRepository {
|
...
|
...
|
|