feat: all fields optional
Some checks failed
Build and release / Build (push) Failing after 1m14s
Build and release / update-release-draft (push) Has been skipped
Build and release / Release (push) Has been skipped

This commit is contained in:
Morten Olsen
2025-12-10 22:09:09 +01:00
parent 1255639058
commit 3641e86da5
3 changed files with 7 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ const init: Migration = {
table.text('text').nullable();
table.string('source').nullable();
table.string('sourceId').nullable();
table.string('type').notNullable();
table.string('type').nullable();
table.integer('typeVersion').nullable();
table.jsonb('metadata').nullable();
@@ -78,9 +78,9 @@ type DocumentRow = {
text: string | null;
source: string | null;
sourceId: string | null;
type: string;
type: string | null;
typeVersion: number | null;
metadata: unknown;
metadata: unknown | null;
};
type DocumentChunkRow = {

View File

@@ -14,9 +14,9 @@ const documentSchema = z
text: z.string().nullable(),
source: z.string().nullable(),
sourceId: z.string().nullable(),
type: z.string(),
type: z.string().nullable(),
typeVersion: z.int().nullable(),
metadata: z.unknown(),
metadata: z.unknown().nullable(),
})
.meta({ id: 'Document' });
@@ -31,7 +31,7 @@ const documentUpsertSchema = z
text: z.string().nullish(),
source: z.string().nullish(),
sourceId: z.string().nullish(),
type: z.string().optional(),
type: z.string().nullish(),
typeVersion: z.int().nullish(),
metadata: z.unknown().nullish(),
})

View File

@@ -120,8 +120,6 @@ class DocumentsService extends EventEmitter<DocumentsServiceEvents> {
} as const;
} else {
await trx<TableRows['documents']>(tableNames.documents).insert({
metadata: {},
type: 'raw',
...document,
content: base64ToMaybeBuffer(document.content),
id,
@@ -136,7 +134,7 @@ class DocumentsService extends EventEmitter<DocumentsServiceEvents> {
source: null,
sourceId: null,
typeVersion: null,
metadata: {},
metadata: null,
...document,
content: base64ToMaybeBuffer(document.content) || null,
deletedAt: null,