Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley committed Jun 11, 2024
1 parent 569a5c4 commit 7d5321e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/entities/events/base/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func (e *EventService) DeleteEvent(eventID string) error {
return DeleteEvent(e.DB, *idAsUUID)
}

func serviceGetEvents[E any](db *gorm.DB, pageInfo fiberpaginate.PageInfo, start string, end string, getItemsFunc func(*gorm.DB, fiberpaginate.PageInfo) ([]E, error), getItemsByTimeFunc func(*gorm.DB, fiberpaginate.PageInfo, time.Time, time.Time) ([]E, error)) ([]E, error) {
func serviceGetEvents[E any](db *gorm.DB, pageInfo fiberpaginate.PageInfo, start string, end string, getEFunc func(*gorm.DB, fiberpaginate.PageInfo) ([]E, error), getEByTimeFunc func(*gorm.DB, fiberpaginate.PageInfo, time.Time, time.Time) ([]E, error)) ([]E, error) {
if start == "" || end == "" {
return getItemsFunc(db, pageInfo)
return getEFunc(db, pageInfo)
}

startTime, err := utilities.ParseTime(start, utilities.YYYY_dash_MM_dash_DD)
Expand All @@ -103,5 +103,5 @@ func serviceGetEvents[E any](db *gorm.DB, pageInfo fiberpaginate.PageInfo, start
return nil, utilities.BadRequest(errors.New("start time must be before end time"))
}

return getItemsByTimeFunc(db, pageInfo, *startTime, *endTime)
return getEByTimeFunc(db, pageInfo, *startTime, *endTime)
}

0 comments on commit 7d5321e

Please sign in to comment.