v0.0.33 Уведомления о лайках
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
59220f4e43
commit
ecf62c7346
@ -132,7 +132,7 @@ func main() {
|
||||
userService := service.NewUserService(userRepo)
|
||||
postService := service.NewPostService(postRepo)
|
||||
commentService := service.NewCommentService(commentRepo, postRepo)
|
||||
likeService := service.NewLikeService(likeRepo, postRepo)
|
||||
likeService := service.NewLikeService(likeRepo, postRepo, userRepo)
|
||||
auditService := service.NewAuditService(auditRepo)
|
||||
recoveryService := service.NewRecoveryService(recoveryRepo, userRepo, sessionRepo, deviceRepo, mailService)
|
||||
sessionService := service.NewSessionService(sessionRepo, deviceRepo, userRepo, mailService)
|
||||
|
||||
@ -49,25 +49,33 @@ type Like struct {
|
||||
}
|
||||
|
||||
type LikeNotification struct {
|
||||
ID int `json:"id"`
|
||||
LikerID int `json:"-"` // Для внутреннего использования
|
||||
Liker *User `json:"liker"` // Для GraphQL
|
||||
PostID int `json:"-"` // Для внутреннего использования
|
||||
Post *Post `json:"post"` // Для GraphQL
|
||||
IsRead bool `json:"isRead"`
|
||||
CreatedAt time.Time `json:"-"`
|
||||
CreatedAtStr string `json:"createdAt"` // Для GraphQL
|
||||
ID int `json:"id"`
|
||||
LikerID int `json:"-"` // Для внутреннего использования
|
||||
Liker *User `json:"liker"` // Для GraphQL
|
||||
LikerUsername string `json:"likerUsername"` // Добавьте это поле
|
||||
LikerAvatar string `json:"likerAvatar"` // Добавьте это поле
|
||||
PostID int `json:"-"` // Для внутреннего использования
|
||||
Post *Post `json:"post"` // Для GraphQL
|
||||
PostTitle string `json:"postTitle"` // Добавьте это поле
|
||||
PostAuthorID int `json:"postAuthorId"` // Добавьте это поле
|
||||
IsRead bool `json:"isRead"`
|
||||
CreatedAt time.Time `json:"-"`
|
||||
CreatedAtStr string `json:"createdAt"` // Для GraphQL
|
||||
}
|
||||
|
||||
// Вспомогательные методы
|
||||
func (n *LikeNotification) SetLiker(user *User) {
|
||||
n.Liker = user
|
||||
n.LikerID = user.ID
|
||||
n.LikerUsername = user.Username // Добавьте эту строку
|
||||
n.LikerAvatar = user.Avatar // Добавьте эту строку
|
||||
}
|
||||
|
||||
func (n *LikeNotification) SetPost(post *Post) {
|
||||
n.Post = post
|
||||
n.PostID = post.ID
|
||||
n.PostTitle = post.Title // Добавьте эту строку
|
||||
n.PostAuthorID = post.AuthorID // Добавьте эту строку
|
||||
}
|
||||
|
||||
func (n *LikeNotification) SetCreatedAtStr() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user