Backend: - Password reset flow (forgot/reset endpoints, tokens table) - Profile management (PUT /users/me, skills, experience, education) - Tickets system (CRUD, messages, stats) - Activity logs (list, stats) - Document validator (CNPJ, CPF, EIN support) - Input sanitizer (XSS prevention) - Full-text search em vagas (plainto_tsquery) - Filtros avançados (location, salary, workMode) - Ordenação (date, salary, relevance) Frontend: - Forgot/Reset password pages - Candidate profile edit page - Sanitize utilities (sanitize.ts) Backoffice: - TicketsModule proxy - ActivityLogsModule proxy - Dockerfile otimizado (multi-stage, non-root, healthcheck) Migrations: - 013: Profile fields to users - 014: Password reset tokens - 015: Tickets table - 016: Activity logs table
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// ActivityLog represents an audit log entry
|
|
type ActivityLog struct {
|
|
ID int `json:"id" db:"id"`
|
|
UserID *int `json:"userId,omitempty" db:"user_id"`
|
|
TenantID *string `json:"tenantId,omitempty" db:"tenant_id"`
|
|
Action string `json:"action" db:"action"`
|
|
ResourceType *string `json:"resourceType,omitempty" db:"resource_type"`
|
|
ResourceID *string `json:"resourceId,omitempty" db:"resource_id"`
|
|
Description *string `json:"description,omitempty" db:"description"`
|
|
Metadata []byte `json:"metadata,omitempty" db:"metadata"` // JSONB
|
|
IPAddress *string `json:"ipAddress,omitempty" db:"ip_address"`
|
|
UserAgent *string `json:"userAgent,omitempty" db:"user_agent"`
|
|
CreatedAt time.Time `json:"createdAt" db:"created_at"`
|
|
|
|
// Joined
|
|
UserName *string `json:"userName,omitempty"`
|
|
}
|
|
|
|
// ActivityLogFilter for querying logs
|
|
type ActivityLogFilter struct {
|
|
UserID *int
|
|
TenantID *string
|
|
Action *string
|
|
ResourceType *string
|
|
StartDate *time.Time
|
|
EndDate *time.Time
|
|
Limit int
|
|
Offset int
|
|
}
|
|
|
|
// ActivityLogStats for dashboard
|
|
type ActivityLogStats struct {
|
|
TotalToday int `json:"totalToday"`
|
|
TotalThisWeek int `json:"totalThisWeek"`
|
|
TotalThisMonth int `json:"totalThisMonth"`
|
|
TopActions []ActionCount `json:"topActions"`
|
|
RecentActivity []ActivityLog `json:"recentActivity"`
|
|
}
|
|
|
|
type ActionCount struct {
|
|
Action string `json:"action"`
|
|
Count int `json:"count"`
|
|
}
|