Skip to content

What This Adds In Cloud Code

  • Queue attachment processing for orders.
  • Reset attachment download counters.
  • Accepts either object drops or raw ids.

Quick Start

js
const OrderHelpers = require('order_helpers');
OrderHelpers.queueAttachmentProcessing(request.params.order_id);

API

FunctionParamsReturnsNotes
queue_attachment_processing(orderOrId) / queueAttachmentProcessing(...)order object or idbooleanEnqueues processing job for attachments.
reset_attachment_download_count(orderOrId, attachmentOrId) / resetAttachmentDownloadCount(...)order + attachment refbooleanResets downloads left to default runtime value.

Practical Example

js
const OrderHelpers = require('order_helpers');

Nimbu.Cloud.define('resetOrderAttachment', (request, response) => {
  const ok = OrderHelpers.resetAttachmentDownloadCount(
    request.params.order_id,
    request.params.attachment_id
  );

  response.success({ ok });
});

Failure Modes & Gotchas

  • Invalid ids can cause falsey outcomes.
  • Use this for order attachments only, not generic files.