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

pull/501/head^2
Stuart Long Chay Boon 3 years ago
parent e603179058
commit b014a5dc39

@ -115,7 +115,18 @@ 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.TC && typeof data.TC === 'number') {
@ -157,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: {
@ -217,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: {
@ -321,6 +340,7 @@ const seedSalaries = async () => {
} }
}), }),
); );
}
}; };
const generateAllAnalysis = async () => { const generateAllAnalysis = async () => {

Loading…
Cancel
Save