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(...@@ -43,12 +43,13 @@ const ProjectionProjectDbRowSchema = ProjectionProject.mapFields(
43 scripts: Schema.fromJsonString(Schema.Array(ProjectScript)),43 scripts: Schema.fromJsonString(Schema.Array(ProjectScript)),
44 }),44 }),
45);45);
46const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
47 Struct.assign({
48 isStreaming: Schema.Number,
49 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
50 }),
51);
46const ProjectionThreadDbRowSchema = ProjectionThread;52const ProjectionThreadDbRowSchema = ProjectionThread;
47const ProjectionThreadMessageDbRowSchema = Schema.Struct({
48 ...ProjectionThreadMessage.fields,
49 isStreaming: Schema.Number,
50 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
51});
52const ProjectionThreadActivityDbRowSchema = ProjectionThreadActivity.mapFields(53const ProjectionThreadActivityDbRowSchema = ProjectionThreadActivity.mapFields(
53 Struct.assign({54 Struct.assign({
54 payload: Schema.fromJsonString(Schema.Unknown),55 payload: Schema.fromJsonString(Schema.Unknown),
apps/server/src/persistence/Layers/ProjectionThreadMessages.ts+9-7
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1import * as SqlClient from "effect/unstable/sql/SqlClient";1import * as SqlClient from "effect/unstable/sql/SqlClient";
2import * as SqlSchema from "effect/unstable/sql/SqlSchema";2import * as SqlSchema from "effect/unstable/sql/SqlSchema";
3import { Effect, Layer, Schema } from "effect";3import { Effect, Layer, Schema, Struct } from "effect";
4import { ChatAttachment } from "@t3tools/contracts";4import { ChatAttachment } from "@t3tools/contracts";
55
6import { toPersistenceSqlError } from "../Errors.ts";6import { toPersistenceSqlError } from "../Errors.ts";
...@@ -12,11 +12,12 @@ import {...@@ -12,11 +12,12 @@ import {
12 ProjectionThreadMessage,12 ProjectionThreadMessage,
13} from "../Services/ProjectionThreadMessages.ts";13} from "../Services/ProjectionThreadMessages.ts";
1414
15const ProjectionThreadMessageDbRowSchema = Schema.Struct({15const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
16 ...ProjectionThreadMessage.fields,16 Struct.assign({
17 isStreaming: Schema.Number,17 isStreaming: Schema.Number,
18 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),18 attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
19});19 }),
20);
2021
21const makeProjectionThreadMessageRepository = Effect.gen(function* () {22const makeProjectionThreadMessageRepository = Effect.gen(function* () {
22 const sql = yield* SqlClient.SqlClient;23 const sql = yield* SqlClient.SqlClient;
...@@ -24,7 +25,8 @@ const makeProjectionThreadMessageRepository = Effect.gen(function* () {...@@ -24,7 +25,8 @@ const makeProjectionThreadMessageRepository = Effect.gen(function* () {
24 const upsertProjectionThreadMessageRow = SqlSchema.void({25 const upsertProjectionThreadMessageRow = SqlSchema.void({
25 Request: ProjectionThreadMessage,26 Request: ProjectionThreadMessage,
26 execute: (row) => {27 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;
28 return sql`30 return sql`
29 INSERT INTO projection_thread_messages (31 INSERT INTO projection_thread_messages (
30 message_id,32 message_id,