- impl(frontend): server-side pagination for jobs listing - impl(frontend): standardized api error handling and sonner integration - test(frontend): added unit tests for JobCard - impl(backend): added SanitizeMiddleware for XSS protection - test(backend): added table-driven tests for JobService - docs: updated READMES, created ROADMAP.md and DATABASE.md - fix(routing): redirected landing page buttons to /jobs
108 lines
3.2 KiB
Markdown
108 lines
3.2 KiB
Markdown
# Database Schema Documentation
|
|
|
|
This document outlines the database schema for the GoHorseJobs platform, based on the backend Go models.
|
|
|
|
## Core Tables
|
|
|
|
### Users (`users`)
|
|
Represents system users including Candidates, Recruiters, and Admins.
|
|
- **id**: `INTEGER` (PK)
|
|
- **identifier**: `VARCHAR` (Unique, Email or Username)
|
|
- **password_hash**: `VARCHAR`
|
|
- **role**: `VARCHAR` (superadmin, companyAdmin, recruiter, jobSeeker)
|
|
- **full_name**: `VARCHAR`
|
|
- **language**: `VARCHAR` (Default: 'pt')
|
|
- **active**: `BOOLEAN`
|
|
- **created_at**, **updated_at**, **last_login_at**: `TIMESTAMP`
|
|
|
|
### Companies (`companies`)
|
|
Represents employer organizations.
|
|
- **id**: `INTEGER` (PK)
|
|
- **name**: `VARCHAR`
|
|
- **slug**: `VARCHAR` (Unique)
|
|
- **type**: `VARCHAR`
|
|
- **document**: `VARCHAR` (Houjin Bangou / CNPJ)
|
|
- **address**, **region_id**, **city_id**, **phone**, **email**, **website**: Contact info
|
|
- **logo_url**, **description**: Branding
|
|
- **active**, **verified**: `BOOLEAN`
|
|
- **created_at**, **updated_at**: `TIMESTAMP`
|
|
|
|
### Jobs (`jobs`)
|
|
Represents job postings.
|
|
- **id**: `INTEGER` (PK)
|
|
- **company_id**: `INTEGER` (FK -> companies.id)
|
|
- **created_by**: `INTEGER` (FK -> users.id)
|
|
- **title**: `VARCHAR`
|
|
- **description**: `TEXT`
|
|
- **salary_min**, **salary_max**: `DECIMAL`
|
|
- **salary_type**: `VARCHAR` (hourly, monthly, yearly)
|
|
- **employment_type**: `VARCHAR` (full-time, part-time, etc.)
|
|
- **work_mode**: `VARCHAR` (onsite, hybrid, remote)
|
|
- **location**, **region_id**, **city_id**: Location details
|
|
- **requirements**, **benefits**: `JSONB`
|
|
- **visa_support**: `BOOLEAN`
|
|
- **language_level**: `VARCHAR`
|
|
- **status**: `VARCHAR` (draft, published, closed, etc.)
|
|
- **is_featured**: `BOOLEAN`
|
|
- **created_at**, **updated_at**: `TIMESTAMP`
|
|
|
|
### Applications (`applications`)
|
|
Represents job applications.
|
|
- **id**: `INTEGER` (PK)
|
|
- **job_id**: `INTEGER` (FK -> jobs.id)
|
|
- **user_id**: `INTEGER` (FK -> users.id, Nullable for guests)
|
|
- **name**, **email**, **phone**, **line_id**, **whatsapp**: Applicant info
|
|
- **message**: `TEXT`
|
|
- **resume_url**: `VARCHAR`
|
|
- **documents**: `JSONB`
|
|
- **status**: `VARCHAR` (pending, reviewed, hired, etc.)
|
|
- **notes**: `TEXT`
|
|
- **created_at**, **updated_at**: `TIMESTAMP`
|
|
|
|
## Reference Tables
|
|
|
|
### Regions (`regions`)
|
|
- **id**: `INTEGER` (PK)
|
|
- **name**: `VARCHAR`
|
|
- **country_code**: `VARCHAR`
|
|
- **code**: `VARCHAR`
|
|
|
|
### Cities (`cities`)
|
|
- **id**: `INTEGER` (PK)
|
|
- **region_id**: `INTEGER` (FK -> regions.id)
|
|
- **name**: `VARCHAR`
|
|
|
|
### Tags (`tags`)
|
|
- **id**: `INTEGER` (PK)
|
|
- **name**: `VARCHAR`
|
|
- **category**: `VARCHAR`
|
|
- **active**: `BOOLEAN`
|
|
|
|
## Relations & Logs
|
|
|
|
### User Companies (`user_companies`)
|
|
Maps Users to Companies (N:M).
|
|
- **id**: `INTEGER` (PK)
|
|
- **user_id**: `INTEGER` (FK -> users.id)
|
|
- **company_id**: `INTEGER` (FK -> companies.id)
|
|
- **role**: `VARCHAR` (companyAdmin, recruiter)
|
|
- **permissions**: `JSONB`
|
|
|
|
### Favorite Jobs (`favorite_jobs`)
|
|
- **id**: `INTEGER` (PK)
|
|
- **user_id**: `INTEGER`
|
|
- **job_id**: `INTEGER`
|
|
|
|
### Login Audits (`login_audits`)
|
|
- **id**: `INTEGER` (PK)
|
|
- **user_id**: `VARCHAR`
|
|
- **identifier**: `VARCHAR`
|
|
- **ip_address**, **user_agent**: Metadata
|
|
- **created_at**: `TIMESTAMP`
|
|
|
|
### Password Resets (`password_resets`)
|
|
- **id**: `INTEGER` (PK)
|
|
- **user_id**: `INTEGER`
|
|
- **token**: `VARCHAR`
|
|
- **expires_at**: `TIMESTAMP`
|
|
- **used**: `BOOLEAN`
|