Ocelot-Social/backend/src/db/data-branding.ts
Ulf Gebhardt d7d8a242cd
fix(backend): fixes for branding (#8449)
* copy from branding folder to backend public folder

provide default branding/public folder

* copy public folder correctly

* copy files again for providers.json

* copy more public folders

* more copy

* revert change

* fix naming of called script when using db:data:branding

* prod command for branding data

* close database connection

* lint fixes

* increase test timeout again
2025-04-28 18:17:18 +02:00

28 lines
865 B
TypeScript

/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-floating-promises */
import { readdir } from 'node:fs/promises'
import path from 'node:path'
import { getNeode } from './neo4j'
const dataFolder = path.join(__dirname, 'data/')
const neode = getNeode()
;(async function () {
const files = await readdir(dataFolder)
for await (const file of files) {
if (file.slice(0, -3).endsWith('-branding')) {
const importedModule = await import(path.join(dataFolder, file))
if (!importedModule.default) {
throw new Error('Your data file must export a default function')
}
await importedModule.default()
}
}
// close database connection
neode.close()
})()