From f4a222aa15ec816440348221994956a39c70bd5f Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Thu, 15 Jan 2026 18:27:50 +0100 Subject: [PATCH] refactor(up/down limit): allow floating value & default to 1 --- .../components/repository-forms/advanced-tls-form.tsx | 8 ++++---- ...thankful_master_chief.sql => 0033_chunky_tyrannus.sql} | 6 +++--- app/drizzle/meta/0033_snapshot.json | 6 +++--- app/drizzle/meta/_journal.json | 4 ++-- app/server/db/schema.ts | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) rename app/drizzle/{0033_thankful_master_chief.sql => 0033_chunky_tyrannus.sql} (82%) diff --git a/app/client/modules/repositories/components/repository-forms/advanced-tls-form.tsx b/app/client/modules/repositories/components/repository-forms/advanced-tls-form.tsx index eabacd0c..e4512fcd 100644 --- a/app/client/modules/repositories/components/repository-forms/advanced-tls-form.tsx +++ b/app/client/modules/repositories/components/repository-forms/advanced-tls-form.tsx @@ -61,12 +61,12 @@ export const AdvancedForm = ({ form }: Props) => { disabled={!uploadLimitEnabled} type="number" min={1} - step={1} + step={0.1} max={999999} placeholder="10" className="pr-12" {...field} - onChange={(e) => field.onChange(parseInt(e.target.value, 10) || 1)} + onChange={(e) => field.onChange(parseFloat(e.target.value) || 1)} />
@@ -139,12 +139,12 @@ export const AdvancedForm = ({ form }: Props) => { placeholder="10" type="number" min={1} - step={1} + step={0.1} max={999999} disabled={!downloadLimitEnabled} className="pr-12" {...field} - onChange={(e) => field.onChange(parseInt(e.target.value, 10) || 1)} + onChange={(e) => field.onChange(parseFloat(e.target.value) || 1)} />
diff --git a/app/drizzle/0033_thankful_master_chief.sql b/app/drizzle/0033_chunky_tyrannus.sql similarity index 82% rename from app/drizzle/0033_thankful_master_chief.sql rename to app/drizzle/0033_chunky_tyrannus.sql index 763c6f9d..eb16878b 100644 --- a/app/drizzle/0033_thankful_master_chief.sql +++ b/app/drizzle/0033_chunky_tyrannus.sql @@ -1,6 +1,6 @@ ALTER TABLE `repositories_table` ADD `upload_limit_enabled` integer DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE `repositories_table` ADD `upload_limit_value` real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE `repositories_table` ADD `upload_limit_value` real DEFAULT 1 NOT NULL;--> statement-breakpoint ALTER TABLE `repositories_table` ADD `upload_limit_unit` text DEFAULT 'Mbps' NOT NULL;--> statement-breakpoint ALTER TABLE `repositories_table` ADD `download_limit_enabled` integer DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE `repositories_table` ADD `download_limit_value` real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE `repositories_table` ADD `download_limit_unit` text DEFAULT 'Mbps' NOT NULL; \ No newline at end of file +ALTER TABLE `repositories_table` ADD `download_limit_value` real DEFAULT 1 NOT NULL;--> statement-breakpoint +ALTER TABLE `repositories_table` ADD `download_limit_unit` text DEFAULT 'Mbps' NOT NULL; diff --git a/app/drizzle/meta/0033_snapshot.json b/app/drizzle/meta/0033_snapshot.json index fb54b5e3..3a562335 100644 --- a/app/drizzle/meta/0033_snapshot.json +++ b/app/drizzle/meta/0033_snapshot.json @@ -1,7 +1,7 @@ { "version": "6", "dialect": "sqlite", - "id": "9506e3c1-3131-4621-b74b-6023d63a0f00", + "id": "73952303-c589-4b3b-93f1-b70478329dbf", "prevId": "ad86ee2a-231e-45d1-9910-e4b7cac6a8af", "tables": { "account": { @@ -717,7 +717,7 @@ "primaryKey": false, "notNull": true, "autoincrement": false, - "default": 0 + "default": 1 }, "upload_limit_unit": { "name": "upload_limit_unit", @@ -741,7 +741,7 @@ "primaryKey": false, "notNull": true, "autoincrement": false, - "default": 0 + "default": 1 }, "download_limit_unit": { "name": "download_limit_unit", diff --git a/app/drizzle/meta/_journal.json b/app/drizzle/meta/_journal.json index c428b6bf..e649fbc6 100644 --- a/app/drizzle/meta/_journal.json +++ b/app/drizzle/meta/_journal.json @@ -236,8 +236,8 @@ { "idx": 33, "version": "6", - "when": 1768497229303, - "tag": "0033_thankful_master_chief", + "when": 1768497767122, + "tag": "0033_chunky_tyrannus", "breakpoints": true } ] diff --git a/app/server/db/schema.ts b/app/server/db/schema.ts index 23ad9da9..b5fc5b6d 100644 --- a/app/server/db/schema.ts +++ b/app/server/db/schema.ts @@ -166,10 +166,10 @@ export const repositoriesTable = sqliteTable("repositories_table", { lastChecked: int("last_checked", { mode: "number" }), lastError: text("last_error"), uploadLimitEnabled: int("upload_limit_enabled", { mode: "boolean" }).notNull().default(false), - uploadLimitValue: real("upload_limit_value").notNull().default(0), + uploadLimitValue: real("upload_limit_value").notNull().default(1), uploadLimitUnit: text("upload_limit_unit").$type().notNull().default("Mbps"), downloadLimitEnabled: int("download_limit_enabled", { mode: "boolean" }).notNull().default(false), - downloadLimitValue: real("download_limit_value").notNull().default(0), + downloadLimitValue: real("download_limit_value").notNull().default(1), downloadLimitUnit: text("download_limit_unit").$type().notNull().default("Mbps"), createdAt: int("created_at", { mode: "number" }) .notNull()