Passport/pkg/services/events.go
2024-01-30 17:57:23 +08:00

21 lines
395 B
Go

package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
)
func AddEvent(user models.Account, event, target, ip, ua string) models.ActionEvent {
evt := models.ActionEvent{
Type: event,
Target: target,
IpAddress: ip,
UserAgent: ua,
AccountID: user.ID,
}
database.C.Save(&evt)
return evt
}