f034_sqlite_database #19

Merged
jared merged 34 commits from f034_sqlite_database into development 2025-07-24 14:34:39 +02:00
3 changed files with 14 additions and 3 deletions
Showing only changes of commit f7245fac90 - Show all commits

View File

@@ -27,6 +27,14 @@ export const getVorgangByCaseId = async (caseId: string) => {
return list; return list;
}; };
export const getVorgang = function (caseId: string) {
let getVorgang_stmt = `SELECT token, name, pw FROM cases WHERE token = ?`;
const stmt = db.prepare(getVorgang_stmt);
const res = stmt.get(caseId);
return res;
};
/** /**
* Fetches list of vorgänge from s3 bucket * Fetches list of vorgänge from s3 bucket
* @returns list of available cases * @returns list of available cases

View File

@@ -1,4 +1,4 @@
import { getVorgangByCaseId } from '$lib/server/vorgangService'; import { getVorgang, getVorgangByCaseId } from '$lib/server/vorgangService';
import type { PageServerLoad } from './$types'; import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params, url }) => { export const load: PageServerLoad = async ({ params, url }) => {
@@ -6,9 +6,11 @@ export const load: PageServerLoad = async ({ params, url }) => {
const caseToken = url.searchParams.get('token'); const caseToken = url.searchParams.get('token');
const crimesList = await getVorgangByCaseId(caseId); const crimesList = await getVorgangByCaseId(caseId);
const vorg = getVorgang(caseId);
return { return {
crimesList, crimesList,
caseToken caseToken,
vorg
}; };
}; };

View File

@@ -26,6 +26,7 @@
// add other properties as needed // add other properties as needed
} }
const vorg = data.vorg;
const crimesList: ListItem[] = data.crimesList; const crimesList: ListItem[] = data.crimesList;
const token: string = data.caseToken; const token: string = data.caseToken;
@@ -132,7 +133,7 @@
<div class="-z-10 bg-white"> <div class="-z-10 bg-white">
<div class="flex flex-col items-center justify-center w-full"> <div class="flex flex-col items-center justify-center w-full">
<h1 class="text-xl">Vorgang {$page.params.vorgang}</h1> <h1 class="text-xl">Vorgang {vorg.name}</h1>
</div> </div>
<div class="mx-auto flex justify-center max-w-7xl h-full"> <div class="mx-auto flex justify-center max-w-7xl h-full">
<ul class="divide-y divide-gray-100"> <ul class="divide-y divide-gray-100">