feat: add guide page

This commit is contained in:
2026-03-19 01:03:23 +07:00 Unverified
parent c39675e184
commit 04058d1776
17 changed files with 480 additions and 25 deletions
+1
View File
@@ -46,5 +46,6 @@ export const cdnReferences = pgView("cdn_references").as((qb) => {
if (prev) return prev.unionAll(query);
return query;
}, null);
// console.dir(queries, { depth: 5 });
return queries;
});
+15
View File
@@ -326,6 +326,21 @@ export const tierlistStates = tierlist.table("states", {
//#endregion
//#region Guide
export const guides = pgTable("guides", {
id: text().primaryKey().$defaultFn(uuidv7),
image: text().references(() => cdn.id, {
onDelete: "set null",
onUpdate: "cascade",
}),
order: integer().notNull(),
link: text().notNull(),
hidden: boolean().notNull().default(false),
name: text().notNull(),
});
//#endregion
//#region Better Auth
export const user = pgTable("user", {
id: text("id").primaryKey(),
+16 -9
View File
@@ -170,13 +170,20 @@ export function shortestPrefixes(values: readonly string[]) {
return res;
}
export function parseParamNumber(param: string | string[] | undefined) {
if (Array.isArray(param)) {
if (param.length < 1) return 0;
return parseParamNumber(param[0]);
}
if (!param) return 0;
const int = parseInt(param, 10);
if (Number.isNaN(int)) return 0;
return int;
export function parseSearchNumber(
param: string | string[] | undefined,
def: number = 0,
) {
if (Array.isArray(param)) return parseSearchNumber(param[0], def);
const parsed = parseFloat(param ?? "");
return Number.isNaN(parsed) ? def : parsed;
}
export function parseSearchString(
param: string | string[] | undefined,
def: string = "",
) {
if (Array.isArray(param)) return parseSearchString(param[0], def);
return param ?? def;
}