This commit is contained in:
seb
2026-09-27 16:19:45 +02:00
parent e7f92ebef8
commit cd57f21af8
25 changed files with 412 additions and 49 deletions

View File

@@ -0,0 +1,28 @@
import { DELETE_BY_BRAND as MSSQL_DELETE } from '../../providers/mssql/queries/brandpic.js';
import { DELETE_BY_BRAND as SQLITE_DELETE } from '../../providers/sqlite3/queries/brandpic.js';
import resolveBrandAccess from './resolveBrandAccess.js';
import makeRunner from '../runner.js';
export default function deleteImage(provider) {
const access = resolveBrandAccess(provider);
const sql = provider?.dialect === 'sqlite3' ? SQLITE_DELETE : MSSQL_DELETE;
return async (googleAuthId, brandId, tx) => {
const runner = makeRunner(provider, tx);
await access(googleAuthId, brandId, runner);
const result = await runner.query(sql, { brandId });
if (!result.rowsAffected) {
throw new Error('Image not found');
}
return {
id: brandId,
thumbW: null,
thumbH: null,
thumbHash: null,
pics: [],
};
};
}