@@ -0,0 +1,42 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"ymhut-box/server/unified-management/internal/db"
|
||||
)
|
||||
|
||||
type legacyFeedbackStatusDTO struct {
|
||||
OK bool `json:"ok"`
|
||||
Code string `json:"code"`
|
||||
Status string `json:"status"`
|
||||
StatusLabel string `json:"statusLabel"`
|
||||
StatusDetail string `json:"statusDetail"`
|
||||
Category string `json:"category"`
|
||||
Priority string `json:"priority"`
|
||||
HasReply bool `json:"hasReply"`
|
||||
Reply string `json:"reply"`
|
||||
ReceivedAt string `json:"receivedAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
MailSent bool `json:"mailSent"`
|
||||
Duplicate bool `json:"duplicate,omitempty"`
|
||||
}
|
||||
|
||||
func legacyFeedbackStatus(item db.Feedback, duplicate bool) legacyFeedbackStatusDTO {
|
||||
reply := strings.TrimSpace(item.PublicReply)
|
||||
return legacyFeedbackStatusDTO{
|
||||
OK: true,
|
||||
Code: item.Code,
|
||||
Status: firstNonEmpty(item.Status, "new"),
|
||||
StatusLabel: feedbackStatusLabel(item.Status),
|
||||
StatusDetail: item.StatusDetail,
|
||||
Category: item.Category,
|
||||
Priority: item.Priority,
|
||||
HasReply: reply != "",
|
||||
Reply: reply,
|
||||
ReceivedAt: item.CreatedAt,
|
||||
UpdatedAt: firstNonEmpty(item.LastActivityAt, item.UpdatedAt, item.CreatedAt),
|
||||
MailSent: item.MailSent,
|
||||
Duplicate: duplicate,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user