Fix editSetting key value.

Signed-off-by: Armored Dragon <publicmail@armoreddragon.com>
feature/profile
Armored Dragon 2024-07-10 17:55:27 -05:00
parent 299c1de74e
commit 537f5afa72
Signed by: ArmoredDragon
GPG Key ID: C7207ACC3382AD8B
3 changed files with 13 additions and 5 deletions

View File

@ -13,7 +13,5 @@ COPY . .
EXPOSE 5004
COPY wait-for-db.sh /usr/local/bin/wait-for-db.sh
RUN chmod +x /usr/local/bin/wait-for-db.sh
CMD ["/usr/local/bin/wait-for-db.sh"]
CMD ["/usr/local/bin/wait-for-db.sh"]

View File

@ -626,10 +626,11 @@ async function editSetting({ name, value }) {
if (!Object.keys(settings).includes(name)) return _r(false, "Setting is not valid");
await prisma.setting.upsert({ where: { id: name }, update: { value: value }, create: { id: name, value: value } });
try {
settings[key] = JSON.parse(value);
settings[name] = JSON.parse(value);
} catch {
settings[key] = value;
settings[name] = value;
}
return _r(true);

View File

@ -22,6 +22,12 @@ deploy_migrations() {
npx prisma migrate deploy
}
# Function to push the Prisma database
push_database() {
echo "Pushing the database..."
npx prisma db push
}
# Wait for the database to be ready
wait_for_db
@ -31,6 +37,9 @@ generate_prisma
# Deploy Prisma migrations
deploy_migrations
# Push the database
push_database
# Start the application
echo "Starting the application..."
npm start