Skip to content

Commit

Permalink
fix: 💩 lol
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonWarrenUK committed Dec 19, 2024
1 parent 4f9b783 commit 0f3e319
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib/db/DatabaseManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import categoriesSchema from "./schemas/categoriesSchema.json";
import needsCategoriesSchema from "./schemas/categoriesSchema.json";
import needsSchema from "./schemas/categoriesSchema.json";
import nextActionsSchema from "./schemas/categoriesSchema.json";
// import { categories, toolkit } from "./seed/toolkit";
// import { needsCategories, needs, nextActions } from "./seed/needs";
import { categories, toolkit } from "./seed/toolkit";
import { needsCategories, needs, nextActions } from "./seed/needs";
// import generateMoodRecords from "./seed/moods";
import { RxDBUpdatePlugin } from "rxdb/plugins/update";

Expand Down Expand Up @@ -61,7 +61,7 @@ class DatabaseManager {
}

console.log("Database initialised.");
// await this.seedDatabase();
await this.seedDatabase();
return dbInstance;
}

Expand All @@ -75,13 +75,13 @@ class DatabaseManager {
return dbInstance;
}

/* private async seedDatabase() {
private async seedDatabase() {
if (
dbInstance &&
(await dbInstance.collections["needs"].find().exec()).length === 0
) {
try {
await this.seed("mood_records", generateMoodRecords("dev"));
// await this.seed("mood_records", generateMoodRecords("dev"));
await this.seed("categories", categories);
await this.seed("toolkit_items", toolkit);
await this.seed("needs_categories", needsCategories);
Expand All @@ -91,7 +91,7 @@ class DatabaseManager {
console.error("Error during database seeding:", error);
}
}
} */
}

private async seed<T>(collectionName: string, data: T[]) {
if (!dbInstance) throw new Error("Database not initialised.");
Expand Down

0 comments on commit 0f3e319

Please sign in to comment.