Files
Mazyar 241e3b5f2d Implement audit logging functionality across services and middleware
- Introduced a new `auditlog` package to handle audit logging for user actions, including creation, updates, deletions, and authentication events.
- Enhanced existing services (customer, user) to log relevant actions using the new audit logger, capturing details such as actor ID, action type, target type, and success status.
- Added middleware to enrich request context with metadata for audit logging, ensuring comprehensive tracking of user interactions.
- Integrated Elasticsearch for persistent storage of audit logs, with fallback to file-only logging if Elasticsearch is unavailable.
- Updated API documentation to include new audit log endpoints for administrative access.

This update significantly improves the system's ability to track and audit user actions, enhancing security and accountability within the application.
2026-06-29 21:11:33 +03:30

26 lines
549 B
Go

package auditlog
import (
"context"
"tm/pkg/audit"
)
// Repository defines audit log data access.
type Repository interface {
Search(ctx context.Context, filter audit.SearchFilter) (*audit.SearchResult, error)
}
type repository struct {
store audit.Store
}
// NewRepository creates an audit log repository.
func NewRepository(store audit.Store) Repository {
return &repository{store: store}
}
func (r *repository) Search(ctx context.Context, filter audit.SearchFilter) (*audit.SearchResult, error) {
return r.store.Search(ctx, filter)
}