History

fixxx

Julius Marminge committed 8 months ago

Commit 35817601 parent 2b154db2 files · +15 −12Browse files

Unified · Split

2 files
  1. apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts +6 −5
  2. apps/server/src/persistence/Layers/ProjectionThreadMessages.ts +9 −7
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts+6−5
@@ -43,12 +43,13 @@ const ProjectionProjectDbRowSchema = ProjectionProject.mapFields( · 42 unmodified lines
4343 scripts: Schema.fromJsonString(Schema.Array(ProjectScript)),
4444 }),
4545 );
46+const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
47+ Struct.assign({
48+ isStreaming: Schema.Number,
49+ attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
50+ }),
51+);
4652 const ProjectionThreadDbRowSchema = ProjectionThread;
47−const ProjectionThreadMessageDbRowSchema = Schema.Struct({
48− ...ProjectionThreadMessage.fields,
49− isStreaming: Schema.Number,
50− attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
51−});
5253 const 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 @@
11 import * as SqlClient from "effect/unstable/sql/SqlClient";
22 import * as SqlSchema from "effect/unstable/sql/SqlSchema";
3−import { Effect, Layer, Schema } from "effect";
3+import { Effect, Layer, Schema, Struct } from "effect";
44 import { ChatAttachment } from "@t3tools/contracts";
55
66 import { toPersistenceSqlError } from "../Errors.ts";
@@ -12,11 +12,12 @@ import { · 5 unmodified lines
1212 ProjectionThreadMessage,
1313 } from "../Services/ProjectionThreadMessages.ts";
1414
15−const ProjectionThreadMessageDbRowSchema = Schema.Struct({
16− ...ProjectionThreadMessage.fields,
17− isStreaming: Schema.Number,
18− attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
19−});
15+const ProjectionThreadMessageDbRowSchema = ProjectionThreadMessage.mapFields(
16+ Struct.assign({
17+ isStreaming: Schema.Number,
18+ attachments: Schema.NullOr(Schema.fromJsonString(Schema.Array(ChatAttachment))),
19+ }),
20+);
2021
2122 const makeProjectionThreadMessageRepository = Effect.gen(function* () {
2223 const sql = yield* SqlClient.SqlClient;
@@ -24,7 +25,8 @@ const makeProjectionThreadMessageRepository = Effect.gen(function* () { · 1 unmodified line
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,