[offers][chore] Add yoe ranges for seeded data

pull/501/head
Bryann Yeap Kok Keong 3 years ago committed by Stuart Long Chay Boon
parent f258ac1dd5
commit 3477012686

@ -71,6 +71,23 @@ const getJobTitle = (role: string) => {
} }
}; };
const getYoe = (type: string) => {
const processedType = type.toUpperCase().trim();
if (
processedType.includes('FRESH GRAD') ||
processedType.includes('JUNIOR')
) {
return Math.floor(Math.random() * 3);
} else if (processedType.includes('MID')) {
return Math.floor(Math.random() * 3) + 3;
} else if (processedType.includes('SENIOR')) {
return Math.floor(Math.random() * 5) + 6;
} else {
return 0; // INTERNSHIP OR ERROR -> 0 YOE
}
};
const createdProfileIds: Array<string> = []; const createdProfileIds: Array<string> = [];
const seedSalaries = async () => { const seedSalaries = async () => {
@ -89,6 +106,7 @@ const seedSalaries = async () => {
let uniqueName: string = await generateRandomName(); let uniqueName: string = await generateRandomName();
const jobTitle = getJobTitle(data.Role); const jobTitle = getJobTitle(data.Role);
const yoe = getYoe(data.Type);
// check if we have company id // check if we have company id
if (companyIdMappings[data.Company]) { if (companyIdMappings[data.Company]) {
@ -109,7 +127,7 @@ const seedSalaries = async () => {
editToken: token, editToken: token,
background: { background: {
create: { create: {
totalYoe: 0, totalYoe: yoe,
}, },
}, },
offers: { offers: {
@ -161,7 +179,7 @@ const seedSalaries = async () => {
editToken: token, editToken: token,
background: { background: {
create: { create: {
totalYoe: 0, totalYoe: yoe,
}, },
}, },
offers: { offers: {

Loading…
Cancel
Save