task_receipts/src/server/printer/index.ts

16 lines
556 B
TypeScript
Raw Normal View History

import { Knex } from 'knex';
import { Task, Step } from '../db/types';
import { TestPrinter } from './test-printer';
import { steps } from '../db';
// This will be replaced with a real printer implementation later
const printer = new TestPrinter();
export async function printTask(task: Task, db: Knex): Promise<void> {
const taskSteps = await steps(db).where('task_id', task.id).orderBy('order').select('*');
await printer.printTask(task, taskSteps);
}
export async function printStep(step: Step): Promise<void> {
await printer.printStep(step);
}