Implement DB interface for Piece CRUD
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Schema as S } from "@effect/schema";
|
||||
import { SessionId } from "common";
|
||||
import { Login, Logout, Me } from "common/api";
|
||||
import { CreatePiece, GetPieces, UpdatePiece, DeletePiece, Login, Logout, Me } from "common/api";
|
||||
import { AccessLog, SessionData } from "common/db";
|
||||
import { DateTime, Duration, Either as E, Effect, Match, Option as O, pipe } from "effect";
|
||||
import { constant } from "effect/Function";
|
||||
@@ -111,7 +111,15 @@ export const app = pipe(
|
||||
yield* db.createAccessLog(accessLog);
|
||||
console.log(`${DateTime.toDateUtc(accessLog.timestamp).toISOString()} ${accessLog.requestId} ${accessLog.method} ${accessLog.pathname}?${new URLSearchParams(accessLog.query).toString()} ${accessLog.ip}`);
|
||||
|
||||
if (yield* match(Login)) {
|
||||
if (yield* match(CreatePiece)) {
|
||||
return new Response(null, { status: 501 });
|
||||
} else if (yield* match(GetPieces)) {
|
||||
return new Response(null, { status: 501 });
|
||||
} else if (yield* match(UpdatePiece)) {
|
||||
return new Response(null, { status: 501 });
|
||||
} else if (yield* match(DeletePiece)) {
|
||||
return new Response(null, { status: 501 });
|
||||
} else if (yield* match(Login)) {
|
||||
|
||||
const body = yield* requestJson(Login.props.request.schema);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user