Files
userbase/examples/cloudflare-vite-code/seed.ts
T
shishantbiswas 0bfcb5ad71
Run Tests / test (pull_request) Successful in 4m57s
bknd is dead long live userbase
2026-09-27 19:34:06 +05:30

29 lines
728 B
TypeScript

/// <reference types="./worker-configuration.d.ts" />
import { createFrameworkApp } from "userbase/adapter";
import config from "./userbase.config.ts";
const app = await createFrameworkApp(config, {});
const {
data: { count: usersCount },
} = await app.em.repo("users").count();
const {
data: { count: todosCount },
} = await app.em.repo("todos").count();
// only run if the database is empty
if (usersCount === 0 && todosCount === 0) {
await app.em.mutator("todos").insertMany([
{ title: "Learn userbase", done: true },
{ title: "Build something cool", done: false },
]);
await app.module.auth.createUser({
email: "test@userbase.io",
password: "12345678",
});
}
process.exit(0);