diff --git a/TODO.md b/TODO.md index ea880bb3..668aceca 100644 --- a/TODO.md +++ b/TODO.md @@ -77,7 +77,7 @@ - [x] Compound ID - [ ] Cross field comparison - [x] Many-to-many relation - - [ ] Self relation + - [x] Self relation - [ ] Empty AND/OR/NOT behavior - [x] Logging - [x] Error system diff --git a/packages/runtime/test/schemas/typing/schema.ts b/packages/runtime/test/schemas/typing/schema.ts index a86dda22..2b331e0b 100644 --- a/packages/runtime/test/schemas/typing/schema.ts +++ b/packages/runtime/test/schemas/typing/schema.ts @@ -80,7 +80,9 @@ export const schema = { email: { type: "String" } }, computedFields: { - postCount(): OperandExpression { + postCount(_context: { + currentModel: string; + }): OperandExpression { throw new Error("This is a stub for computed field"); } } diff --git a/packages/runtime/test/schemas/typing/typecheck.ts b/packages/runtime/test/schemas/typing/typecheck.ts index e90b0f82..c7d0cdb7 100644 --- a/packages/runtime/test/schemas/typing/typecheck.ts +++ b/packages/runtime/test/schemas/typing/typecheck.ts @@ -11,7 +11,7 @@ const client = new ZenStackClient(schema, { postCount: (eb) => eb .selectFrom('Post') - .whereRef('Post.authorId', '=', 'User.id') + .whereRef('Post.authorId', '=', 'id') .select(({ fn }) => fn.countAll().as('postCount')), }, }, diff --git a/samples/blog/main.ts b/samples/blog/main.ts index cbae0423..dfaa6c04 100644 --- a/samples/blog/main.ts +++ b/samples/blog/main.ts @@ -6,7 +6,6 @@ import { schema } from './zenstack/schema'; async function main() { const db = new ZenStackClient(schema, { dialect: new SqliteDialect({ database: new SQLite('./zenstack/dev.db') }), - log: ['query'], computedFields: { User: { postCount: (eb, { currentModel }) =>