blob: 0bf41f603ed897648579da892e812d68c696c619 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { createClient } from '@supabase/supabase-js';
import { single, collection } from './supabase';
import { supabase } from '$lib/config/config';
import type { Forum } from '$lib/data/types';
const client = createClient(supabase.url, supabase.key);
export const forum = (id: string, withTopics = false) =>
single<Forum>(
client
.from('forums')
.select(
withTopics
? `*,
topics (
*
)
`
: '*'
)
.eq('id', id),
null
);
export const forums = collection<Forum>(client.from('forums').select('*'), []);
|