Skip to main content

seedingData

If you want to add additional data that is seeded on the app start you can open file npm-commands/seed-db/index.ts. In it, using function crudCreate you can add any resources into your database. Function crudCreate accepts CrudUpdateConfig parameter and creates a resource:

async function seed() {
try {
await seedDatabase();
await createTeacher();
await createStudent();
logInfo("Database seeded succesfully");
process.exit(0);
} catch (err) {
if (err instanceof Error) console.log("Error seeding database", err);

process.exit(1);
}
}

async function createStudent() {
const studentConfig: CrudUpdateConfig<Student> = {
resourceName: "Student",
resource: student,
};
await crudCreate<Student>(studentConfig);
}

async function createTeacher() {
const teacherConfig: CrudUpdateConfig<Teacher> = {
resourceName: "Teacher",
resource: teacherData,
};
await crudCreate<Teacher>(teacherConfig);
}

If you want to seed demo resources that are displayed in this video (for example Contact, Company, Ticket), add to the .env file:

FD_SEED_DEMO_RESOURCES = true