This commit is contained in:
seb
2026-08-01 02:15:21 +02:00
parent 59c874144b
commit 69a24192d3
8 changed files with 206 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { DELETE_BY_ARTICLE_AND_HASH } from '../../sql/pic.js';
import resolveArticleBySku from './resolveArticleBySku.js';
export default function deleteImage(pool) {
const resolve = resolveArticleBySku(pool);
return async (googleAuthId, sku, fullHash) => {
const { articleId } = await resolve(googleAuthId, sku);
const result = await pool
.request()
.input('articleId', articleId)
.input('fullHash', fullHash)
.query(DELETE_BY_ARTICLE_AND_HASH);
if (!result.rowsAffected[0]) {
throw new Error('Image not found');
}
};
}