chore(ci, dto): update build workflow and enhance post DTOs
- Added NODE_NO_WARNINGS environment variable to build and deploy workflows. - Upgraded actions/upload-artifact and actions/download-artifact to version 4 in the build workflow. - Introduced ContentEditedAt field in PostResponse and PostDetailResponse DTOs to track content modification timestamps. - Updated post conversion functions to include ContentEditedAt in responses. - Ensured ContentEditedAt is set during post updates in the repository.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package service
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -278,25 +278,26 @@ func convertPostToAdminListResponse(post *model.Post) dto.AdminPostListResponse
|
||||
}
|
||||
|
||||
return dto.AdminPostListResponse{
|
||||
ID: post.ID,
|
||||
UserID: post.UserID,
|
||||
Title: post.Title,
|
||||
Content: post.Content,
|
||||
Images: images,
|
||||
Status: string(post.Status),
|
||||
LikesCount: post.LikesCount,
|
||||
CommentsCount: post.CommentsCount,
|
||||
FavoritesCount: post.FavoritesCount,
|
||||
ViewsCount: post.ViewsCount,
|
||||
IsPinned: post.IsPinned,
|
||||
IsFeatured: post.IsFeatured,
|
||||
IsLocked: post.IsLocked,
|
||||
RejectReason: post.RejectReason,
|
||||
ReviewedAt: dto.FormatTimePointer(post.ReviewedAt),
|
||||
ReviewedBy: post.ReviewedBy,
|
||||
CreatedAt: post.CreatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
UpdatedAt: post.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
Author: author,
|
||||
ID: post.ID,
|
||||
UserID: post.UserID,
|
||||
Title: post.Title,
|
||||
Content: post.Content,
|
||||
Images: images,
|
||||
Status: string(post.Status),
|
||||
LikesCount: post.LikesCount,
|
||||
CommentsCount: post.CommentsCount,
|
||||
FavoritesCount: post.FavoritesCount,
|
||||
ViewsCount: post.ViewsCount,
|
||||
IsPinned: post.IsPinned,
|
||||
IsFeatured: post.IsFeatured,
|
||||
IsLocked: post.IsLocked,
|
||||
RejectReason: post.RejectReason,
|
||||
ReviewedAt: dto.FormatTimePointer(post.ReviewedAt),
|
||||
ReviewedBy: post.ReviewedBy,
|
||||
CreatedAt: post.CreatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
UpdatedAt: post.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
ContentEditedAt: dto.FormatTimePointer(post.ContentEditedAt),
|
||||
Author: author,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,28 +320,29 @@ func convertPostToAdminDetailResponse(post *model.Post) *dto.AdminPostDetailResp
|
||||
}
|
||||
|
||||
return &dto.AdminPostDetailResponse{
|
||||
ID: post.ID,
|
||||
UserID: post.UserID,
|
||||
CommunityID: post.CommunityID,
|
||||
Title: post.Title,
|
||||
Content: post.Content,
|
||||
Images: images,
|
||||
Status: string(post.Status),
|
||||
LikesCount: post.LikesCount,
|
||||
CommentsCount: post.CommentsCount,
|
||||
FavoritesCount: post.FavoritesCount,
|
||||
SharesCount: post.SharesCount,
|
||||
ViewsCount: post.ViewsCount,
|
||||
HotScore: post.HotScore,
|
||||
IsPinned: post.IsPinned,
|
||||
IsFeatured: post.IsFeatured,
|
||||
IsLocked: post.IsLocked,
|
||||
IsVote: post.IsVote,
|
||||
RejectReason: post.RejectReason,
|
||||
ReviewedAt: dto.FormatTimePointer(post.ReviewedAt),
|
||||
ReviewedBy: post.ReviewedBy,
|
||||
CreatedAt: post.CreatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
UpdatedAt: post.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
Author: author,
|
||||
ID: post.ID,
|
||||
UserID: post.UserID,
|
||||
CommunityID: post.CommunityID,
|
||||
Title: post.Title,
|
||||
Content: post.Content,
|
||||
Images: images,
|
||||
Status: string(post.Status),
|
||||
LikesCount: post.LikesCount,
|
||||
CommentsCount: post.CommentsCount,
|
||||
FavoritesCount: post.FavoritesCount,
|
||||
SharesCount: post.SharesCount,
|
||||
ViewsCount: post.ViewsCount,
|
||||
HotScore: post.HotScore,
|
||||
IsPinned: post.IsPinned,
|
||||
IsFeatured: post.IsFeatured,
|
||||
IsLocked: post.IsLocked,
|
||||
IsVote: post.IsVote,
|
||||
RejectReason: post.RejectReason,
|
||||
ReviewedAt: dto.FormatTimePointer(post.ReviewedAt),
|
||||
ReviewedBy: post.ReviewedBy,
|
||||
CreatedAt: post.CreatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
UpdatedAt: post.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||
ContentEditedAt: dto.FormatTimePointer(post.ContentEditedAt),
|
||||
Author: author,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,8 +283,10 @@ func (s *VoteService) convertToPostResponse(post *model.Post, currentUserID stri
|
||||
IsPinned: post.IsPinned,
|
||||
IsLocked: post.IsLocked,
|
||||
IsVote: post.IsVote,
|
||||
CreatedAt: dto.FormatTime(post.CreatedAt),
|
||||
Images: make([]dto.PostImageResponse, 0, len(post.Images)),
|
||||
CreatedAt: dto.FormatTime(post.CreatedAt),
|
||||
UpdatedAt: dto.FormatTime(post.UpdatedAt),
|
||||
ContentEditedAt: dto.FormatTimePointer(post.ContentEditedAt),
|
||||
Images: make([]dto.PostImageResponse, 0, len(post.Images)),
|
||||
}
|
||||
|
||||
// 转换图片
|
||||
|
||||
Reference in New Issue
Block a user