All files / src/entities shipment_log.ts

100% Statements 18/18
100% Branches 0/0
66.66% Functions 2/3
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 381x   1x             1x   1x 1x 1x 1x   1x     1x     1x     1x     1x     1x     1x   1x  
import { Entity } from '../entity.js';
import type { Shipment } from './shipment.js';
import { User } from './user.js';
 
/**
 * Runtime type tag only. The API returns `detailJson` as arbitrary JSON; the
 * entity layer rejects `Object` from decorator metadata, so we use an empty
 * class as the property `type` (same pattern as DraftTemplate.customisationMap).
 */
const detailJsonPropertyType = class {};
 
export class ShipmentLog extends Entity {
  protected static resourceName = 'shipment_logs';
  protected static singularName = 'shipmentLog';
  protected static pluralName = 'shipmentLogs';
 
  @ShipmentLog.property()
  public id?: number;
 
  @ShipmentLog.property({ type: 'Shipment' })
  public shipment?: Shipment | null;
 
  @ShipmentLog.property({ type: User })
  public user?: User | null;
 
  @ShipmentLog.property({ type: String })
  public sourceType?: string;
 
  @ShipmentLog.property({ type: String })
  public message?: string;
 
  @ShipmentLog.property({ type: detailJsonPropertyType })
  public detailJson?: Record<string, unknown> | null;
 
  @ShipmentLog.property({ type: Date })
  public createdAt?: Date | null;
}