Backend: DB schema, login API

This commit is contained in:
2024-08-03 15:29:29 +02:00
parent 777038e0b4
commit 903168a565
6 changed files with 288 additions and 33 deletions

View File

@@ -0,0 +1,21 @@
import { Data } from "effect";
export class RequestError extends Data.TaggedError("RequestError")<{
readonly status: number,
readonly body?: string,
}> {
get response(): Response {
if (this.body) {
const body = new TextEncoder().encode(this.body);
return new Response(body, {
headers: {
"Content-Length": body.byteLength.toString(),
"Content-Type": "text/plain; charset=utf-8",
},
status: this.status,
});
} else {
return new Response(null, { status: this.status });
}
}
}