This commit is contained in:
seb
2026-10-18 14:07:01 +02:00
parent 97c909d10b
commit bf4109d8ec
5 changed files with 130 additions and 14 deletions

View File

@@ -11,6 +11,7 @@ import { CREATE as SQLITE_CREATE_PIC } from '../../providers/sqlite3/queries/pic
import processAvifImage from '../../util/processAvifImage.js';
import newFullHash from '../../util/newFullHash.js';
import resolveArticleBySku from './resolveArticleBySku.js';
import { recordImageAddHistory } from '../articlehistory/record.js';
import makeRunner from '../runner.js';
export default function addImage(provider) {
@@ -39,7 +40,7 @@ export default function addImage(provider) {
const fullHash = newFullHash(processed.full.buffer);
const runAdd = async (runner) => {
const { articleId } = await resolve(googleAuthId, sku, runner);
const { articleId, companyuserId } = await resolve(googleAuthId, sku, runner);
const sortResult = await runner.query(getSortSql, { articleId });
const sort = sortResult.rows[0].sort;
@@ -96,6 +97,13 @@ export default function addImage(provider) {
picId,
sort,
});
await recordImageAddHistory(runner, {
articleId,
companyuserId,
fullHash,
sort: effectiveSort,
});
}
return {