File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
apps/api/src/trpc/routers/products Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -270,10 +270,11 @@ export const publishRouter = createTRPCRouter({
270270 const { db, brandId } = ctx as BrandContext ;
271271
272272 try {
273+ const uniqueProductIds = Array . from ( new Set ( input . productIds ) ) ;
273274 const updatedProductIds = await setProductsPublished (
274275 db ,
275276 brandId ,
276- input . productIds ,
277+ uniqueProductIds ,
277278 ) ;
278279 const dirtyResult = await markPassportsDirtyByProductIds (
279280 db ,
@@ -285,7 +286,7 @@ export const publishRouter = createTRPCRouter({
285286 success : true ,
286287 totalProductsPublished : updatedProductIds . length ,
287288 totalVariantsPublished : dirtyResult . marked ,
288- totalFailed : input . productIds . length - updatedProductIds . length ,
289+ totalFailed : uniqueProductIds . length - updatedProductIds . length ,
289290 productsMarkedDirty : updatedProductIds . length ,
290291 } ;
291292 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments