Profile Handle

This commit is contained in:
Luis Fernando Molina committed 2021-08-26 16:54:05 +02:00
1 parent 6c8f75d3e7
commit dba49aa67d
5 files changed
+19 -12

No files matched your search

+7 -6
View File
@@ -2,12 +2,13 @@
global.NT = {
memory: {
USER_PROFILES: new Map(), // Here we will store the user profiles and their statistics.
POSTS: new Map(), // This are all the posts we are keeping track of.
EVENTS: new Map(), // This is the registry of all events received that prevents processing them more than once.
TIMELINE: [], // A time ordered list of Posts and Trades.
NETWORK_CLIENTS: [], // These are the Network Clients connected to this Network Node.
NETWORK_PEERS: [], // These are the Network Peers connected to this Network Node.
USER_PROFILES_BY_ID: new Map(), // Here we will store the user profiles by User Profile Id.
USER_PROFILES_BY_HANDLE: new Map(), // Here we will store the user profiles by User Profile Handle.
POSTS: new Map(), // This are all the posts we are keeping track of.
EVENTS: new Map(), // This is the registry of all events received that prevents processing them more than once.
TIMELINE: [], // A time ordered list of Posts and Trades.
NETWORK_CLIENTS: [], // These are the Network Clients connected to this Network Node.
NETWORK_PEERS: [], // These are the Network Peers connected to this Network Node.
},
modules: {
USER_PROFILE: require('./UserProfile.js'),
+7 -3
View File
@@ -15,8 +15,12 @@ exports.newProfileStatsQuery = function newProfileStatsQuery() {
function initialize(queryReceived) {
thisObject.profile = NT.memory.PROFILES.get(queryReceived.targetUserProfileId)
if (queryReceived.targetUserProfileId !== undefined) {
thisObject.profile = NT.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
} else {
thisObject.profile = NT.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileHandle)
}
if (thisObject.profile === undefined) {
throw ('Target User Profile Not Found.')
}
@@ -27,7 +31,7 @@ exports.newProfileStatsQuery = function newProfileStatsQuery() {
return {
"userProfieId": thisObject.profile.userProfieId,
"githubUsername": thisObject.profile.githubUsername,
"userHandle": thisObject.profile.userHandle,
"blockchainAccount": thisObject.profile.blockchainAccount,
"ranking": thisObject.profile.ranking,
"multiMediaPostFollowingCount": thisObject.profile.multiMediaPostFollowingCount,
+2
View File
@@ -54,6 +54,8 @@ exports.newClientInterface = function newClientInterface() {
"queryType": 10,
"emitterUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"targetUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"emitterUserProfileHandle": "Luis-Fernando-Molina",
"targetUserProfileHandle": "Luis-Fernando-Molina",
"emitterPostHash": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"targetPostHash": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"timestamp": 124234234234,
+2 -2
View File
@@ -58,13 +58,13 @@ exports.newEvent = function newEvent() {
function initialize(eventReceived) {
thisObject.emitterUserProfile = NT.memory.USER_PROFILES.get(eventReceived.emitterUserProfileId)
thisObject.emitterUserProfile = NT.memory.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
if (thisObject.emitterUserProfile === undefined) {
throw ('Emitter User Profile Not Found.')
}
thisObject.emitterUserProfile.emitterEventsCount++
thisObject.targetUserProfile = NT.memory.USER_PROFILES.get(eventReceived.targetUserProfileId)
thisObject.targetUserProfile = NT.memory.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
if (thisObject.targetUserProfile === undefined) {
/* We thow an exception when it does not have a target user profile and is required*/
if (
+1 -1
View File
@@ -2,7 +2,7 @@ exports.newUserProfile = function newUserProfile() {
let thisObject = {
userProfieId: undefined,
githubUsername: undefined,
userHandle: undefined,
blockchainAccount: undefined,
multiMediaPostsFollowing: undefined,
multiMediaPostsFollowers: undefined,