INNER CODE UNIT · TypeScript

seed

rodyherrera/Quantum · packages/api/scripts/seed-templates.ts:337

const seed = async () => {
    const { entities } = await new ModuleDiscovery().discover();
    const dataSource = createDataSource(entities);
    await dataSource.initialize();

    let created = 0;
    let skipped = 0;

    for(const legacy of LEGACY_TEMPLATES){
        const slug = slugify(legacy.name, { lower: true, strict: true });
        const exists = await Template.findOneBy({ slug });
        if(exists){ skipped++; continue; }

        await Template.create({
            name: legacy.name,
            slug,
            description: legacy.description,
            icon: null,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…