mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
feat: add simple audit ui
This commit is contained in:
@@ -1049,4 +1049,16 @@ func (r *SqlRepo) SaveAuditEntry(ctx context.Context, entry *domain.AuditEntry)
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAllAuditEntries retrieves all audit entries from the database.
|
||||
// The entries are ordered by timestamp, with the newest entries first.
|
||||
func (r *SqlRepo) GetAllAuditEntries(ctx context.Context) ([]domain.AuditEntry, error) {
|
||||
var entries []domain.AuditEntry
|
||||
err := r.db.WithContext(ctx).Order("created_at desc").Find(&entries).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// endregion audit
|
||||
|
Reference in New Issue
Block a user