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
31 lines
1.2 KiB
SQL
31 lines
1.2 KiB
SQL
-- Migration: Create activity_logs table
|
|
-- Description: Stores activity logs for auditing and monitoring
|
|
|
|
CREATE TABLE IF NOT EXISTS activity_logs (
|
|
id SERIAL PRIMARY KEY,
|
|
user_id INT REFERENCES users(id) ON DELETE SET NULL,
|
|
tenant_id VARCHAR(36), -- For multi-tenant tracking
|
|
|
|
-- Activity Info
|
|
action VARCHAR(100) NOT NULL, -- e.g., 'user.login', 'job.create', 'application.submit'
|
|
resource_type VARCHAR(50), -- e.g., 'user', 'job', 'application', 'company'
|
|
resource_id VARCHAR(50), -- ID of the affected resource
|
|
|
|
-- Details
|
|
description TEXT,
|
|
metadata JSONB, -- Additional context data
|
|
ip_address VARCHAR(45),
|
|
user_agent TEXT,
|
|
|
|
-- Metadata
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Indexes for efficient querying
|
|
CREATE INDEX idx_activity_logs_user ON activity_logs(user_id);
|
|
CREATE INDEX idx_activity_logs_tenant ON activity_logs(tenant_id);
|
|
CREATE INDEX idx_activity_logs_action ON activity_logs(action);
|
|
CREATE INDEX idx_activity_logs_resource ON activity_logs(resource_type, resource_id);
|
|
CREATE INDEX idx_activity_logs_created ON activity_logs(created_at DESC);
|
|
|
|
COMMENT ON TABLE activity_logs IS 'Audit log of all system activities';
|