From b64c14b0672933a8973b31e8fa99f15c57c9bd21 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Fri, 23 Jul 2021 10:44:54 -0400 Subject: [PATCH] Remove unused getter --- services/gunDB/contact-api/getters/index.js | 63 --------------------- 1 file changed, 63 deletions(-) diff --git a/services/gunDB/contact-api/getters/index.js b/services/gunDB/contact-api/getters/index.js index 8d8260fc..d5e198b6 100644 --- a/services/gunDB/contact-api/getters/index.js +++ b/services/gunDB/contact-api/getters/index.js @@ -1,13 +1,10 @@ /** * @format */ -const Common = require('shock-common') const Key = require('../key') const Utils = require('../utils') -const { size } = require('lodash') - /** * @param {string} pub * @returns {Promise} @@ -26,63 +23,3 @@ exports.currentOrderAddress = async pub => { return currAddr } - -/** - * @returns {Promise} - */ -//@returns {Promise} -const getMyUser = async () => { - const oldProfile = await Utils.tryAndWait( - (_, user) => new Promise(res => user.get(Key.PROFILE).load(res)), - v => { - if (typeof v !== 'object') { - return true - } - - if (v === null) { - return true - } - - // load sometimes returns an empty set on the first try - return size(v) === 0 - } - ) - - const bio = await Utils.tryAndWait( - (_, user) => user.get(Key.BIO).then(), - v => typeof v !== 'string' - ) - - const lastSeenApp = await Utils.tryAndWait( - (_, user) => user.get(Key.LAST_SEEN_APP).then(), - v => typeof v !== 'number' - ) - - const lastSeenNode = await Utils.tryAndWait( - (_, user) => user.get(Key.LAST_SEEN_NODE).then(), - v => typeof v !== 'number' - ) - - const publicKey = await Utils.tryAndWait( - (_, user) => Promise.resolve(user.is && user.is.pub), - v => typeof v !== 'string' - ) - //@ts-ignore - /** @type {Common.SchemaTypes.User} */ - const u = { - avatar: oldProfile.avatar, - // @ts-ignore - bio, - displayName: oldProfile.displayName, - // @ts-ignore - lastSeenApp, - // @ts-ignore - lastSeenNode, - // @ts-ignore - publicKey - } - - return u -} - -module.exports.getMyUser = getMyUser