[offers][fix] update seed script to integrate with city

pull/501/head
Stuart Long Chay Boon 3 years ago
parent 60f225eb0f
commit f82568b04e

@ -115,11 +115,21 @@ const seedSalaries = async () => {
companyIdMappings[company.name] = company.id; companyIdMappings[company.name] = company.id;
}); });
//seed here // get countryId of Singapore
const singapore = (await prisma.city.findFirst({
where: {
name: "Singapore"
}
}))
// console.log(singapore)
// break;
// seed here
if (singapore) {
return await Promise.all( return await Promise.all(
data.map(async (data: ExcelData) => { data.map(async (data: ExcelData) => {
if (data.TC && typeof data.TC === 'number') {
if (data.Income && typeof data.Income === 'number') {
// Generate random name until unique // Generate random name until unique
let uniqueName: string = await generateRandomName(); let uniqueName: string = await generateRandomName();
@ -158,7 +168,11 @@ const seedSalaries = async () => {
}, },
}, },
jobType: 'INTERN', jobType: 'INTERN',
location: 'Singapore, Singapore', // TODO: DEFAULT AS SG location: {
connect: {
id: singapore.id
}
}, // TODO: DEFAULT AS SG
monthYearReceived: xlSerialToJsDate(data.Timestamp), monthYearReceived: xlSerialToJsDate(data.Timestamp),
negotiationStrategy: '', negotiationStrategy: '',
offersIntern: { offersIntern: {
@ -218,7 +232,11 @@ const seedSalaries = async () => {
}, },
}, },
jobType: 'FULLTIME', jobType: 'FULLTIME',
location: 'Singapore, Singapore', // TODO: DEFAULT AS SG location: {
connect: {
id: singapore.id
}
}, // TODO: DEFAULT AS SG
monthYearReceived: xlSerialToJsDate(data.Timestamp), monthYearReceived: xlSerialToJsDate(data.Timestamp),
negotiationStrategy: '', negotiationStrategy: '',
offersFullTime: { offersFullTime: {
@ -322,6 +340,7 @@ const seedSalaries = async () => {
} }
}), }),
); );
}
}; };
const generateAllAnalysis = async () => { const generateAllAnalysis = async () => {

Loading…
Cancel
Save