import { EntityManager } from '@mikro-orm/core';
import { App } from '@/apps/_app/entities/app/_App';

export class CanvasAppSeed {
    constructor(private readonly em: EntityManager) {}

    async run() {
        console.log('Seeding Canvas app/system...');

        const existing = await this.em.findOne(App, { name: 'Canvas API' });
        if (!existing) {
            const app = new App();
            app.name = 'Canvas API';
            await this.em.persistAndFlush(app);
            console.log('Created Canvas app/system.');
        } else {
            console.log('Canvas app/system already exists, skipping...');
        }
    }
} 