Upload web code

This commit is contained in:
Cadence Ember 2024-09-22 15:42:15 +12:00
parent 1d2daf2504
commit b6c23c30fb
22 changed files with 765 additions and 6 deletions

View file

@ -0,0 +1,5 @@
BEGIN TRANSACTION;
ALTER TABLE guild_space ADD COLUMN autocreate INTEGER NOT NULL DEFAULT 1;
COMMIT;

View file

@ -31,6 +31,7 @@ export type Models = {
guild_id: string
space_id: string
privacy_level: number
autocreate: number
}
lottie: {

View file

@ -15,8 +15,13 @@ function select(table, cols, where = {}, e = "") {
if (!Array.isArray(cols)) cols = [cols]
const parameters = []
const wheres = Object.entries(where).map(([col, value]) => {
parameters.push(value)
return `"${col}" = ?`
if (Array.isArray(value)) {
parameters.push(...value)
return `"${col}" IN (` + Array(value.length).fill("?").join(", ") + ")"
} else {
parameters.push(value)
return `"${col}" = ?`
}
})
const whereString = wheres.length ? " WHERE " + wheres.join(" AND ") : ""
/** @type {U.Prepared<Pick<U.Models[Table], Col>>} */