Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
put(reqInfo: RequestInfo) {
const collectionName = reqInfo.collectionName;
if (collectionName === 'accounts') {
(reqInfo.req as any).body = { id: reqInfo.id, ...(reqInfo.req as any).body };
} else if (collectionName === 'notifications' || collectionName === 'subscription') {
reqInfo.collection[0].map(item => {
if (item.id === reqInfo.id) {
return { id: reqInfo.id, ...(reqInfo.req as any).body };
}
return item;
});
const options: ResponseOptions = {
status: STATUS.ACCEPTED,
};
return reqInfo.utils.createResponse$(() => {
return this.finishOptions(options, reqInfo);
});
} else {
return undefined; // let the default PUT handle all others
}
}