f034_sqlite_database #19
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user