Passport/pkg/internal/services/events.go
2024-06-16 23:17:32 +08:00

21 lines
383 B
Go

package services
import (
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/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
}