Migrate easysite from api_es to api_yal
- Remove api_es service, Dockerfile, all Go source files - Remove api_es from docker-compose.yml, nginx-ssl.conf, .env, Makefile - Replace nginx /api/ proxy with /api/v1/ → api_yal:8787 - Add amenity/upload domains, AuthResponse, GET /auth/me, GET /objects/my to api_yal - Rewrite easysite frontend: types, composables, and all 5 pages to use api_yal DTOs - Wire nuxt.config public.apiBase, add useObjects CRUD composable - Update docs references from api_es to api_yal
This commit is contained in:
@@ -2,6 +2,16 @@ package models
|
||||
|
||||
import ()
|
||||
|
||||
type ObjectStatus string
|
||||
|
||||
const (
|
||||
ObjectStatusDraft ObjectStatus = "draft"
|
||||
ObjectStatusModeration ObjectStatus = "moderation"
|
||||
ObjectStatusActive ObjectStatus = "active"
|
||||
ObjectStatusInactive ObjectStatus = "inactive"
|
||||
ObjectStatusRejected ObjectStatus = "rejected"
|
||||
)
|
||||
|
||||
type Object struct {
|
||||
/*ID, CreatedAt, UpdatedAt, DeletedAt (Update's history)*/
|
||||
Base `gorm:"embedded"`
|
||||
@@ -11,12 +21,14 @@ type Object struct {
|
||||
Owner Account `gorm:"foreignKey:OwnerID;references:ID" json:"owner"`
|
||||
|
||||
// Основная информация
|
||||
// короткое название
|
||||
Title string `gorm:"default:''" json:"title"`
|
||||
ShortName string `gorm:"not null" json:"short_name"`
|
||||
// длинное название
|
||||
LongName string `json:"long_name"`
|
||||
// тип места отдыха
|
||||
Type string `json:"type"`
|
||||
LongName string `json:"long_name"`
|
||||
Type string `json:"type"`
|
||||
|
||||
// Цена
|
||||
Price float64 `gorm:"default:0" json:"price"`
|
||||
PricePeriod string `gorm:"default:'per_unit'" json:"price_period"`
|
||||
|
||||
// контактные данные
|
||||
Phone string `json:"phone"`
|
||||
@@ -35,8 +47,10 @@ type Object struct {
|
||||
Longitude float64 `json:"longitude"`
|
||||
|
||||
// Статус объекта
|
||||
IsActive bool `gorm:"default:true;index" json:"is_active"`
|
||||
IsVerified bool `gorm:"default:false" json:"is_verified"`
|
||||
IsActive bool `gorm:"default:true;index" json:"is_active"`
|
||||
IsVerified bool `gorm:"default:false" json:"is_verified"`
|
||||
Status ObjectStatus `gorm:"default:active" json:"status"`
|
||||
ViewCount int `gorm:"default:0" json:"view_count"`
|
||||
|
||||
// Связи с рейтингами (для разных платформ)
|
||||
TouristRating *Rating `gorm:"foreignKey:ObjectID;references:ID;where:platform='tourist'" json:"tourist_rating,omitempty"`
|
||||
@@ -48,4 +62,26 @@ type Object struct {
|
||||
// Связи с отзывами
|
||||
Feedbacks []Feedback `gorm:"foreignKey:ObjectID" json:"feedbacks,omitempty"`
|
||||
FeedbackCount int `gorm:"default:0" json:"feedback_count"`
|
||||
|
||||
// Изображения
|
||||
Images []ObjectImage `gorm:"foreignKey:ObjectID" json:"images,omitempty"`
|
||||
|
||||
// Удобства (many-to-many)
|
||||
Amenities []Amenity `gorm:"many2many:object_amenities;" json:"amenities,omitempty"`
|
||||
}
|
||||
|
||||
type ObjectImage struct {
|
||||
Base `gorm:"embedded"`
|
||||
ObjectID uint `gorm:"not null;index" json:"object_id"`
|
||||
URL string `gorm:"not null" json:"url"`
|
||||
IsPrimary bool `gorm:"default:false" json:"is_primary"`
|
||||
SortOrder int `gorm:"default:0" json:"sort_order"`
|
||||
}
|
||||
|
||||
type Amenity struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"uniqueIndex;not null" json:"name"`
|
||||
Category string `json:"category"`
|
||||
Icon string `json:"icon"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user