29 lines
646 B
Go
29 lines
646 B
Go
package services
|
|
|
|
import (
|
|
"authentication/db"
|
|
"authentication/models"
|
|
)
|
|
|
|
func InsertAccessLogLogin(log models.UserAccessLog) error {
|
|
query := `INSERT INTO access_log (
|
|
user_id,
|
|
activity_type,
|
|
ip_address,
|
|
field_updated,
|
|
time)
|
|
VALUES (?, ?, ?, ?, ?)`
|
|
|
|
_, err := db.DB.Exec(query, log.UserID, log.ActivityType, log.IPAddress, log.FieldUpdated, log.Time)
|
|
return err
|
|
}
|
|
|
|
func GetActivityMessages(id int) (description string, err error) {
|
|
query := `SELECT Description FROM activity_type WHERE id = ?`
|
|
err = db.DB.QueryRow(query, id).Scan(&description)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return description, nil
|
|
}
|