Skip to content

Commit be96b09

Browse files
cleanup
1 parent 4fc4974 commit be96b09

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

demos/react-convex-todolist/convex/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default defineSchema({
3131
created_at: v.string(),
3232
completed_at: v.optional(v.string()),
3333
description: v.string(),
34-
completed: v.optional(v.number()),
34+
completed: v.optional(v.boolean()),
3535
list_id: v.id('lists'),
3636
/**
3737
* Local-first version of list_id

demos/react-convex-todolist/src/app/views/todo-lists/TodoListsEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { LIST_PRIORITY_COMPACT, LIST_PRIORITY_OPTIONS } from '@/app/views/todo-l
33
import { OutlinedComposer } from '@/components/widgets/OutlinedComposer';
44
import { SmartTagEditor } from '@/components/widgets/SmartTagEditor';
55
import { TodoItemWidget } from '@/components/widgets/TodoItemWidget';
6-
import { TodoRecord } from '@/library/powersync/AppSchema';
6+
import { Database } from '@/library/powersync/AppSchema';
77
import { useUserId } from '@/library/powersync/useUserId';
88
import { Box, FormControl, List, MenuItem, Paper, Select, TextField, Typography } from '@mui/material';
99
import { usePowerSync, useQuery } from '@powersync/react';
@@ -148,13 +148,13 @@ export function TodoListsEditor(props: TodoListsEditorProps) {
148148
const userID = useUserId();
149149
const { listId } = props;
150150

151-
const { data: todos } = useQuery<TodoRecord>(`SELECT * FROM todos WHERE list_uuid=? ORDER BY created_at, id`, [
151+
const { data: todos } = useQuery<Database['todos']>(`SELECT * FROM todos WHERE list_uuid=? ORDER BY created_at, id`, [
152152
listId
153153
]);
154154

155155
const [newTodoText, setNewTodoText] = React.useState('');
156156

157-
const toggleCompletion = async (record: TodoRecord, completed: boolean) => {
157+
const toggleCompletion = async (record: Database['todos'], completed: boolean) => {
158158
if (!userID) {
159159
throw new Error(`Could not get user ID.`);
160160
}

demos/react-convex-todolist/src/library/powersync/AppSchema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { column, Schema, Table, PowerSyncDatabase, SyncStream } from '@powersync/web';
1+
import { column, PowerSyncDatabase, Schema, SyncStream, Table } from '@powersync/web';
22
// OR: import { column, Schema, Table, PowerSyncDatabase, SyncStream } from '@powersync/react-native';
33

44
const lists = new Table(
@@ -24,6 +24,7 @@ const todos = new Table(
2424
_creationTime: column.real,
2525
_id: column.text,
2626
completed: column.real,
27+
completed_at: column.text,
2728
created_at: column.text,
2829
description: column.text,
2930
list_id: column.text,

0 commit comments

Comments
 (0)