Add description for event table
All checks were successful
Build Backend (NixCN CMS) TeamCity build finished
Build Frontend (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-05 16:22:10 +08:00
parent 1adfda54a6
commit 5f7f078f02

View File

@@ -10,21 +10,24 @@ import (
) )
type Event struct { type Event struct {
Id uint `json:"id" gorm:"primarykey;autoincrement"` Id uint `json:"id" gorm:"primarykey;autoincrement"`
UUID uuid.UUID `json:"uuid" gorm:"type:uuid;uniqueIndex;not null"` UUID uuid.UUID `json:"uuid" gorm:"type:uuid;uniqueIndex;not null"`
EventId uuid.UUID `json:"event_id" gorm:"type:uuid;uniqueIndex;not null"` EventId uuid.UUID `json:"event_id" gorm:"type:uuid;uniqueIndex;not null"`
Name string `json:"name" gorm:"type:varchar(255);index;not null"` Name string `json:"name" gorm:"type:varchar(255);index;not null"`
Type string `json:"type" gotm:"type:varchar(255);index;not null"` Type string `json:"type" gotm:"type:varchar(255);index;not null"`
StartTime time.Time `json:"start_time" gorm:"index"` Description string `json:"description" gorm:"type:text;not null"`
EndTime time.Time `json:"end_time" gorm:"index"` StartTime time.Time `json:"start_time" gorm:"index"`
Owner uuid.UUID `json:"owner" gorm:"type:uuid;index;not null"` EndTime time.Time `json:"end_time" gorm:"index"`
Owner uuid.UUID `json:"owner" gorm:"type:uuid;index;not null"`
} }
type EventSearchDoc struct { type EventSearchDoc struct {
EventId string `json:"event_id"` EventId string `json:"event_id"`
Name string `json:"name"` Name string `json:"name"`
StartTime time.Time `json:"start_time"` Type string `json:"type"`
EndTime time.Time `json:"end_time"` Description string `json:"description"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
} }
func (self *Event) GetEventById(eventId uuid.UUID) (*Event, error) { func (self *Event) GetEventById(eventId uuid.UUID) (*Event, error) {
@@ -125,10 +128,12 @@ func (self *Event) FastListEvents(limit, offset int64) (*[]EventSearchDoc, error
func (self *Event) UpdateSearchIndex() error { func (self *Event) UpdateSearchIndex() error {
doc := EventSearchDoc{ doc := EventSearchDoc{
EventId: self.EventId.String(), EventId: self.EventId.String(),
Name: self.Name, Name: self.Name,
StartTime: self.StartTime, Type: self.Type,
EndTime: self.EndTime, Description: self.Description,
StartTime: self.StartTime,
EndTime: self.EndTime,
} }
index := MeiliSearch.Index("event") index := MeiliSearch.Index("event")