All files / src/deposits/schema tableSchema.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 2/2
100% Lines 6/6

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 38 3910x             10x                                               10x   3x   10x   5x  
import {
  marshallItem,
  unmarshallItem,
  Schema,
} from '@aws/dynamodb-data-marshaller';
import { AttributeMap } from 'aws-sdk/clients/dynamodb';
 
const depositTableSchema: Schema = {
  id: { type: 'String' },
  depositUuid: { type: 'String' },
  entityUuid: { type: 'String' },
  timestamp: { type: 'String' },
  status: { type: 'String' },
  dailyTotals: {
    type: 'List',
    memberType: {
      type: 'Document',
      members: { date: { type: 'String' }, amount: { type: 'Number' } },
    },
  },
  account: { type: 'String' },
  reference: { type: 'String' },
  totalAmount: { type: 'Number' },
  feeAmount: { type: 'Number' },
  refundsAmount: { type: 'Number' },
  chargeBacksAmount: { type: 'Number' },
  owingAmount: { type: 'Number' },
  adjustedAmount: { type: 'Number' },
  depositAmount: { type: 'Number' },
}
 
export const marshallDeposit = (data: {
  [key: string]: any;
}): AttributeMap => marshallItem(depositTableSchema, data);
 
export const unmarshallDeposit = (
  data: AttributeMap,
): { [key: string]: any } => unmarshallItem(depositTableSchema, data);