Skip to content

[BE-69] Implement QR code and barcode generation endpoint with scan-to-lookup support #1039

Description

@yusuftomilola

Overview

Assets should have scannable QR codes and barcodes for physical tagging. Scanning a QR code should instantly open the asset detail page. This issue generates QR/barcode images at asset creation and provides a lookup endpoint so mobile scanners can resolve the asset from a raw barcode value.

Context

  • qrcode@1.5.4 is already installed (used by 2FA in BE-13) — the same library can generate asset QR codes
  • Barcodes can use bwip-js or jsbarcode — evaluate and install the lighter option
  • The QR code payload should encode the asset's detail page URL: ${FRONTEND_URL}/assets/{assetId}
  • QR/barcode images should be stored in S3 (using FileService from BE-06), not as base64 blobs in the DB

Acceptance Criteria

  • Install and evaluate a barcode generation library; add to package.json
  • On POST /assets (BE-20): auto-generate a QR code PNG and a Code128 barcode PNG, upload both to S3 under qrcodes/{assetId}/, store the S3 keys in Asset.qrCode and Asset.barcode
  • GET /assets/:id/qrcode — returns a pre-signed S3 URL for the QR code image (valid 1 hour)
  • GET /assets/:id/barcode — returns a pre-signed S3 URL for the barcode image (valid 1 hour)
  • GET /assets/scan?code= — looks up an asset by its assetId string or barcode value; returns the full asset object. Used by mobile scanner to resolve a physical scan
  • POST /assets/:id/regenerate-codes (ADMIN only) — regenerates both QR and barcode if the asset ID changes or codes are lost

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions