gohorsejobs/backend/README.md
Tiago Yamamoto 1c7ef95c1a first commit
2025-12-09 19:04:48 -03:00

4.6 KiB
Executable file
Raw Blame History

GoHorseJobs Backend

This is the backend for the GoHorseJobs application, built with Go and PostgreSQL.

Architecture

1. Core Module (Clean Architecture)

The project now includes a strictly decoupled internal/core module that follows Clean Architecture and DDD principles.

  • Pure Domain: internal/core/domain/entity (No external deps).
  • Ports: internal/core/ports (Interfaces for Repositories/Services).
  • UseCases: internal/core/usecases (Business Logic).

2. Multi-Tenancy

  • Strict Isolation: All core tables (core_companies, core_users) use UUIDs and strict Tenant FKs.
  • Middleware: TenantGuard automatically extracts Tenant context from JWTs.

3. Swagger API Docs

4. Super Admin Access

A seed migration is provided to create the initial system access.

  • Migration: migrations/010_seed_super_admin.sql
  • User: admin@gohorse.com
  • Password: password123

Prerequisites

  • Docker
  • Docker Compose
  • Go 1.22+

Getting Started

  1. Start the services:

    docker-compose up --build
    

    This will start the PostgreSQL database and the Go API server.

    Alternatively, use the running script in the root:

    ./run_dev.sh
    
  2. Access the API:

    The API will be available at http://localhost:8080.

    • Health Check: GET /health
    • List Jobs: GET /jobs
    • Create Job: POST /jobs

API Endpoints

GET /health

Returns 200 OK if the server is running.

GET /jobs

Returns a list of all jobs.

Response:

[
  {
    "id": 1,
    "title": "Software Engineer",
    "description": "Develop Go applications.",
    "company_name": "Tech Corp",
    "location": "Remote",
    "salary_range": "$100k - $120k",
    "created_at": "2023-10-27T10:00:00Z"
  }
]

POST /jobs

Creates a new job.

Request Body:

{
  "title": "Software Engineer",
  "description": "Develop Go applications.",
  "company_name": "Tech Corp",
  "location": "Remote",
  "salary_range": "$100k - $120k"
}

Response:

Returns the created job with its ID and creation timestamp.


📚 Feature Documentation (Archives)

Note

The following documentation describes features implemented in the application, including Frontend components and Local Database logic. They have been consolidated here for reference.

🗄️ Local Database - Profile System (Legacy/Frontend)

Full local database system using localStorage to manage profile photos and user data.

🚀 Usage

1. Page with Database

Access: http://localhost:3000/profile-db

2. Features Implemented

📸 Profile Picture Upload

  • Click to select image
  • Automatic validation (JPG, PNG, GIF, WebP)
  • 2MB limit per file
  • Instant preview
  • Auto-save to localStorage
  • Loading indicator
  • Remove photo button

🗃️ Local Database

  • Auto-save to localStorage
  • Persistence between sessions
  • Export data (JSON backup)
  • Clear all data
  • User structure
  • Creation/update timestamps

🔧 useProfile Hook

  • Reactive state management
  • Loading states
  • Full CRUD
  • Auto synchronization

🏢 Company Dashboard (Frontend Features)

Complete Features

1 Job Management

Page: /dashboard/empresa/vagas

  • Full listing of published jobs
  • Statistics per job
  • Search and filters
  • Quick actions: View, Edit, Pause, Delete

2 Application Management

Page: /dashboard/empresa/candidaturas

  • View all received applications
  • Statistics cards by status
  • Tabs system
  • Search by candidate name
  • Quick actions: Approve, Reject, Email

3 Messaging System

Page: /dashboard/empresa/mensagens

  • WhatsApp/Slack style chat interface
  • Conversation list with unread counters
  • Real-time message attachment
  • Responsive design

4 Analytics & Reports

Page: /dashboard/empresa/relatorios

  • Key metrics cards
  • Period selector
  • Conversion funnel
  • Hiring time by role

5 Company Profile

Page: /dashboard/empresa/perfil

  • Real logo upload
  • Basic info management
  • Social media links
  • Culture description

🎨 Design System

Stack:

  • shadcn/ui
  • Tailwind CSS
  • Lucide Icons
  • Framer Motion

Colors:

  • Primary: Blue
  • Success: Green
  • Warning: Yellow
  • Danger: Red
  • Muted: Gray