[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;
});
//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(
data.map(async (data: ExcelData) => {
if (data.Income && typeof data.Income === 'number') {
if (data.TC && typeof data.TC === 'number') {
// Generate random name until unique
let uniqueName: string = await generateRandomName();
@ -158,7 +168,11 @@ const seedSalaries = async () => {
},
},
jobType: 'INTERN',
location: 'Singapore, Singapore', // TODO: DEFAULT AS SG
location: {
connect: {
id: singapore.id
}
}, // TODO: DEFAULT AS SG
monthYearReceived: xlSerialToJsDate(data.Timestamp),
negotiationStrategy: '',
offersIntern: {
@ -218,7 +232,11 @@ const seedSalaries = async () => {
},
},
jobType: 'FULLTIME',
location: 'Singapore, Singapore', // TODO: DEFAULT AS SG
location: {
connect: {
id: singapore.id
}
}, // TODO: DEFAULT AS SG
monthYearReceived: xlSerialToJsDate(data.Timestamp),
negotiationStrategy: '',
offersFullTime: {
@ -322,6 +340,7 @@ const seedSalaries = async () => {
}
}),
);
}
};
const generateAllAnalysis = async () => {

Loading…
Cancel
Save