Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions dbWrapper/mongoUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const {
collections,
} = require('../helpers/constants');

const {
getAddressesDetails,
} = require('./addresses');

const keystore = require('../keystore/kyc-admin.json');

let _db;
Expand Down Expand Up @@ -38,6 +42,11 @@ const initToResyncDb = async () => {

const initToProcessOnlyDb = async () => {
console.log('in initToProcessOnlyDb');

// read who the current forum admin/kyc admins are
const kycAdmins = await getAddressesDetails({ isKycOfficer: true });
const forumAdmins = await getAddressesDetails({ isForumAdmin: true });

// wipe everything except synced transactions
await _emptyCollections([
collections.ADDRESSES,
Expand All @@ -61,6 +70,20 @@ const initToProcessOnlyDb = async () => {
},
});

const kycAdminsInsertions = kycAdmins.map((item) => {
return {
address: item.address,
isKycOfficer: true,
};
});
const forumAdminsInsertions = forumAdmins.map((item) => {
return {
address: item.address,
isForumAdmin: true,
};
});
await _db.collection(collections.ADDRESSES).insertMany(kycAdminsInsertions.concat(forumAdminsInsertions));

console.log('cleared DB, except synced transactions. Will now start reprocessing');
};

Expand Down