Files
classroomio/packages/db/src/utils/seed/course.ts
T
Ulises Vargas 4348e89860
Publish Docker Images / Smoke test (api) (push) Canceled after 0s
Publish Docker Images / Smoke test (dashboard) (push) Canceled after 0s
Publish Docker Images / Smoke test (jobs) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.api, api, api) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.dashboard, dashboard, dashboard) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.jobs, jobs, jobs) (push) Canceled after 0s
MCP package build check / build (push) Canceled after 0s
Package build check / build (push) Canceled after 0s
Upload OpenAPI Spec to R2 / generate-and-upload-openapi (push) Canceled after 0s
chore: prepare for deployment
2026-08-24 08:56:48 -07:00

175 lines
6.0 KiB
TypeScript

import { course, db } from '@db/drizzle';
import type { TNewCourse } from '@db/types';
interface SeedCourse {
mvcGroupId: string;
reactGroupId: string;
pandasGroupId: string;
prof2GroupId: string;
earlyAdopterGroupId: string;
}
export async function seedCourses({
mvcGroupId,
reactGroupId,
pandasGroupId,
prof2GroupId,
earlyAdopterGroupId
}: SeedCourse) {
const existingCourses = await db.select().from(course);
const existingCourseIds = existingCourses.map((c) => c.id);
const mvcCourseId = '98e6e798-f0bd-4f9d-a6f5-ce0816a4f97e';
const reactCourseId = '16e3bc8d-5d1b-4708-988e-93abae288ccf';
const pandasCourseId = 'f0a85d18-aff4-412f-b8e6-3b34ef098dce';
const earlyAdopterCourseId = '9bd496cc-c494-4a7e-e12c-6baeef246f8b';
const prof2CourseId = 'aaaabbbb-cccc-dddd-eeee-ffff00001111';
const coursesToInsert: TNewCourse[] = [
{
id: prof2CourseId,
title: 'Introducción a la Administración Pública',
description:
'Curso impartido por la profesora Laura Perez Garcia sobre los fundamentos de la administración pública y su aplicación práctica en el Ayuntamiento.',
overview: 'Welcome to this amazing course 🚀 ',
groupId: prof2GroupId,
isTemplate: false,
logo: '',
slug: 'introduccion-administracion-publica',
metadata: {
goals: '',
grading: false,
description: '',
requirements: '',
lessonDownload: false,
allowNewStudent: true
},
cost: 0,
currency: 'NGN',
isPublished: true,
certificate: {
isDownloadable: false,
theme: 'professional'
},
status: 'ACTIVE'
},
{
id: mvcCourseId,
title: 'Inducción al H. Ayuntamiento de Tijuana',
description:
'Conoce la estructura, misión y visión del gobierno municipal. Este curso es obligatorio para todos los nuevos servidores públicos de Tijuana.',
overview:
'<p>"Getting Started with MVC. is designed for beginners and aspiring developers, this course provides a solid foundation for understanding the principles and practices behind MVC, a widely adopted design pattern in software development.</p>',
groupId: mvcGroupId,
isTemplate: true,
logo: '',
slug: 'getting-started-with-mvc',
metadata: {
goals: '',
grading: false,
description: '',
requirements: '',
lessonDownload: false,
allowNewStudent: true
},
cost: 0,
currency: 'NGN',
isPublished: true,
certificate: {
isDownloadable: false,
theme: 'professional'
},
status: 'ACTIVE'
},
{
id: reactCourseId,
title: 'Transparencia y Acceso a la Información',
description:
'Capacitación sobre la Ley General de Transparencia, el manejo de datos personales y la respuesta a solicitudes ciudadanas.',
overview: 'Welcome to this amazing course 🚀 ',
groupId: reactGroupId,
isTemplate: true,
logo: 'https://images.unsplash.com/photo-1565843708714-52ecf69ab81f?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w1MTE1NTV8MHwxfHNlYXJjaHwxOHx8cmVhY3QlMjBkZXZ8ZW58MHx8fHwxNzA3Nzk5NDMyfDA&ixlib=rb-4.0.3&q=80&w=1080',
slug: 'modern-web-development',
metadata: {
goals: '',
grading: true,
description: '',
requirements: '',
lessonDownload: false,
allowNewStudent: true
},
cost: 0,
currency: 'NGN',
isPublished: true,
certificate: {
isDownloadable: false,
theme: 'professional'
},
status: 'ACTIVE'
},
{
id: pandasCourseId,
title: 'Atención Ciudadana y Calidad en el Servicio',
description:
'Unlock the power of data with our "Data Science with Python and Pandas" course. Dive into Python programming fundamentals and then journey into the world of Pandas for efficient data manipulation and analysis. Learn essential data cleaning and preprocessing techniques before venturing into statistical analysis using Pandas. Cap off your exploration with data visualization using Matplotlib and Seaborn.',
overview: 'Welcome to this amazing course 🚀 ',
groupId: pandasGroupId,
isTemplate: true,
logo: 'https://images.unsplash.com/photo-1518186285589-2f7649de83e0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w1MTE1NTV8MHwxfHNlYXJjaHwxOHx8ZGF0YSUyMHNjaWVuY2V8ZW58MHx8fHwxNzA3Nzk5MzMwfDA&ixlib=rb-4.0.3&q=80&w=1080',
slug: 'data-science-with-python-and-pandas-1702919269375',
metadata: {
goals: '',
grading: true,
description: '',
requirements: '',
lessonDownload: true,
allowNewStudent: true
},
cost: 0,
currency: 'NGN',
isPublished: true,
certificate: {
isDownloadable: false,
theme: 'professional'
},
status: 'ACTIVE'
},
{
id: earlyAdopterCourseId,
title: 'Procedimientos Administrativos Locales',
description:
'A practical introduction to product management covering roadmaps, prioritization frameworks, user research, and cross-functional collaboration skills needed to ship great products.',
overview: 'Welcome to Product Management Fundamentals 🚀',
groupId: earlyAdopterGroupId,
isTemplate: false,
logo: '',
slug: 'product-management-fundamentals',
metadata: {
goals: '',
grading: false,
description: '',
requirements: '',
lessonDownload: false,
allowNewStudent: true
},
cost: 0,
currency: 'NGN',
isPublished: true,
certificate: {
isDownloadable: false,
theme: 'professional'
},
status: 'ACTIVE'
}
].filter((c) => !existingCourseIds.includes(c.id));
if (coursesToInsert.length > 0) {
await db.insert(course).values(coursesToInsert);
console.log(` ✓ Inserted ${coursesToInsert.length} course(s)`);
} else {
console.log(' ✓ Courses already exist, skipping');
}
}