Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const changes = changeSet.changes;
changes.forEach(item => {
// Only know how to delete villains
if (item.entityName === 'Villain') {
const deleteIds = item.entities as number[];
this.db['villains'] = this.db['villains'].filter(v => !deleteIds.includes(v.id));
}
});
// In this example, the server processes the request
// w/o changing the data that it inserts or updates.
// There's no reason to expect the server to return anything.
// So this API responds with 204-No Content and no body.
const options: ResponseOptions = {
url: requestInfo.url,
status: STATUS.NO_CONTENT,
statusText: 'NO CONTENT',
body: null
};
// But if it did return updated entities it might respond with this
// const options: ResponseOptions = {
// url: requestInfo.url,
// status: STATUS.OK,
// statusText: 'OK',
// body: changeSet
// };
return requestInfo.utils.createResponse$(() => options);
}
}