Explorar o código

order user activity event by timestamp

abhishek9686 hai 4 meses
pai
achega
efd2bab43c
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      schema/event.go

+ 1 - 1
schema/event.go

@@ -32,6 +32,6 @@ func (a *Event) Create(ctx context.Context) error {
 }
 
 func (a *Event) List(ctx context.Context) (ats []Event, err error) {
-	err = db.FromContext(ctx).Model(&Event{}).Find(&ats).Error
+	err = db.FromContext(ctx).Model(&Event{}).Order("time_stamp DESC").Find(&ats).Error
 	return
 }