|
@@ -9,7 +9,7 @@ import (
|
|
"gorm.io/datatypes"
|
|
"gorm.io/datatypes"
|
|
)
|
|
)
|
|
|
|
|
|
-type Activity struct {
|
|
|
|
|
|
+type Event struct {
|
|
ID string `gorm:"primaryKey" json:"id"`
|
|
ID string `gorm:"primaryKey" json:"id"`
|
|
Action models.Action `gorm:"action" json:"action"`
|
|
Action models.Action `gorm:"action" json:"action"`
|
|
Source datatypes.JSON `gorm:"source" json:"source"`
|
|
Source datatypes.JSON `gorm:"source" json:"source"`
|
|
@@ -19,19 +19,19 @@ type Activity struct {
|
|
TimeStamp time.Time `gorm:"time_stamp" json:"time_stamp"`
|
|
TimeStamp time.Time `gorm:"time_stamp" json:"time_stamp"`
|
|
}
|
|
}
|
|
|
|
|
|
-func (a *Activity) Get(ctx context.Context) error {
|
|
|
|
- return db.FromContext(ctx).Model(&Activity{}).First(&a).Where("id = ?", a.ID).Error
|
|
|
|
|
|
+func (a *Event) Get(ctx context.Context) error {
|
|
|
|
+ return db.FromContext(ctx).Model(&Event{}).First(&a).Where("id = ?", a.ID).Error
|
|
}
|
|
}
|
|
|
|
|
|
-func (a *Activity) Update(ctx context.Context) error {
|
|
|
|
- return db.FromContext(ctx).Model(&Activity{}).Where("id = ?", a.ID).Updates(&a).Error
|
|
|
|
|
|
+func (a *Event) Update(ctx context.Context) error {
|
|
|
|
+ return db.FromContext(ctx).Model(&Event{}).Where("id = ?", a.ID).Updates(&a).Error
|
|
}
|
|
}
|
|
|
|
|
|
-func (a *Activity) Create(ctx context.Context) error {
|
|
|
|
- return db.FromContext(ctx).Model(&Activity{}).Create(&a).Error
|
|
|
|
|
|
+func (a *Event) Create(ctx context.Context) error {
|
|
|
|
+ return db.FromContext(ctx).Model(&Event{}).Create(&a).Error
|
|
}
|
|
}
|
|
|
|
|
|
-func (a *Activity) List(ctx context.Context) (ats []Activity, err error) {
|
|
|
|
- err = db.FromContext(ctx).Model(&Activity{}).Find(&ats).Error
|
|
|
|
|
|
+func (a *Event) List(ctx context.Context) (ats []Event, err error) {
|
|
|
|
+ err = db.FromContext(ctx).Model(&Event{}).Find(&ats).Error
|
|
return
|
|
return
|
|
}
|
|
}
|