Add description for event table
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -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")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user