asu_tools_service/services/dbExporter.service.js
2026-08-26 10:08:25 +03:00

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";