refactor: resolve merge conflicts
This commit is contained in:
@@ -3,21 +3,23 @@ import { aktis, ratings } from '$lib/server/db/schema';
|
||||
import { error, fail, redirect, type Actions } from '@sveltejs/kit';
|
||||
import { and, eq } from 'drizzle-orm';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { ensureAuth } from '$lib/auth';
|
||||
import { ensureAuth } from '$lib/server/session';
|
||||
import { extractFormData } from '$lib/extractFormData';
|
||||
import * as v from 'valibot';
|
||||
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...' });
|
||||
@@ -56,6 +58,8 @@ export const actions = {
|
||||
|
||||
if (!changeRequest) return fail(400, { message: 'Invalid data' });
|
||||
|
||||
changeRequest.body = sanitizeHtml(changeRequest.body);
|
||||
|
||||
await db
|
||||
.update(aktis)
|
||||
.set({ ...changeRequest, version: akti[0].version + 1 })
|
||||
|
||||
Reference in New Issue
Block a user