-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
75 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
/* eslint-disable no-console */ | ||
import { Currency, Role, WorkMode } from '@prisma/client'; | ||
import { faker } from '@faker-js/faker'; | ||
import bcrypt from 'bcryptjs'; | ||
import prisma from '../src/config/prisma.config'; | ||
import { JobLocations } from '@prisma/client'; | ||
|
||
const users = [ | ||
{ id: '1', name: 'Jack', email: '[email protected]' }, | ||
{ id: '2', name: 'Admin', email: '[email protected]', role: Role.ADMIN }, | ||
]; | ||
|
||
const locationArr = Object.keys(JobLocations); | ||
|
||
let jobs = [ | ||
{ | ||
id: '1', | ||
|
@@ -284,6 +286,13 @@ async function seedUsers() { | |
} | ||
|
||
async function seedJobs() { | ||
jobs = jobs.map((j, index) => { | ||
return { | ||
...j, | ||
location: | ||
locationArr[index] !== undefined ? locationArr[index] : locationArr[3], | ||
}; | ||
}); | ||
try { | ||
await Promise.all( | ||
jobs.map(async (j) => | ||
|
@@ -302,8 +311,8 @@ async function seedJobs() { | |
workMode: j.workMode, | ||
currency: j.currency, | ||
application: j.application, | ||
city: faker.location.city(), | ||
address: faker.location.streetAddress(), | ||
//@ts-ignore | ||
location: j.location, | ||
companyLogo: j.companyLogo, | ||
hasSalaryRange: j.hasSalaryRange, | ||
minSalary: j.minSalary, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.