diff --git a/backend/entities/events/previews/transactions.go b/backend/entities/events/previews/transactions.go index f93c30ce..1c2636b6 100644 --- a/backend/entities/events/previews/transactions.go +++ b/backend/entities/events/previews/transactions.go @@ -15,7 +15,7 @@ import ( func GetEventPreivews(db *gorm.DB, pageInfo *fiberpaginate.PageInfo) ([]EventPreview, error) { db = cache.SetUseCache(db, true) - + var events []EventStub if err := db.Scopes(utilities.IntoScope(*pageInfo, db)).Find(&events).Error; err != nil { return nil, err @@ -25,6 +25,8 @@ func GetEventPreivews(db *gorm.DB, pageInfo *fiberpaginate.PageInfo) ([]EventPre } func GetEventPreviewsByTime(db *gorm.DB, pageInfo *fiberpaginate.PageInfo, startTime *time.Time, endTime *time.Time) ([]EventPreview, error) { + var events []EventStub + query := cache.SetUseCache(db, true).Model(&events) if startTime != nil && endTime != nil { @@ -35,7 +37,6 @@ func GetEventPreviewsByTime(db *gorm.DB, pageInfo *fiberpaginate.PageInfo, start query = query.Scopes(utilities.IntoScope(*pageInfo, db)) } - var events []EventStub if err := query.Find(&events).Error; err != nil { return nil, err } diff --git a/backend/entities/events/transactions.go b/backend/entities/events/transactions.go index 7b4baaa2..e8f236d6 100644 --- a/backend/entities/events/transactions.go +++ b/backend/entities/events/transactions.go @@ -23,17 +23,6 @@ func GetEvents(db *gorm.DB, pageInfo fiberpaginate.PageInfo) ([]models.Event, er return events, nil } -func GetEvent(db *gorm.DB, eventID uuid.UUID, preloads ...transactions.OptionalQuery) (*models.Event, error) { - db = cache.SetUseCache(db, true) - - var event models.Event - if err := db.Scopes(utilities.IntoScope(pageInfo, db)).Find(&events).Error; err != nil { - return nil, err - } - - return events, nil -} - func GetEvent(db *gorm.DB, eventID uuid.UUID, preloads ...transactions.OptionalQuery) (*models.Event, error) { query := cache.SetUseCache(db, true)