Browse Source

add meta to PUT chat/:id

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
e04bea8fbc
  1. 4
      dist/src/controllers/chats.js
  2. 2
      dist/src/controllers/chats.js.map
  3. 3
      src/controllers/chats.ts

4
dist/src/controllers/chats.js

@ -32,12 +32,14 @@ function updateChat(req, res) {
if (!chat) {
return res_1.failure(res, 'chat not found');
}
const { name, photo_url } = req.body;
const { name, photo_url, meta } = req.body;
const obj = {};
if (name)
obj.name = name;
if (photo_url)
obj.photoUrl = photo_url;
if (meta && typeof meta === 'string')
obj.meta = meta;
if (Object.keys(obj).length > 0) {
yield chat.update(obj);
}

2
dist/src/controllers/chats.js.map

File diff suppressed because one or more lines are too long

3
src/controllers/chats.ts

@ -21,11 +21,12 @@ export async function updateChat(req, res){
if(!chat) {
return failure(res,'chat not found')
}
const {name,photo_url} = req.body
const {name,photo_url,meta} = req.body
const obj:{[k:string]:any} = {}
if(name) obj.name=name
if(photo_url) obj.photoUrl=photo_url
if(meta && typeof meta==='string') obj.meta=meta
if(Object.keys(obj).length>0) {
await chat.update(obj)

Loading…
Cancel
Save