feat: add guide page
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user