add s3 and local dir support, fix session roles, make sure delete invite checks if its valid first

This commit is contained in:
creations 2025-03-05 08:45:08 -05:00
parent 9a91f1e7e3
commit 774c8e22ce
Signed by: creations
GPG key ID: 8F553AA4320FC711
11 changed files with 171 additions and 12 deletions

View file

@ -1,3 +1,5 @@
import { resolve } from "path";
export const environment: Environment = {
port: parseInt(process.env.PORT || "8080", 10),
host: process.env.HOST || "0.0.0.0",
@ -25,3 +27,11 @@ export const jwt: {
secret: process.env.JWT_SECRET || "",
expiresIn: process.env.JWT_EXPIRES || "1d",
};
export const dataType: { type: string; path: string | undefined } = {
type: process.env.DATASOURCE_TYPE || "local",
path:
process.env.DATASOURCE_TYPE === "local"
? resolve(process.env.DATASOURCE_LOCAL_DIRECTORY || "./uploads")
: undefined,
};

View file

@ -1,7 +1,7 @@
import { logger } from "@helpers/logger";
import { type ReservedSQL, sql } from "bun";
const defaultSettings: { key: string; value: string }[] = [
const defaultSettings: Setting[] = [
{ key: "default_role", value: "user" },
{ key: "default_timezone", value: "UTC" },
{ key: "server_timezone", value: "UTC" },
@ -114,10 +114,10 @@ export async function setSetting(
try {
await reservation`
INSERT INTO settings ("key", "value")
VALUES (${key}, ${value})
ON CONFLICT ("key")
DO UPDATE SET "value" = ${value};`;
INSERT INTO settings ("key", "value", updated_at)
VALUES (${key}, ${value}, NOW())
ON CONFLICT ("key")
DO UPDATE SET "value" = ${value}, "updated_at" = NOW();`;
} catch (error) {
logger.error(["Could not set the setting:", error as Error]);
throw error;