From 74728baf127f32dcb439ee3fd60d1d61199b3b83 Mon Sep 17 00:00:00 2001 From: evlist Date: Fri, 3 Mar 2023 09:56:04 +0100 Subject: [PATCH] Adding empty API routes --- src/lib/put.ts | 6 +++++- src/routes/api/conf/[token]/[code]/index.ts | 6 ++++++ src/routes/api/conf/[token]/index.ts | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/routes/api/conf/[token]/[code]/index.ts create mode 100644 src/routes/api/conf/[token]/index.ts diff --git a/src/lib/put.ts b/src/lib/put.ts index 9f74908..91ed785 100644 --- a/src/lib/put.ts +++ b/src/lib/put.ts @@ -7,7 +7,8 @@ export const put = async ( id: string, content: any, isNew: boolean = false, - db = 'dyomedea_users' + db = 'dyomedea_users', + overwrite_ = false ) => { const credentials = adminCredentials(); if (!credentials) { @@ -19,6 +20,9 @@ export const put = async ( const previous = await get(id, db); if (!!previous) { content._rev = previous._rev; + if (!overwrite_) { + content.__ = previous.__; + } } } diff --git a/src/routes/api/conf/[token]/[code]/index.ts b/src/routes/api/conf/[token]/[code]/index.ts new file mode 100644 index 0000000..abccdc4 --- /dev/null +++ b/src/routes/api/conf/[token]/[code]/index.ts @@ -0,0 +1,6 @@ +import { APIEvent, json } from 'solid-start/api'; + +export async function GET({ params, env }: APIEvent) { + console.log({ caller: 'api/conf GET', params }); + return json({ params, env, response: 'OK' }); +} diff --git a/src/routes/api/conf/[token]/index.ts b/src/routes/api/conf/[token]/index.ts new file mode 100644 index 0000000..abccdc4 --- /dev/null +++ b/src/routes/api/conf/[token]/index.ts @@ -0,0 +1,6 @@ +import { APIEvent, json } from 'solid-start/api'; + +export async function GET({ params, env }: APIEvent) { + console.log({ caller: 'api/conf GET', params }); + return json({ params, env, response: 'OK' }); +}