Files
tp/main_dc/yalarba/api_yal/internal/models/оbject.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

52 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import ()
type Object struct {
/*ID, CreatedAt, UpdatedAt, DeletedAt (Update's history)*/
Base `gorm:"embedded"`
// owner account ID
OwnerID uint `json:"owner_id"`
Owner Account `gorm:"foreignKey:OwnerID;references:ID" json:"owner"`
// Основная информация
// короткое название
ShortName string `gorm:"not null" json:"short_name"`
// длинное название
LongName string `json:"long_name"`
// тип места отдыха
Type string `json:"type"`
// контактные данные
Phone string `json:"phone"`
Email string `json:"email"`
// ссылка на сайт
Site string `json:"site"`
// короткое описание
ShortDescription string `json:"short_description"`
// полное описание
Description string `json:"description"`
// адресс
Address string `json:"address"`
// Геолокация долгота и широта
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
// Статус объекта
IsActive bool `gorm:"default:true;index" json:"is_active"`
IsVerified bool `gorm:"default:false" json:"is_verified"`
// Связи с рейтингами (для разных платформ)
TouristRating *Rating `gorm:"foreignKey:ObjectID;references:ID;where:platform='tourist'" json:"tourist_rating,omitempty"`
EntrepreneurRating *Rating `gorm:"foreignKey:ObjectID;references:ID;where:platform='entrepreneur'" json:"entrepreneur_rating,omitempty"`
// Все рейтинги объекта (если нужно получить оба сразу)
Ratings []Rating `gorm:"foreignKey:ObjectID" json:"ratings,omitempty"`
// Связи с отзывами
Feedbacks []Feedback `gorm:"foreignKey:ObjectID" json:"feedbacks,omitempty"`
FeedbackCount int `gorm:"default:0" json:"feedback_count"`
}