Files
tp/main_dc/yalarba/api_yal/internal/models/comment.go
T
valitovgaziz f304f982c0 On branch main
modified:   main_dc/yalarba/api_yal/go.sum
	modified:   main_dc/yalarba/api_yal/internal/domain/account/dto.go
	modified:   main_dc/yalarba/api_yal/internal/models/account.go
	modified:   main_dc/yalarba/api_yal/internal/models/appeal.go
	modified:   main_dc/yalarba/api_yal/internal/models/comment.go
	modified:   main_dc/yalarba/api_yal/internal/models/feedback.go
	modified:   main_dc/yalarba/api_yal/internal/models/password_reset.go
	modified:   main_dc/yalarba/api_yal/internal/models/rating.go
	modified:   "main_dc/yalarba/api_yal/internal/models/\320\276bject.go"
set embedded base model anonimus as realy embedded struct
without set name for field base
2026-03-31 07:55:55 +05:00

29 lines
1.3 KiB
Go

package models
import ()
// Comment представляет комментарий к отзыву (Feedback)
type Comment struct {
/*ID, CreatedAt, UpdatedAt, DeletedAt (Update's history)*/
Base `gorm:"embedded"`
// Автор комментария
AuthorID uint `gorm:"not null;index" json:"author_id"`
Author Account `gorm:"foreignKey:AuthorID;references:ID" json:"author,omitempty"`
// Отзыв, к которому оставлен комментарий
FeedbackID uint `gorm:"not null;index" json:"feedback_id"`
Feedback Feedback `gorm:"foreignKey:FeedbackID;references:ID" json:"feedback,omitempty"`
// Содержание комментария
Text string `gorm:"not null" json:"text"`
// Для поддержки вложенных комментариев (ответы на комментарии)
ParentID *uint `gorm:"index" json:"parent_id,omitempty"` // NULL для корневых комментариев
Parent *Comment `gorm:"foreignKey:ParentID;references:ID" json:"parent,omitempty"`
Replies []Comment `gorm:"foreignKey:ParentID;references:ID" json:"replies,omitempty"`
// Статус
IsEdited bool `gorm:"default:false" json:"is_edited"`
IsVerified bool `gorm:"default:false" json:"is_verified"` // если нужна модерация
}