116 lines
2.3 KiB
Markdown
116 lines
2.3 KiB
Markdown
# Todai Jobs - Seeder API
|
|
|
|
Microservice for seeding the Todai Jobs database with realistic sample data.
|
|
|
|
## Overview
|
|
|
|
This seeder populates the database with:
|
|
- ✅ 1 SuperAdmin user
|
|
- ✅ 10 real Japanese companies (Toyota, Honda, Denso, etc.)
|
|
- ✅ 8 Company Admins and Recruiters
|
|
- ✅ 30 Foreign Job Seekers (Brazilian, Filipino, Nepalese, etc.)
|
|
- ✅ 50 Realistic job listings
|
|
- ✅ 20 Sample applications
|
|
- ✅ 47 Japanese prefectures
|
|
- ✅ Cities for Aichi and Tokyo
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
cd seeder-api
|
|
npm install
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Create a `.env` file or use default values:
|
|
|
|
```env
|
|
DB_HOST=172.28.22.171
|
|
DB_PORT=5432
|
|
DB_USER=usuario
|
|
DB_PASSWORD=senha123
|
|
DB_NAME=todaijobs
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Full Seed
|
|
```bash
|
|
npm run seed
|
|
```
|
|
|
|
### Reset Database (Drop all tables)
|
|
```bash
|
|
npm run seed:reset
|
|
```
|
|
|
|
### Seed Specific Tables
|
|
```bash
|
|
npm run seed:users
|
|
npm run seed:companies
|
|
npm run seed:jobs
|
|
```
|
|
|
|
## Login Credentials
|
|
|
|
### SuperAdmin
|
|
- **Identifier**: `superadmin`
|
|
- **Password**: `Admin@2025!`
|
|
|
|
### Company Admin (Multi-company: Toyota & Denso)
|
|
- **Identifier**: `takeshi_yamamoto`
|
|
- **Password**: `Takeshi@2025`
|
|
|
|
### Recruiter (Honda)
|
|
- **Identifier**: `maria_santos`
|
|
- **Password**: `Maria@2025`
|
|
|
|
### Job Seeker
|
|
- **Identifier**: `paulo_santos`
|
|
- **Password**: `User@2025`
|
|
|
|
_All job seekers use password: `User@2025`_
|
|
|
|
## Seeding Order
|
|
|
|
The seeder respects foreign key dependencies:
|
|
|
|
1. **Prefectures** (47 Japanese prefectures)
|
|
2. **Cities** (Aichi + Tokyo municipalities)
|
|
3. **Users** (SuperAdmin, Admins, Recruiters, JobSeekers)
|
|
4. **Companies** (10 major Japanese companies)
|
|
5. **UserCompany** (Multi-tenant associations)
|
|
6. **Jobs** (50 job listings)
|
|
7. **Applications** (20 sample applications)
|
|
|
|
## Database Schema
|
|
|
|
All tables are created via migrations in `/backend/migrations/`. This seeder only populates data.
|
|
|
|
## Development
|
|
|
|
The seeder uses:
|
|
- **pg**: PostgreSQL client
|
|
- **bcrypt**: Password hashing
|
|
- **dotenv**: Environment variables
|
|
|
|
## Notes
|
|
|
|
- Run migrations before seeding
|
|
- Use `--reset` flag carefully (destroys all data)
|
|
- Default passwords are for development only
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
# Fresh start
|
|
npm run seed:reset
|
|
cd ../backend
|
|
psql -h 172.28.22.171 -U usuario -d todaijobs -f migrations/*.sql
|
|
cd ../seeder-api
|
|
npm run seed
|
|
|
|
# Update data
|
|
npm run seed
|
|
```
|