authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-27 20:35:31-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-27 21:30:46-08:00
log35817601ff3f3d4f2e27ea8c5c8a08a8b0926dc3
treeb1816797208825d9b52c14ea9d13c7d01d8b98fa
parent2b154db9385e505080578903b9aaffac92514f7a

fixxx


2 files changed, 15 insertions(+), 12 deletions(-)

apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts+6-5
......@@ -43,12 +43,13 @@ const ProjectionProjectDbRowSchema = ProjectionProject.mapFields(
4343 scripts: Schema.fromJsonString(Schema.Array(ProjectScript)),
4444 }),
4545);
46const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
47 Struct.assign({
48 isStreaming: Schema.Number,
49 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
50 }),
51);
4652const ProjectionThreadDbRowSchema = ProjectionThread;
47const ProjectionThreadMessageDbRowSchema = Schema.Struct({
48 ...ProjectionThreadMessage.fields,
49 isStreaming: Schema.Number,
50 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
51});
5253const ProjectionThreadActivityDbRowSchema = ProjectionThreadActivity.mapFields(
5354 Struct.assign({
5455 payload: Schema.fromJsonString(Schema.Unknown),
apps/server/src/persistence/Layers/ProjectionThreadMessages.ts+9-7
......@@ -1,6 +1,6 @@
11import * as SqlClient from "effect/unstable/sql/SqlClient";
22import * as SqlSchema from "effect/unstable/sql/SqlSchema";
3import { Effect, Layer, Schema } from "effect";
3import { Effect, Layer, Schema, Struct } from "effect";
44import { ChatAttachment } from "@t3tools/contracts";
55
66import { toPersistenceSqlError } from "../Errors.ts";
......@@ -12,11 +12,12 @@ import {
1212 ProjectionThreadMessage,
1313} from "../Services/ProjectionThreadMessages.ts";
1414
15const ProjectionThreadMessageDbRowSchema = Schema.Struct({
16 ...ProjectionThreadMessage.fields,
17 isStreaming: Schema.Number,
18 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
19});
15const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
16 Struct.assign({
17 isStreaming: Schema.Number,
18 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
19 }),
20);
2021
2122const makeProjectionThreadMessageRepository = Effect.gen(function* () {
2223 const sql = yield* SqlClient.SqlClient;
......@@ -24,7 +25,8 @@ const makeProjectionThreadMessageRepository = Effect.gen(function* () {
2425 const upsertProjectionThreadMessageRow = SqlSchema.void({
2526 Request: ProjectionThreadMessage,
2627 execute: (row) => {
27 const nextAttachmentsJson = row.attachments !== undefined ? JSON.stringify(row.attachments) : null;
28 const nextAttachmentsJson =
29 row.attachments !== undefined ? JSON.stringify(row.attachments) : null;
2830 return sql`
2931 INSERT INTO projection_thread_messages (
3032 message_id,