fix: all seeder INSERT column mismatches

- applications.js: remove UUID id, let DB auto-generate SERIAL
- fictional-companies.js: fix Los Pollos and Springfield to use slug instead of UUID
- fictional-companies.js: fix all VALUES 7 to 6 (16 columns)
- epic-companies.js: fix VALUES 7 to 6
This commit is contained in:
Tiago Yamamoto 2025-12-24 12:04:01 -03:00
parent b454ae05a1
commit 4b680f2c31
3 changed files with 28 additions and 30 deletions

View file

@ -88,11 +88,10 @@ export async function seedApplications() {
createdAt.setDate(createdAt.getDate() - daysAgo);
await pool.query(`
INSERT INTO applications (id, job_id, name, email, phone, whatsapp, message, resume_url, status, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
ON CONFLICT (id) DO NOTHING
INSERT INTO applications (job_id, name, email, phone, whatsapp, message, resume_url, status, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
ON CONFLICT DO NOTHING
`, [
appId,
job.id,
candidate.name,
candidate.email,

View file

@ -299,7 +299,7 @@ async function createCompanyAndJobs(companyData, jobs) {
INSERT INTO jobs ( company_id, created_by, title, description,
salary_min, salary_max, salary_type, employment_type, working_hours,
location, requirements, benefits, visa_support, language_level, status, work_mode)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
`, [
companyId,

View file

@ -190,14 +190,13 @@ export async function seedStarkIndustries() {
for (let i = 0; i < starkJobs.length; i++) {
const job = starkJobs[i];
await pool.query(`
INSERT INTO jobs ( company_id, created_by, title, description,
salary_min, salary_max, salary_type, employment_type, working_hours,
location, requirements, benefits, visa_support, language_level, status, work_mode)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
`, [
companyId,
seedUserId,
job.title,
@ -257,16 +256,16 @@ export async function seedLosPollosHermanos() {
true
]);
// Core Company
// Create company (let DB auto-generate id)
await pool.query(`
INSERT INTO companies (id, name, document, status)
VALUES ($1, $2, $3, 'ACTIVE')
ON CONFLICT (id) DO NOTHING
`, ['66666666-6666-6666-6666-666666666666', 'Los Pollos Hermanos', '66.666.666/0001-66']);
INSERT INTO companies (name, slug, document)
VALUES ($1, $2, $3)
ON CONFLICT (slug) DO NOTHING
`, ['Los Pollos Hermanos', 'los-pollos-hermanos', '66.666.666/0001-66']);
// Get company ID
// Get company ID (use coreId directly)
const companyId = '66666666-6666-6666-6666-666666666666';
// Get company ID (SERIAL)
const companyRes = await pool.query("SELECT id FROM companies WHERE slug = 'los-pollos-hermanos'");
const companyId = companyRes.rows[0]?.id;
const seedUserRes = await pool.query("SELECT id FROM users LIMIT 1");
const seedUserId = seedUserRes.rows[0]?.id || 1;
@ -275,14 +274,14 @@ export async function seedLosPollosHermanos() {
for (let i = 0; i < losPollosJobs.length; i++) {
const job = losPollosJobs[i];
await pool.query(`
INSERT INTO jobs ( company_id, created_by, title, description,
salary_min, salary_max, salary_type, employment_type, working_hours,
location, requirements, benefits, visa_support, language_level, status, work_mode)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
`, [
companyId,
seedUserId,
job.title,
@ -344,16 +343,16 @@ export async function seedSpringfieldNuclear() {
true
]);
// Core Company
// Create company (let DB auto-generate id)
await pool.query(`
INSERT INTO companies (id, name, document, status)
VALUES ($1, $2, $3, 'ACTIVE')
ON CONFLICT (id) DO NOTHING
`, ['88888888-8888-8888-8888-888888888888', 'Springfield Nuclear Power Plant', '88.888.888/0001-88']);
INSERT INTO companies (name, slug, document)
VALUES ($1, $2, $3)
ON CONFLICT (slug) DO NOTHING
`, ['Springfield Nuclear Power Plant', 'springfield-nuclear', '88.888.888/0001-88']);
// Get company ID
// Get company ID (use coreId directly)
const companyId = '88888888-8888-8888-8888-888888888888';
// Get company ID (SERIAL)
const companyRes = await pool.query("SELECT id FROM companies WHERE slug = 'springfield-nuclear'");
const companyId = companyRes.rows[0]?.id;
const seedUserRes = await pool.query("SELECT id FROM users LIMIT 1");
const seedUserId = seedUserRes.rows[0]?.id || 1;
@ -362,14 +361,14 @@ export async function seedSpringfieldNuclear() {
for (let i = 0; i < springfieldJobs.length; i++) {
const job = springfieldJobs[i];
await pool.query(`
INSERT INTO jobs ( company_id, created_by, title, description,
salary_min, salary_max, salary_type, employment_type, working_hours,
location, requirements, benefits, visa_support, language_level, status, work_mode)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
`, [
companyId,
seedUserId,
job.title,