From 5f7f078f02a043ca742e276297c1b92934734a2f Mon Sep 17 00:00:00 2001 From: Asai Neko Date: Mon, 5 Jan 2026 16:22:10 +0800 Subject: [PATCH] Add description for event table Signed-off-by: Asai Neko --- data/event.go | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/data/event.go b/data/event.go index fe7d966..cfa678c 100644 --- a/data/event.go +++ b/data/event.go @@ -10,21 +10,24 @@ import ( ) type Event struct { - Id uint `json:"id" gorm:"primarykey;autoincrement"` - UUID uuid.UUID `json:"uuid" 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"` - Type string `json:"type" gotm:"type:varchar(255);index;not null"` - StartTime time.Time `json:"start_time" gorm:"index"` - EndTime time.Time `json:"end_time" gorm:"index"` - Owner uuid.UUID `json:"owner" gorm:"type:uuid;index;not null"` + Id uint `json:"id" gorm:"primarykey;autoincrement"` + UUID uuid.UUID `json:"uuid" 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"` + Type string `json:"type" gotm:"type:varchar(255);index;not null"` + Description string `json:"description" gorm:"type:text;not null"` + StartTime time.Time `json:"start_time" gorm:"index"` + EndTime time.Time `json:"end_time" gorm:"index"` + Owner uuid.UUID `json:"owner" gorm:"type:uuid;index;not null"` } type EventSearchDoc struct { - EventId string `json:"event_id"` - Name string `json:"name"` - StartTime time.Time `json:"start_time"` - EndTime time.Time `json:"end_time"` + EventId string `json:"event_id"` + Name string `json:"name"` + Type string `json:"type"` + 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) { @@ -125,10 +128,12 @@ func (self *Event) FastListEvents(limit, offset int64) (*[]EventSearchDoc, error func (self *Event) UpdateSearchIndex() error { doc := EventSearchDoc{ - EventId: self.EventId.String(), - Name: self.Name, - StartTime: self.StartTime, - EndTime: self.EndTime, + EventId: self.EventId.String(), + Name: self.Name, + Type: self.Type, + Description: self.Description, + StartTime: self.StartTime, + EndTime: self.EndTime, } index := MeiliSearch.Index("event")