File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ const schema = z.object({
245245 name: z .string (),
246246 author: z .string (),
247247 created_at: z .date (), // Accept Date objects as input
248+ archived: z .boolean (), // Accept Booleans as input
248249})
249250
250251// Schema to transform from SQLite types to our output types
@@ -254,8 +255,10 @@ const deserializationSchema = z.object({
254255 author: z .string (),
255256 created_at: z
256257 .string ()
257- .nullable ()
258- .transform ((val ) => (val ? new Date (val ) : null )), // SQLite TEXT to Date
258+ .transform ((val ) => (new Date (val ))), // SQLite TEXT to Date
259+ archived: z
260+ .number ()
261+ .transform ((val ) => (val > 0 ), // SQLite INTEGER to Boolean
259262})
260263
261264const documentsCollection = createCollection (
@@ -269,6 +272,18 @@ const documentsCollection = createCollection(
269272 },
270273 })
271274)
275+
276+ /** Note: The types for input and output are defined as this */
277+ // Used for mutations like `insert` or `update`
278+ type DocumentCollectionInput = {
279+ id: string
280+ name : string
281+ author : string
282+ created_at : Date
283+ archived : boolean
284+ }
285+ // The type of query/data results
286+ type DocumentCollectionOutput = DocumentCollectionInput
272287` ` `
273288
274289## Features
You can’t perform that action at this time.
0 commit comments