From 9ff44e3d15ef7164ddca30106d5fb6f280adc2e9 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Sun, 26 Apr 2026 15:38:23 +0800 Subject: [PATCH] feat: add echarts dependencies + preset performance link schema --- bun.lock | 14 +++++++++++ drizzle/0005_add_preset_performance_link.sql | 2 ++ ...{0004_snapshot.json => 0005_snapshot.json} | 23 +++++++++++++++++-- drizzle/meta/_journal.json | 9 +++++++- lib/db/schema/communityPresets.ts | 5 ++++ package.json | 2 ++ 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 drizzle/0005_add_preset_performance_link.sql rename drizzle/meta/{0004_snapshot.json => 0005_snapshot.json} (98%) diff --git a/bun.lock b/bun.lock index ac46656..856f22b 100644 --- a/bun.lock +++ b/bun.lock @@ -16,6 +16,8 @@ "better-auth": "^1.6.9", "dotenv": "^17.4.2", "drizzle-orm": "^0.45.2", + "echarts": "^6.0.0", + "echarts-for-react": "^3.0.6", "elysia": "^1.4.28", "lucide-react": "^1.11.0", "motion": "^12.38.0", @@ -863,6 +865,10 @@ "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], + "echarts": ["echarts@6.0.0", "", { "dependencies": { "tslib": "2.3.0", "zrender": "6.0.0" } }, "sha512-Tte/grDQRiETQP4xz3iZWSvoHrkCQtwqd6hs+mifXcjrCuo2iKWbajFObuLJVBlDIJlOzgQPd1hsaKt/3+OMkQ=="], + + "echarts-for-react": ["echarts-for-react@3.0.6", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "size-sensor": "^1.0.1" }, "peerDependencies": { "echarts": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0", "react": "^15.0.0 || >=16.0.0" } }, "sha512-4zqLgTGWS3JvkQDXjzkR1k1CHRdpd6by0988TWMJgnvDytegWLbeP/VNZmMa+0VJx2eD7Y632bi2JquXDgiGJg=="], + "electron-to-chromium": ["electron-to-chromium@1.5.344", "", {}, "sha512-4MxfbmNDm+KPh066EZy+eUnkcDPcZ35wNmOWzFuh/ijvHsve6kbLTLURy88uCNK5FbpN+yk2nQY6BYh1GEt+wg=="], "elysia": ["elysia@1.4.28", "", { "dependencies": { "cookie": "^1.1.1", "exact-mirror": "^0.2.7", "fast-decode-uri-component": "^1.0.1", "memoirist": "^0.4.0" }, "peerDependencies": { "@sinclair/typebox": ">= 0.34.0 < 1", "@types/bun": ">= 1.2.0", "file-type": ">= 20.0.0", "openapi-types": ">= 12.0.0", "typescript": ">= 5.0.0" }, "optionalPeers": ["@types/bun", "typescript"] }, "sha512-Vrx8sBnvq8squS/3yNBzR1jBXI+SgmnmvwawPjNuEHndUe5l1jV2Gp6JJ4ulDkEB8On6bWmmuyPpA+bq4t+WYg=="], @@ -1367,6 +1373,8 @@ "siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="], + "size-sensor": ["size-sensor@1.0.3", "", {}, "sha512-+k9mJ2/rQMiRmQUcjn+qznch260leIXY8r4FyYKKyRBO/s5UoeMAHGkCJyE1R/4wrIhTJONfyloY55SkE7ve3A=="], + "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="], @@ -1501,6 +1509,8 @@ "zod-validation-error": ["zod-validation-error@4.0.2", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ=="], + "zrender": ["zrender@6.0.0", "", { "dependencies": { "tslib": "2.3.0" } }, "sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg=="], + "@aws-crypto/sha1-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], "@aws-crypto/sha256-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], @@ -1537,6 +1547,8 @@ "@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="], + "echarts/tslib": ["tslib@2.3.0", "", {}, "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="], + "eslint-import-resolver-node/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ=="], "eslint-module-utils/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ=="], @@ -1557,6 +1569,8 @@ "tsyringe/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], + "zrender/tslib": ["tslib@2.3.0", "", {}, "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="], + "@aws-crypto/sha1-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], diff --git a/drizzle/0005_add_preset_performance_link.sql b/drizzle/0005_add_preset_performance_link.sql new file mode 100644 index 0000000..1f9b7ea --- /dev/null +++ b/drizzle/0005_add_preset_performance_link.sql @@ -0,0 +1,2 @@ +ALTER TABLE "community_presets" ADD COLUMN "performance_entry_id" text;--> statement-breakpoint +ALTER TABLE "community_presets" ADD CONSTRAINT "community_presets_performance_entry_id_performance_entries_id_fk" FOREIGN KEY ("performance_entry_id") REFERENCES "public"."performance_entries"("id") ON DELETE set null ON UPDATE no action; \ No newline at end of file diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0005_snapshot.json similarity index 98% rename from drizzle/meta/0004_snapshot.json rename to drizzle/meta/0005_snapshot.json index d59fff9..6101d47 100644 --- a/drizzle/meta/0004_snapshot.json +++ b/drizzle/meta/0005_snapshot.json @@ -1,6 +1,6 @@ { - "id": "273a7a41-0813-4612-ad50-bc53aa0eac5f", - "prevId": "c6630c3d-832a-4f22-a679-2c76621fc4a2", + "id": "7f7353e5-646d-4e21-92e6-250b5b28ee50", + "prevId": "273a7a41-0813-4612-ad50-bc53aa0eac5f", "version": "7", "dialect": "postgresql", "tables": { @@ -567,6 +567,12 @@ "notNull": true, "default": 0 }, + "performance_entry_id": { + "name": "performance_entry_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, "settings_json": { "name": "settings_json", "type": "jsonb", @@ -628,6 +634,19 @@ ], "onDelete": "set null", "onUpdate": "no action" + }, + "community_presets_performance_entry_id_performance_entries_id_fk": { + "name": "community_presets_performance_entry_id_performance_entries_id_fk", + "tableFrom": "community_presets", + "tableTo": "performance_entries", + "columnsFrom": [ + "performance_entry_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 6bc0d36..a77578a 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -29,6 +29,13 @@ "when": 1777115371276, "tag": "0004_aspiring_meggan", "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1777189057323, + "tag": "0005_add_preset_performance_link", + "breakpoints": true } ] -} +} \ No newline at end of file diff --git a/lib/db/schema/communityPresets.ts b/lib/db/schema/communityPresets.ts index 3676bb4..0f50ded 100644 --- a/lib/db/schema/communityPresets.ts +++ b/lib/db/schema/communityPresets.ts @@ -8,6 +8,7 @@ import { } from "drizzle-orm/pg-core" import { games } from "./games" import { hardware } from "./hardware" +import { performanceEntries } from "./performanceEntries" import { user } from "./auth" export const communityPresets = pgTable( @@ -28,6 +29,10 @@ export const communityPresets = pgTable( onDelete: "set null", }), upvotes: integer("upvotes").default(0).notNull(), + performanceEntryId: text("performance_entry_id").references( + () => performanceEntries.id, + { onDelete: "set null" }, + ), // Freeform settings JSON — same flexible structure as performanceEntries.settingsJson settingsJson: jsonb("settings_json").$type< { diff --git a/package.json b/package.json index ccb4d65..315545f 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,8 @@ "better-auth": "^1.6.9", "dotenv": "^17.4.2", "drizzle-orm": "^0.45.2", + "echarts": "^6.0.0", + "echarts-for-react": "^3.0.6", "elysia": "^1.4.28", "lucide-react": "^1.11.0", "motion": "^12.38.0",