mirror of
https://github.com/sergeyyarkov/asu_tools_service.git
synced 2026-10-11 10:29:22 +03:00
21 lines
621 B
JavaScript
21 lines
621 B
JavaScript
import { equipmentRepository } from "#root/repositories/equipment.repository.js";
|
|
|
|
/** @import { ExporterAdapterInterface } from './types.js' */
|
|
|
|
export const dbExporterService = {
|
|
/**
|
|
* @param { new () => ExporterAdapterInterface } Adapter
|
|
* @param {{ filter?: { systemIds?: number[] | string[] } }} options
|
|
* */
|
|
async export(Adapter, options) {
|
|
const db = await equipmentRepository.getAll({ filter: options.filter });
|
|
const AdapterInstance = new Adapter();
|
|
|
|
/** @type {Buffer} */
|
|
const data = await AdapterInstance.export(db);
|
|
return data;
|
|
}
|
|
};
|
|
|
|
export * from "./exporters/index.js";
|