diff --git a/src/lib/server/services/tasks.ts b/src/lib/server/services/tasks.ts index 8dcf4a0..47142ea 100644 --- a/src/lib/server/services/tasks.ts +++ b/src/lib/server/services/tasks.ts @@ -80,6 +80,16 @@ class TasksService { }) ); } + + public async getByParent(id: NonNullable) { + logger.info(`Searching for records with parent '${id}'.`); + return this._executeQuery(() => + this.db.query.tasks.findMany({ + with: { type: true }, + where: (tasks, { eq }) => eq(tasks.parent, id), + }) + ); + } } export default TasksService;