diff --git a/src/lib/db/index.ts b/src/lib/db/index.ts index 6130595..8bb1c7b 100644 --- a/src/lib/db/index.ts +++ b/src/lib/db/index.ts @@ -63,3 +63,31 @@ export function get_all_pork() { return db.query('SELECT * FROM pork_cuts').all(); } + +/** + * Thread Stuff + * + * + * + */ + +export function get_all_threads() { + return db.query('SELECT * FROM threads').all(); +} + + +export function create_thread(title, id, creator){ + + db.query('INSERT INTO threads (id, title, progenator) VALUES ($id, $title, $creator)').get({$id: id, $title: title, $creator: creator}) + + return db.query(`CREATE TABLE + '${id}' ( + 'id' integer not null primary key autoincrement, + 'created_at' datetime not null default CURRENT_TIMESTAMP, + 'author' INT not null, + "is_edited?" BOOLEAN not null, + 'content' TEXT not null, + unique ('id'), + foreign key('author') references users('id') + )`) +} \ No newline at end of file diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index fd80880..52506e4 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -3,9 +3,8 @@ import { fail, type Actions } from '@sveltejs/kit'; import { marked } from 'marked'; export async function load() { - const html = marked.parse('# Sludge And Links\n\n**maybe**.'); - return { html }; + return {}; } export const actions: Actions = { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a31f68c..0989ad4 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,8 +1,5 @@ @@ -10,16 +7,51 @@ -
-
{@html html}
-
+
+

Sludge and Friends

+

Here we make friends and mistakes

+
+
+

Sludge Fest

+

+ Sludge Fest is a homegrown music festival of friends and fuckery; come + join us for a fun weekend out and make some memories +

+
+
+

Pork

+

+ I made the mistake of getting hogs that are better at their job than I + am so please take some of it off my hands +

+
+
+

Blag

+

+ There is nothing of value here, I like misspelling things and also for + some reason building my own versions of things that other people have + perfected +

+
+
+
diff --git a/src/routes/fest/+page.svelte b/src/routes/fest/+page.svelte index a48c0ef..ac2339a 100644 --- a/src/routes/fest/+page.svelte +++ b/src/routes/fest/+page.svelte @@ -1,5 +1,5 @@ @@ -13,11 +13,101 @@

At Sludge Farm

Come out and enjoy live music and fun times

If you'd like to perform fill out this Artist Application

+
+
+
+ + + + + + +
+
+ + + + + + + + +
+
+ + + + + + +
+
\ No newline at end of file diff --git a/src/routes/thread/+page.server.ts b/src/routes/thread/+page.server.ts index b0363ec..b5bc49c 100644 --- a/src/routes/thread/+page.server.ts +++ b/src/routes/thread/+page.server.ts @@ -1,16 +1,25 @@ -import { encode, decode } from 'proquint' +import { encode } from 'proquint' import { randomBytes } from 'crypto' +import { get_all_threads, create_thread } from '$lib/db' + export async function load({ fetch, data, setHeaders, parent, depends}) { - console.log("data") - let r = randomBytes(4) - console.log(r.toString("hex")) - let d = encode(r) - console.log(d) - console.log(decode(d)) + console.log("thread") + let threads = await get_all_threads() + for( let thread of threads ){ + thread.name = encode(Buffer.from(thread.id, "hex")) + } + + return { + threads, + uid: 42 + } } export const actions = { - default: async({cookies, fetch, getClientAddress, locals, params, platform, request, route, setHeaders, url, isDataRequest}) => { - + default: async({ request }) => { + console.log("create thread") + let data = await request.formData() + console.log(data) + await create_thread(data.get("title"), randomBytes(4), data.get("uid")) } } \ No newline at end of file diff --git a/src/routes/thread/+page.svelte b/src/routes/thread/+page.svelte index 77b3385..6e5c4b3 100644 --- a/src/routes/thread/+page.svelte +++ b/src/routes/thread/+page.svelte @@ -1,5 +1,6 @@ - @@ -8,11 +9,21 @@
- + {#each data.threads as thread} + {thread.title} + {/each} +
+ + + +
\ No newline at end of file diff --git a/src/routes/thread/[id]/+page.server.js b/src/routes/thread/[id]/+page.server.js new file mode 100644 index 0000000..f720a22 --- /dev/null +++ b/src/routes/thread/[id]/+page.server.js @@ -0,0 +1,8 @@ +export async function load({ params }) { + console.log(params) +} +export const actions = { + default: async({cookies, fetch, getClientAddress, locals, params, platform, request, route, setHeaders, url, isDataRequest}) => { + + } +} \ No newline at end of file diff --git a/src/routes/thread/[id]/+page.svelte b/src/routes/thread/[id]/+page.svelte new file mode 100644 index 0000000..eadbc63 --- /dev/null +++ b/src/routes/thread/[id]/+page.svelte @@ -0,0 +1,18 @@ + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/thread.md b/thread.md new file mode 100644 index 0000000..eb7da0c --- /dev/null +++ b/thread.md @@ -0,0 +1,31 @@ + +# Each conversation a thread +Thread has +- originator +- created_at +- id +- tags - table +- users - table +- messages - table +Each thread makes its own table? +which stores the messages in that thread + +# Message has + - author + - edited flag + - content + - reactions - tables + - replies - tables + - forwards - tables + - id + - rich media + +# User has + - name + - id + - tags + - profile picture + - markdown bio + - email + +