Ready for first debug
This commit is contained in:
1 parent
62726d8faa
commit
a52e9aa0a9
11 files changed
+59
-17
No files matched your search
@@ -17,6 +17,40 @@ exports.newBootstrap = function newBootstrap() {
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
'Governance',
|
||||
'User-Profiles'
|
||||
)
|
||||
for (let i = 0; i < pluginFileNames.length; i++) {
|
||||
let pluginFileName = pluginFileNames[i]
|
||||
|
||||
let pluginFileContent = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
'Governance',
|
||||
'User-Profiles',
|
||||
pluginFileName
|
||||
)
|
||||
|
||||
let userProfilePlugin = JSON.parse(pluginFileContent)
|
||||
let config = JSON.parse(userProfilePlugin.config)
|
||||
let signatureObject = JSON.parse(config.signature)
|
||||
let web3 = new NT.nodeModules.web3()
|
||||
let bloackchainAddress = web3.eth.accounts.recover(signatureObject)
|
||||
let ranking = 0 // TODO: read the blockchain balance and transactions from the Treasury Account to calculate the profile ranking.
|
||||
let userProfileId = userProfilePlugin.id
|
||||
let userHandle = config.signature.message
|
||||
|
||||
let userProfile = NT.modules.socialGraphUserProfile.newNetworkModulesSocialGraphUserProfile()
|
||||
userProfile.initialize(
|
||||
userProfileId,
|
||||
userHandle,
|
||||
bloackchainAddress,
|
||||
ranking
|
||||
)
|
||||
|
||||
NT.globals.memory.maps.USER_PROFILES_BY_ID.set(userProfileId, userProfile)
|
||||
NT.globals.memory.maps.USER_PROFILES_BY_HANDLE.set(userHandle, userProfile)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ exports.newNetworkModulesEvent = function newNetworkModulesEvent() {
|
||||
if (emitterUserProfileId === undefined) {
|
||||
throw ('Emitter User Profile Id Not Provided.')
|
||||
}
|
||||
emitterUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId)
|
||||
emitterUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId)
|
||||
if (emitterUserProfile === undefined) {
|
||||
throw ('Emitter User Profile Not Found.')
|
||||
}
|
||||
@@ -112,7 +112,7 @@ exports.newNetworkModulesEvent = function newNetworkModulesEvent() {
|
||||
Validate Target User Profile.
|
||||
*/
|
||||
if (thisObject.targetUserProfileId !== undefined) {
|
||||
targetUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
targetUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
if (targetUserProfile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ exports.newNetworkModulesQueriesBotProfileStats = function newNetworkModulesQuer
|
||||
*/
|
||||
let userProfile
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
userProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
userProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
} else {
|
||||
userProfile = NT.globals.memory.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
userProfile = NT.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
}
|
||||
|
||||
if (userProfile === undefined) {
|
||||
|
||||
@@ -59,8 +59,8 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents
|
||||
|
||||
Any of the above happening, means that indeed it is related.
|
||||
*/
|
||||
let emitterUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
|
||||
let targetUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
|
||||
let emitterUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
|
||||
let targetUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
|
||||
let emitterBotProfile = emitterUserProfile.bots.get(eventReceived.emitterBotProfileId)
|
||||
let targetBotProfile = targetUserProfile.bots.get(eventReceived.targetBotProfileId)
|
||||
let emitterPost = emitterUserProfile.posts.get(eventReceived.emitterPostHash)
|
||||
|
||||
@@ -18,9 +18,9 @@ exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQue
|
||||
Validate User Profile
|
||||
*/
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
thisObject.profile = NT.globals.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
thisObject.profile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
} else {
|
||||
thisObject.profile = NT.globals.memory.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
thisObject.profile = NT.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
}
|
||||
|
||||
if (thisObject.profile === undefined) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newBotProfile = function newBotProfile() {
|
||||
exports.newNetworkModulesSocialGraphBotProfile = function newNetworkModulesSocialGraphBotProfile() {
|
||||
/*
|
||||
Users can have a Profile that can:
|
||||
* follow other bots profiles.
|
||||
@@ -80,7 +80,7 @@ exports.newBotProfile = function newBotProfile() {
|
||||
if (thisObject.posts.get(emitterPostHash) !== undefined) {
|
||||
throw ('Post Already Exists.')
|
||||
} else {
|
||||
let post = NT.modules.POST.newPost()
|
||||
let post = NT.modules.socialGraphPost.newNetworkModulesSocialGraphPost()
|
||||
post.initialize(
|
||||
emitterUserProfileId,
|
||||
targetUserProfileId,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newPost = function newPost() {
|
||||
exports.newNetworkModulesSocialGraphPost = function newNetworkModulesSocialGraphPost() {
|
||||
/*
|
||||
Posts represent a collection of multimedia content sotored somewhere else
|
||||
and identified by that content hash. Posts might belong to:
|
||||
@@ -97,7 +97,7 @@ exports.newPost = function newPost() {
|
||||
/*
|
||||
Validate Target User Profile.
|
||||
*/
|
||||
let targetUserProfile = NT.globals.memory.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
let targetUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
if (targetUserProfile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exports.newUserProfile = function newUserProfile() {
|
||||
exports.newNetworkModulesSocialGraphUserProfile = function newNetworkModulesSocialGraphUserProfile() {
|
||||
/*
|
||||
Users can have a Profile that can:
|
||||
* follow other user profiles.
|
||||
@@ -84,7 +84,7 @@ exports.newUserProfile = function newUserProfile() {
|
||||
if (thisObject.posts.get(emitterPostHash) !== undefined) {
|
||||
throw ('Post Already Exists.')
|
||||
} else {
|
||||
let post = NT.modules.POST.newPost()
|
||||
let post = NT.modules.socialGraphPost.newNetworkModulesSocialGraphPost()
|
||||
post.initialize(
|
||||
emitterUserProfileId,
|
||||
targetUserProfileId,
|
||||
|
||||
@@ -15,7 +15,7 @@ exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQuer
|
||||
Validate User Profile
|
||||
*/
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
thisObject.profile = NT.globals.memory.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
thisObject.profile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
}
|
||||
|
||||
if (thisObject.profile === undefined) {
|
||||
|
||||
Reference in new issue
Block a user