This commit is contained in:
seb
2026-10-18 03:57:53 +02:00
parent c687553eea
commit 97c909d10b
5 changed files with 20 additions and 20 deletions

View File

@@ -35,14 +35,14 @@ export default function addImage(provider) {
* // => { picId, sort, full: { w, h, size }, thumb: { w, h }, smallThumb: { w, h }, fullHash, thumbHash }
*/
return async (googleAuthId, sku, image, tx) => {
const processed = await processAvifImage(image);
const fullHash = newFullHash(processed.full.buffer);
const runAdd = async (runner) => {
const { articleId } = await resolve(googleAuthId, sku, runner);
const processed = await processAvifImage(image);
const sortResult = await runner.query(getSortSql, { articleId });
const sort = sortResult.rows[0].sort;
const fullHash = newFullHash(processed.full.buffer);
let picId;
const existingPic = await runner.query(

View File

@@ -31,16 +31,16 @@ export default function addImage(provider) {
* @returns {Promise<{id: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW: number, smallThumbH: number, pics: Array<object>}>}
*/
return async (googleAuthId, attributeValueId, image, tx) => {
const processed = await processAvifImage(image);
const fullHash = newFullHash(processed.full.buffer);
const runAdd = async (runner) => {
await access(googleAuthId, attributeValueId, runner);
const processed = await processAvifImage(image);
// Clean existing attributevaluepic so the attribute value has 1 primary image
await runner.query(deleteAvPicSql, { attributeValueId });
const sort = 0;
const fullHash = newFullHash(processed.full.buffer);
let picId;
const existingPic = await runner.query(

View File

@@ -31,16 +31,16 @@ export default function addImage(provider) {
* @returns {Promise<{id: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW: number, smallThumbH: number, pics: Array<object>}>}
*/
return async (googleAuthId, brandId, image, tx) => {
const processed = await processAvifImage(image);
const fullHash = newFullHash(processed.full.buffer);
const runAdd = async (runner) => {
await access(googleAuthId, brandId, runner);
const processed = await processAvifImage(image);
// Clean existing brandpic so the brand has 1 primary logo
await runner.query(deleteBrandPicSql, { brandId });
const sort = 0;
const fullHash = newFullHash(processed.full.buffer);
let picId;
const existingPic = await runner.query(

View File

@@ -35,14 +35,14 @@ export default function addImage(provider) {
* // => { id, fullHash, thumbW, thumbH, thumbHash }
*/
return async (googleAuthId, categoryId, image, tx) => {
const processed = await processAvifImage(image);
const fullHash = newFullHash(processed.full.buffer);
const runAdd = async (runner) => {
await access(googleAuthId, categoryId, runner);
const processed = await processAvifImage(image);
const sortResult = await runner.query(getSortSql, { categoryId });
const sort = sortResult.rows[0].sort;
const fullHash = newFullHash(processed.full.buffer);
let picId;
const existingPic = await runner.query(