mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
user details page
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Comment struct {
|
||||
@@ -29,3 +30,21 @@ func (c *Comment) ToView() *CommentView {
|
||||
User: c.User.ToView(),
|
||||
}
|
||||
}
|
||||
|
||||
type CommentWithResourceView struct {
|
||||
ID uint `json:"id"`
|
||||
Content string `json:"content"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Resource ResourceView `json:"resource"`
|
||||
User UserView `json:"user"`
|
||||
}
|
||||
|
||||
func (c *Comment) ToViewWithResource() *CommentWithResourceView {
|
||||
return &CommentWithResourceView{
|
||||
ID: c.ID,
|
||||
Content: c.Content,
|
||||
CreatedAt: c.CreatedAt,
|
||||
Resource: c.Resource.ToView(),
|
||||
User: c.User.ToView(),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user