added frontend and made it usable
This commit is contained in:
1 parent
96408f00d8
commit
b9b15152bc
50 files changed
+7974
-1
No files matched your search
@@ -0,0 +1,12 @@
|
||||
package models
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ApiResponseRaw struct {
|
||||
Status string `json:"status"`
|
||||
Count int `json:"count"`
|
||||
OverallCount int `json:"overallcount"`
|
||||
Channels []interface{} `json:"channels"`
|
||||
FacetGroups []interface{} `json:"facetGroups"`
|
||||
Items []json.RawMessage `json:"items"` // Raw JSON for items
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package models
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type Event struct {
|
||||
gorm.Model
|
||||
ExternalID string `gorm:"uniqueIndex" json:"id"`
|
||||
Title string `json:"title"`
|
||||
City string `json:"city"`
|
||||
Street string `json:"street"`
|
||||
Country string
|
||||
Categories []Category `gorm:"many2many:event_categories;" json:"-"`
|
||||
CategoryNames []string `gorm:"-" json:"categories"` // used only for JSON decoding MediaObjects []MediaObject `json:"media_objects"`
|
||||
Features []string `gorm:"-" json:"features"`
|
||||
Keywords []string `gorm:"-" json:"keywords"`
|
||||
Type string
|
||||
Zip string
|
||||
Phone string
|
||||
Web string
|
||||
Email string
|
||||
Author string
|
||||
Latitude float64 `gorm:"index"`
|
||||
Longitude float64 `gorm:"index"`
|
||||
Geo *GeoWrapper `gorm:"-" json:"geo"` // ignored by GORM, used for JSON
|
||||
Description string
|
||||
Teaser string
|
||||
StartDate string
|
||||
EndDate string
|
||||
MediaObjects []MediaObject `gorm:"many2many:event_media_objects;" json:"-"`
|
||||
RawMediaObjects []MediaObject `gorm:"-" json:"media_objects"`
|
||||
}
|
||||
|
||||
type MediaObject struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
URL string `json:"url"`
|
||||
Alt string `json:"alt"`
|
||||
Rel string `json:"rel"`
|
||||
Name string `json:"value" `
|
||||
Type string `json:"type"`
|
||||
RefID string `json:"id"`
|
||||
Source string `json:"source"`
|
||||
Prio int `json:"prio"`
|
||||
Description string `json:"description"`
|
||||
License string `json:"license"`
|
||||
AiOptimized bool `json:"aiOptimized"`
|
||||
Ext string
|
||||
Hash string
|
||||
}
|
||||
|
||||
type Category struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"uniqueIndex"`
|
||||
}
|
||||
|
||||
type GeoWrapper struct {
|
||||
Main *GeoCoordinates `json:"main"`
|
||||
}
|
||||
|
||||
type GeoCoordinates struct {
|
||||
Latitude float64 `json:"latitude"`
|
||||
Longitude float64 `json:"longitude"`
|
||||
}
|
||||
|
||||
func Migrate(db *gorm.DB) {
|
||||
db.AutoMigrate(&Event{}, &Category{}, &MediaObject{})
|
||||
}
|
||||
Reference in new issue
Block a user