mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2026-04-13 14:19:42 +08:00
[offers][fix] Remove map internship cycle script
This commit is contained in:
@@ -13,8 +13,7 @@
|
|||||||
"seed-salaries": "ts-node prisma/seed-salaries.ts",
|
"seed-salaries": "ts-node prisma/seed-salaries.ts",
|
||||||
"seed-analysis": "ts-node prisma/seed-analysis.ts",
|
"seed-analysis": "ts-node prisma/seed-analysis.ts",
|
||||||
"seed-questions": "ts-node prisma/seed-questions.ts",
|
"seed-questions": "ts-node prisma/seed-questions.ts",
|
||||||
"seed-companies": "ts-node prisma/seed-companies.ts",
|
"seed-companies": "ts-node prisma/seed-companies.ts"
|
||||||
"map-internship-cycle": "ts-node prisma/map-internship-cycle.ts"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@headlessui/react": "^1.7.3",
|
"@headlessui/react": "^1.7.3",
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
import { PrismaClient } from '@prisma/client';
|
|
||||||
|
|
||||||
const prisma = new PrismaClient();
|
|
||||||
|
|
||||||
const mapInternshipCycle = async () => {
|
|
||||||
console.log('Mapping internship cycle values');
|
|
||||||
|
|
||||||
const offersInterns = await prisma.offersIntern.findMany({
|
|
||||||
where: {
|
|
||||||
internshipCycle: 'Summer',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
'Number of incorrect internship cycle values found:',
|
|
||||||
offersInterns.length,
|
|
||||||
);
|
|
||||||
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
offersInterns.forEach(async (offersIntern) => {
|
|
||||||
await prisma.offersIntern.update({
|
|
||||||
where: {
|
|
||||||
id: offersIntern.id,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
internshipCycle: 'summer',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
++i,
|
|
||||||
': Mapped internship cycle for intern with id',
|
|
||||||
offersIntern.id,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(i, 'internship cycles mapped');
|
|
||||||
};
|
|
||||||
|
|
||||||
Promise.all([mapInternshipCycle()])
|
|
||||||
.then(async () => {
|
|
||||||
await prisma.$disconnect();
|
|
||||||
})
|
|
||||||
.catch(async (e) => {
|
|
||||||
console.error(e);
|
|
||||||
console.log('Mapping stopped!');
|
|
||||||
await prisma.$disconnect();
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
export {};
|
|
||||||
Reference in New Issue
Block a user