Browse Source

cp config in start-ecs script

feature/dockerfile-arm
Evan Feenstra 4 years ago
parent
commit
8d8f740e03
  1. 5
      api/controllers/contacts.ts
  2. 5
      dist/api/controllers/contacts.js
  3. 2
      dist/api/controllers/contacts.js.map
  4. 2
      package.json

5
api/controllers/contacts.ts

@ -143,23 +143,18 @@ const deleteContact = async (req, res) => {
const owner = await models.Contact.findOne({ where: { isOwner: true }})
const tribesImAdminOf = await models.Chat.findAll({where:{ownerPubkey:owner.publicKey}})
console.log("TRIES IM ADMIN OF", tribesImAdminOf)
const tribesIdArray = tribesImAdminOf && tribesImAdminOf.length && tribesImAdminOf.map(t=>t.id)
console.log("TRIES ID ARRAY",tribesIdArray)
let okToDelete = true
if(tribesIdArray && tribesIdArray.length) {
const thisContactMembers = await models.ChatMember.findAll({where:{contactId:id,chatId:{[Op.in]:tribesIdArray}}})
console.log("thisContactMembers for this guy",thisContactMembers)
if(thisContactMembers&&thisContactMembers.length){
// IS A MEMBER! dont delete, instead just set from_group=true
okToDelete=false
console.log("SET CONTACT FROM.GROUP=true")
await contact.update({fromGroup:true})
}
}
if(okToDelete){
console.log("ACTULLAY DELTE CONTACT")
await contact.update({
deleted:true,
publicKey:'',

5
dist/api/controllers/contacts.js

@ -130,22 +130,17 @@ const deleteContact = (req, res) => __awaiter(void 0, void 0, void 0, function*
return;
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const tribesImAdminOf = yield models_1.models.Chat.findAll({ where: { ownerPubkey: owner.publicKey } });
console.log("TRIES IM ADMIN OF", tribesImAdminOf);
const tribesIdArray = tribesImAdminOf && tribesImAdminOf.length && tribesImAdminOf.map(t => t.id);
console.log("TRIES ID ARRAY", tribesIdArray);
let okToDelete = true;
if (tribesIdArray && tribesIdArray.length) {
const thisContactMembers = yield models_1.models.ChatMember.findAll({ where: { contactId: id, chatId: { [sequelize_1.Op.in]: tribesIdArray } } });
console.log("thisContactMembers for this guy", thisContactMembers);
if (thisContactMembers && thisContactMembers.length) {
// IS A MEMBER! dont delete, instead just set from_group=true
okToDelete = false;
console.log("SET CONTACT FROM.GROUP=true");
yield contact.update({ fromGroup: true });
}
}
if (okToDelete) {
console.log("ACTULLAY DELTE CONTACT");
yield contact.update({
deleted: true,
publicKey: '',

2
dist/api/controllers/contacts.js.map

File diff suppressed because one or more lines are too long

2
package.json

@ -16,7 +16,7 @@
"tsc": "rm -rf dist/ && tsc && cp -r public dist/public",
"dev": "rm -rf dist/ && tsc && cp -r public dist/public && node --inspect ./dist/app.js",
"build-binaries": "rm -rf dist/ && tsc && cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && pkg . --target node12-alpine-x64,node12-macos-x64 --out-path binaries",
"start-ecs": "export NODE_ENV=production && node --max-old-space-size=128 dist/app.js"
"start-ecs": "cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && export NODE_ENV=production && node --max-old-space-size=128 dist/app.js"
},
"keywords": [],
"author": "",

Loading…
Cancel
Save