MCPcopy Create free account
hub / github.com/code100x/cms / addClassesFromAugustToMay

Function addClassesFromAugustToMay

prisma/seed.ts:259–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257}
258
259export async function addClassesFromAugustToMay() {
260 const startDate = new Date('2024-08-01T00:00:00+05:30');
261 const endDate = new Date('2025-05-31T23:59:59+05:30');
262
263 for (
264 let date = new Date(startDate);
265 date <= endDate;
266 date.setDate(date.getDate() + 1)
267 ) {
268 if (date.getDay() === 5) {
269 // Friday
270 await db.event.create({
271 data: {
272 title: 'Web 3 Class',
273 start: new Date(date.setHours(19, 30, 0, 0)),
274 end: new Date(date.setHours(21, 30, 0, 0)),
275 },
276 });
277 } else if (date.getDay() === 6 || date.getDay() === 0) {
278 // Saturday or Sunday
279 await db.event.create({
280 data: {
281 title: 'WebDevs/Devops Class',
282 start: new Date(date.setHours(19, 30, 0, 0)),
283 end: new Date(date.setHours(21, 30, 0, 0)),
284 },
285 });
286 }
287 }
288}
289
290async function seedDatabase() {
291 try {

Callers 1

seedDatabaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected