User Profile Cleaned from Multi Media Posts concept

This commit is contained in:
Luis Fernando Molina committed 2021-08-27 19:42:05 +02:00
1 parent ab98050ad1
commit 7277c932fe
6 files changed
+44 -96

No files matched your search

+1 -1
View File
@@ -16,9 +16,9 @@ global.NT = {
},
modules: {
USER_PROFILE: require('./UserProfile.js'),
BOT: require('./BotProfile.js'),
EVENT: require('./Event.js'),
POST: require('./Post.js'),
BOT: require('./Bot.js'),
QUERY: require('./Query.js'),
QUERY_PROFILE_STATS: require('./Queries/ProfileStats.js'),
QUERY_PROFILE_POSTS: require('./Queries/ProfilePosts.js'),
+6 -6
View File
@@ -145,13 +145,13 @@ exports.newEvents = function newEvents() {
Test #2 : The Emitter or Traget profile must be at the Following map of the Query Profile.
*/
if (emitterUserProfile !== undefined) {
if (thisObject.profile.multiMediaPostsFollowing.get(emitterUserProfile.userProfieId) !== undefined) {
if (thisObject.profile.following.get(emitterUserProfile.userProfieId) !== undefined) {
addToResponse(event)
return
}
}
if (targetUserProfile !== undefined) {
if (thisObject.profile.multiMediaPostsFollowing.get(targetUserProfile.userProfieId) !== undefined) {
if (thisObject.profile.following.get(targetUserProfile.userProfieId) !== undefined) {
addToResponse(event)
return
}
@@ -160,25 +160,25 @@ exports.newEvents = function newEvents() {
Test #3 : The Emmiter or Target post must be belong to any profile at the Following of the Query Profile.
*/
if (emitterPost !== undefined) {
if (thisObject.profile.multiMediaPostsFollowing.get(emitterPost.emitterUserProfileId) !== undefined) {
if (thisObject.profile.following.get(emitterPost.emitterUserProfileId) !== undefined) {
addToResponse(event)
return
}
}
if (emitterPost !== undefined) {
if (thisObject.profile.multiMediaPostsFollowing.get(emitterPost.targetUserProfileId) !== undefined) {
if (thisObject.profile.following.get(emitterPost.targetUserProfileId) !== undefined) {
addToResponse(event)
return
}
}
if (targetPost !== undefined) {
if (thisObject.profile.multiMediaPostsFollowing.get(targetPost.emitterUserProfileId) !== undefined) {
if (thisObject.profile.following.get(targetPost.emitterUserProfileId) !== undefined) {
addToResponse(event)
return
}
}
if (targetPost !== undefined) {
if (thisObject.profile.multiMediaPostsFollowing.get(targetPost.targetUserProfileId) !== undefined) {
if (thisObject.profile.following.get(targetPost.targetUserProfileId) !== undefined) {
addToResponse(event)
return
}
+2 -4
View File
@@ -36,10 +36,8 @@ exports.newProfileStats = function newProfileStats() {
"userProfileHandle": thisObject.profile.userProfileHandle,
"blockchainAccount": thisObject.profile.blockchainAccount,
"ranking": thisObject.profile.ranking,
"multiMediaPostFollowingCount": thisObject.profile.multiMediaPostFollowingCount,
"multiMediaPostFollowersCount": thisObject.profile.multiMediaPostFollowersCount,
"tradePostsFollowingCount": thisObject.profile.tradePostsFollowingCount,
"tradePostsFollowersCount": thisObject.profile.tradePostsFollowersCount,
"followingCount": thisObject.profile.followingCount,
"followersCount": thisObject.profile.followersCount,
"emitterEventsCount": thisObject.profile.emitterEventsCount,
"targetEventsCount": thisObject.profile.targetEventsCount,
"postsCount": thisObject.profile.postsCount,
+1
View File
@@ -2,6 +2,7 @@ exports.newBot = function newBot() {
let thisObject = {
botId: undefined,
botProfileHandle: undefined,
botAsset: undefined,
botExchange: undefined,
enabled: undefined,
+4 -4
View File
@@ -137,19 +137,19 @@ exports.newEvent = function newEvent() {
) {
switch (thisObject.eventType) {
case EVENT_TYPES.FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: {
emitterUserProfile.addMultiMediaPostsFollowing(
emitterUserProfile.addFollowing(
targetUserProfile
)
targetUserProfile.addMultiMediaPostsFollower(
targetUserProfile.addFollower(
emitterUserProfile
)
break
}
case EVENT_TYPES.UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: {
emitterUserProfile.removeMultiMediaPostsFollowing(
emitterUserProfile.removeFollowing(
targetUserProfile
)
targetUserProfile.removeMultiMediaPostsFollower(
targetUserProfile.removeFollower(
emitterUserProfile
)
break
+30 -81
View File
@@ -4,15 +4,11 @@ exports.newUserProfile = function newUserProfile() {
userProfieId: undefined,
userProfileHandle: undefined,
blockchainAccount: undefined,
multiMediaPostsFollowing: undefined,
multiMediaPostsFollowers: undefined,
tradePostsFollowing: undefined,
tradePostsFollowers: undefined,
ranking: undefined,
multiMediaPostFollowingCount: undefined,
multiMediaPostFollowersCount: undefined,
tradePostsFollowingCount: undefined,
tradePostsFollowersCount: undefined,
following: undefined,
followers: undefined,
followingCount: undefined,
followersCount: undefined,
emitterEventsCount: undefined,
targetEventsCount: undefined,
postsCount: undefined,
@@ -21,14 +17,10 @@ exports.newUserProfile = function newUserProfile() {
posts: undefined,
addPost: addPost,
removePost: removePost,
addMultiMediaPostsFollowing: addMultiMediaPostsFollowing,
removeMultiMediaPostsFollowing: removeMultiMediaPostsFollowing,
addTradePostsFollowing: addTradePostsFollowing,
removeTradePostsFollowing: removeTradePostsFollowing,
addMultiMediaPostsFollower: addMultiMediaPostsFollower,
removeMultiMediaPostsFollower: removeMultiMediaPostsFollower,
addTradePostsFollower: addTradePostsFollower,
removeTradePostsFollower: removeTradePostsFollower,
addFollowing: addFollowing,
removeFollowing: removeFollowing,
addFollower: addFollower,
removeFollower: removeFollower,
addBot: addBot,
removeBot: removeBot,
enableBot: enableBot,
@@ -40,11 +32,8 @@ exports.newUserProfile = function newUserProfile() {
return thisObject
function finalize() {
thisObject.multiMediaPostsFollowing = undefined
thisObject.multiMediaPostsFollowers = undefined
thisObject.tradePostsFollowing = undefined
thisObject.tradePostsFollowers = undefined
thisObject.following = undefined
thisObject.followers = undefined
thisObject.posts = undefined
thisObject.bots = undefined
@@ -52,16 +41,12 @@ exports.newUserProfile = function newUserProfile() {
function initialize() {
thisObject.multiMediaPostsFollowing = new Map()
thisObject.multiMediaPostsFollowers = new Map()
thisObject.following = new Map()
thisObject.followers = new Map()
thisObject.tradePostsFollowing = new Map()
thisObject.tradePostsFollowers = new Map()
thisObject.followingCount = 0
thisObject.followersCount = 0
thisObject.multiMediaPostFollowingCount = 0
thisObject.multiMediaPostFollowersCount = 0
thisObject.tradePostsFollowingCount = 0
thisObject.tradePostsFollowersCount = 0
thisObject.emitterEventsCount = 0
thisObject.targetEventsCount = 0
thisObject.postsCount = 0
@@ -116,75 +101,39 @@ exports.newUserProfile = function newUserProfile() {
thisObject.postsCount--
}
function addMultiMediaPostsFollowing(
function addFollowing(
userProfile
) {
if (thisObject.multiMediaPostsFollowing.get(userProfile.id) === undefined) {
thisObject.multiMediaPostsFollowing.set(userProfile.id, userProfile)
thisObject.multiMediaPostFollowingCount++
if (thisObject.following.get(userProfile.id) === undefined) {
thisObject.following.set(userProfile.id, userProfile)
thisObject.followingCount++
}
}
function removeMultiMediaPostsFollowing(
function removeFollowing(
userProfile
) {
if (thisObject.multiMediaPostsFollowing.get(userProfile.id) !== undefined) {
thisObject.multiMediaPostsFollowing.delete(userProfile.id)
thisObject.multiMediaPostFollowingCount--
if (thisObject.following.get(userProfile.id) !== undefined) {
thisObject.following.delete(userProfile.id)
thisObject.followingCount--
}
}
function addTradePostsFollowing(
function addFollower(
userProfile
) {
if (thisObject.tradePostsFollowingCount.get(userProfile.id) === undefined) {
thisObject.tradePostsFollowingCount.set(userProfile.id, userProfile)
thisObject.tradePostsFollowingCount++
if (thisObject.followers.get(userProfile.id) === undefined) {
thisObject.followers.set(userProfile.id, userProfile)
thisObject.followersCount++
}
}
function removeTradePostsFollowing(
function removeFollower(
userProfile
) {
if (thisObject.tradePostsFollowingCount.get(userProfile.id) !== undefined) {
thisObject.tradePostsFollowingCount.delete(userProfile.id)
thisObject.tradePostsFollowingCount--
}
}
function addMultiMediaPostsFollower(
userProfile
) {
if (thisObject.multiMediaPostsFollowers.get(userProfile.id) === undefined) {
thisObject.multiMediaPostsFollowers.set(userProfile.id, userProfile)
thisObject.multiMediaPostFollowersCount++
}
}
function removeMultiMediaPostsFollower(
userProfile
) {
if (thisObject.multiMediaPostsFollowers.get(userProfile.id) !== undefined) {
thisObject.multiMediaPostsFollowers.delete(userProfile.id)
thisObject.multiMediaPostFollowersCount--
}
}
function addTradePostsFollower(
userProfile
) {
if (thisObject.tradePostsFollowers.get(userProfile.id) === undefined) {
thisObject.tradePostsFollowers.set(userProfile.id, userProfile)
thisObject.tradePostsFollowersCount++
}
}
function removeTradePostsFollower(
userProfile
) {
if (thisObject.tradePostsFollowers.get(userProfile.id) !== undefined) {
thisObject.tradePostsFollowers.delete(userProfile.id)
thisObject.tradePostsFollowersCount--
if (thisObject.followers.get(userProfile.id) !== undefined) {
thisObject.followers.delete(userProfile.id)
thisObject.followersCount--
}
}