medol-be/app/module/articles/response/articles.response.go

113 lines
4.7 KiB
Go
Raw Normal View History

2024-03-05 19:15:53 +00:00
package response
2024-05-07 07:48:46 +00:00
import (
"time"
2025-07-02 06:03:52 +00:00
articleCategoriesResponse "web-medols-be/app/module/article_categories/response"
articleFilesResponse "web-medols-be/app/module/article_files/response"
2024-05-07 07:48:46 +00:00
)
2024-03-05 19:15:53 +00:00
type ArticlesResponse struct {
2024-03-31 15:19:45 +00:00
ID uint `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
Description string `json:"description"`
HtmlDescription string `json:"htmlDescription"`
CategoryId int `json:"categoryId"`
CategoryName string `json:"categoryName"`
TypeId int `json:"typeId"`
2024-03-31 15:19:45 +00:00
Tags string `json:"tags"`
ThumbnailUrl string `json:"thumbnailUrl"`
PageUrl *string `json:"pageUrl"`
CreatedById *uint `json:"createdById"`
2024-05-07 07:48:46 +00:00
CreatedByName *string `json:"createdByName"`
2024-05-07 11:08:38 +00:00
ShareCount *int `json:"shareCount"`
ViewCount *int `json:"viewCount"`
2025-02-15 01:56:13 +00:00
CommentCount *int `json:"commentCount"`
AiArticleId *int `json:"aiArticleId"`
2025-05-14 16:54:21 +00:00
OldId *uint `json:"oldId"`
StatusId *int `json:"statusId"`
2025-04-07 02:46:48 +00:00
IsBanner *bool `json:"isBanner"`
IsPublish *bool `json:"isPublish"`
PublishedAt *time.Time `json:"publishedAt"`
IsActive *bool `json:"isActive"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
2024-05-07 07:48:46 +00:00
2025-01-20 09:30:39 +00:00
ArticleFiles []*articleFilesResponse.ArticleFilesResponse `json:"files"`
ArticleCategories []*articleCategoriesResponse.ArticleCategoriesResponse `json:"categories"`
2024-03-31 15:19:45 +00:00
}
2025-02-15 01:56:13 +00:00
type ArticleSummaryStats struct {
TotalToday int `json:"totalToday"`
TotalThisWeek int `json:"totalThisWeek"`
TotalAll int `json:"totalAll"`
TotalViews int `json:"totalViews"`
TotalShares int `json:"totalShares"`
TotalComments int `json:"totalComments"`
}
2025-02-15 10:23:39 +00:00
type ArticlePerUserLevelStats struct {
UserLevelID uint `json:"userLevelId"`
UserLevelName string `json:"userLevelName"`
TotalArticle int64 `json:"totalArticle"`
}
type ArticleMonthlyStats struct {
Year int `json:"year"`
Month int `json:"month"`
View []int `json:"view"`
Comment []int `json:"comment"`
Share []int `json:"share"`
}
// ArticleApprovalStatusResponse represents the approval status of an article
type ArticleApprovalStatusResponse struct {
ArticleId uint `json:"article_id"`
WorkflowId *uint `json:"workflow_id"`
WorkflowName *string `json:"workflow_name"`
CurrentStep int `json:"current_step"`
TotalSteps int `json:"total_steps"`
Status string `json:"status"` // "pending", "in_progress", "approved", "rejected", "revision_requested"
CurrentApprover *string `json:"current_approver"`
SubmittedAt *time.Time `json:"submitted_at"`
LastActionAt *time.Time `json:"last_action_at"`
Progress float64 `json:"progress"` // percentage complete
CanApprove bool `json:"can_approve"` // whether current user can approve
NextStep *string `json:"next_step"`
}
// ArticleApprovalQueueResponse represents an article in the approval queue
type ArticleApprovalQueueResponse struct {
ID uint `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
Description string `json:"description"`
CategoryName string `json:"category_name"`
AuthorName string `json:"author_name"`
SubmittedAt time.Time `json:"submitted_at"`
CurrentStep int `json:"current_step"`
TotalSteps int `json:"total_steps"`
Priority string `json:"priority"` // "low", "medium", "high", "urgent"
DaysInQueue int `json:"days_in_queue"`
WorkflowName string `json:"workflow_name"`
CanApprove bool `json:"can_approve"`
EstimatedTime string `json:"estimated_time"` // estimated time to complete approval
}
// ClientApprovalSettingsResponse represents client-level approval settings
type ClientApprovalSettingsResponse struct {
ClientId string `json:"client_id"`
RequiresApproval bool `json:"requires_approval"`
DefaultWorkflowId *uint `json:"default_workflow_id"`
DefaultWorkflowName *string `json:"default_workflow_name"`
AutoPublishArticles bool `json:"auto_publish_articles"`
ApprovalExemptUsers []uint `json:"approval_exempt_users"`
ApprovalExemptRoles []uint `json:"approval_exempt_roles"`
ApprovalExemptCategories []uint `json:"approval_exempt_categories"`
RequireApprovalFor []string `json:"require_approval_for"`
SkipApprovalFor []string `json:"skip_approval_for"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}