BODi Live Class Payload Massage

by bryandowning

JavaScript

const input = [
  {
    scheduledDatetimeUTC: '2021-11-01T17:00:00.000Z',
    productionNotes: 'BODi 11-1',
    isFirstPlay: true,
    classMetadataId: '3626585',
    classDuration: 1800,
    trainerId: '3634953',
    stageId: '2da7301c-575d-4cec-b9c0-7eff13239086',
    bodcastCapacity: 0,
    status: 2,
    isStudioRecording: false,
    videoType: 1,
    isRoyaltyFreeMusic: false,
  },
];
const patches = [{
    patch: {
      videoId: "bodi_dH5nUYhuSyg_09242021"
    }
  },
];

const output = input.map((c, i) => ({
  post: { ...c },
  patch: patches[i].patch
}));

console.log(output);
console.log(JSON.stringify(output, null, 2));