feat: Use container for the API service

This commit is contained in:
Lucàs
2024-12-19 11:25:29 +01:00
parent 735ab03d6e
commit 401978a0b4
88 changed files with 865 additions and 3642 deletions
@@ -0,0 +1,25 @@
import { Transform } from "node:stream";
type OpenfoodfactsData = {
code: string;
countries_en: string;
};
export default class OpenfoodfactsDataTransformer extends Transform {
constructor() {
super({ objectMode: true });
}
_transform(chunk: OpenfoodfactsData, encoding: string, callback: () => void) {
const { code, countries_en } = chunk;
if (code && countries_en) {
this.push({
"Barcode (EAN 13)": code,
Country: countries_en,
});
}
callback();
}
}