Spaces:
Sleeping
Sleeping
File size: 754 Bytes
c995cfc 22df730 c995cfc 22df730 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { Worker } from '../worker/dto/worker.dto';
import { bookLinkManager } from './book-link-manager';
import { LinkManager } from './LinkManager';
import { Link } from './Link';
import { Book } from '../book/dto/book.dto';
export interface WorkerWithBooks extends Omit<Worker, 'issuedBooks'> {
issuedBooks: Book[];
}
export class WorkerLinkManager extends LinkManager<Worker> {
protected fileName = 'workers.txt';
protected tableName = 'workers';
async enrich(worker: Worker): Promise<WorkerWithBooks> {
const issuedBooks = await bookLinkManager.resolveMany(
worker.issuedBooks as unknown as Link[],
);
return {
...worker,
issuedBooks,
};
}
}
export const workerLinkManager = new WorkerLinkManager();
|