Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update develop #378

Merged
merged 6 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions libs/database/src/lib/data/blueprint_book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createBlueprint } from "./blueprint";

const mapBlueprintBookEntityToObject = (entity: blueprint_book): BlueprintBook => ({
id: entity.id,
child_tree: entity.child_tree ? ((entity.child_tree as unknown) as ChildTree) : [],
child_tree: entity.child_tree ? (entity.child_tree as unknown as ChildTree) : [],
blueprint_hash: entity.blueprint_hash,
label: entity.label || "",
description: entity.description || "",
Expand Down Expand Up @@ -61,6 +61,8 @@ export async function createBlueprintBook(
type: "blueprint",
id: result.id,
name: blueprint.blueprint.label || "",
icons:
blueprint.blueprint.icons?.map((icon) => `${icon.signal.type}:${icon.signal.name}`) || [],
});
blueprint_ids.push(result.id);
} else if (blueprint.blueprint_book) {
Expand All @@ -70,6 +72,10 @@ export async function createBlueprintBook(
id: result.id,
name: blueprint.blueprint_book.label,
children: result.child_tree,
icons:
blueprint.blueprint_book.icons?.map(
(icon) => `${icon.signal.type}:${icon.signal.name}`
) || [],
});
blueprint_book_ids.push(result.id);
}
Expand All @@ -81,7 +87,7 @@ export async function createBlueprintBook(
description: blueprintBook.description,
blueprint_hash: blueprint_hash,
is_modded: false,
child_tree: (child_tree as unknown) as Prisma.InputJsonObject,
child_tree: child_tree as unknown as Prisma.InputJsonObject,
updated_at: extraInfo.updated_at ? new Date(extraInfo.updated_at * 1000) : new Date(),
created_at: extraInfo.created_at ? new Date(extraInfo.created_at * 1000) : new Date(),
blueprint_books: {
Expand Down
2 changes: 2 additions & 0 deletions libs/types/src/lib/data-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ export interface ChildTreeBlueprint {
type: "blueprint";
id: string;
name: string;
icons?: string[];
}

export interface ChildTreeBlueprintBook {
type: "blueprint_book";
id: string;
name: string;
children: ChildTree;
icons?: string[];
}

export type ChildTree = Array<ChildTreeBlueprint | ChildTreeBlueprintBook>;
Expand Down
Loading