Merge pull request 'Parallelize Database Queries' (#19) from issue-5 into main
Commit / ci (push) Has been cancelled
Commit / ci (push) Has been cancelled
Reviewed-on: #19
This commit was merged in pull request #19.
This commit is contained in:
@@ -10,15 +10,16 @@ import { resolve } from '$app/paths';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
|
||||
export const load: PageServerLoad = async (event) => {
|
||||
const akti = await db.query.aktis.findFirst({
|
||||
where: eq(aktis.id, event.params.aktiId),
|
||||
with: { author: true }
|
||||
});
|
||||
|
||||
const r = await db.query.ratings.findMany({
|
||||
with: { user: true },
|
||||
where: eq(ratings.aktiId, event.params.aktiId)
|
||||
});
|
||||
const [akti, r] = await Promise.all([
|
||||
db.query.aktis.findFirst({
|
||||
where: eq(aktis.id, event.params.aktiId),
|
||||
with: { author: true }
|
||||
}),
|
||||
db.query.ratings.findMany({
|
||||
with: { user: true },
|
||||
where: eq(ratings.aktiId, event.params.aktiId)
|
||||
})
|
||||
]);
|
||||
|
||||
if (!akti) {
|
||||
error(404, { message: 'Die Akti gits garnid, sorry...' });
|
||||
|
||||
Reference in New Issue
Block a user