Files
klz-cables.com/.pnpm-store/v10/files/4d/6ba56b5512557e17ab450d6b0861c7d764f81668e45ea90e6dd03f41293e322958155a0b7237fb7e650cfe5c91dd8ab3d674342c0a16fa2ad1b6ef92e6840b
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

43 lines
1.0 KiB
Plaintext

import { UnauthorizedError } from '../../errors/UnauthorizedError.js';
import { preferencesCollectionSlug } from '../config.js';
export async function update(args) {
const { key, req: { payload }, req, user, value } = args;
if (!user) {
throw new UnauthorizedError(req.t);
}
const where = {
and: [
{
key: {
equals: key
}
},
{
'user.value': {
equals: user.id
}
},
{
'user.relationTo': {
equals: user.collection
}
}
]
};
const preference = {
key,
user: {
relationTo: user.collection,
value: user.id
},
value
};
return await payload.db.upsert({
collection: preferencesCollectionSlug,
data: preference,
req,
where
});
}
//# sourceMappingURL=update.js.map