17 lines
460 B
TypeScript
17 lines
460 B
TypeScript
import { db } from '$lib/server/db';
|
|
import { sponsors } from '$lib/server/schema';
|
|
import { eq, asc } from 'drizzle-orm';
|
|
import type { LayoutServerLoad } from './$types';
|
|
|
|
export const load: LayoutServerLoad = async ({ parent }) => {
|
|
const parentData = await parent();
|
|
|
|
const allSponsors = await db
|
|
.select()
|
|
.from(sponsors)
|
|
.where(eq(sponsors.active, true))
|
|
.orderBy(asc(sponsors.sortOrder));
|
|
|
|
return { ...parentData, sponsors: allSponsors };
|
|
};
|