Closed kaidatavis closed 5 months ago
There are a few changes I have made:
First, the 'database' is now not part of the historyMap.model and became an independent part. The historyMap looks like this now. I kept the old DBSave
and DBLoad
. These should not be objects, but functions inside sessions
.
const historyMap = {
model: {
nodes: {},
tree: {}, // real data
tabs: {} // the status of the opened tabs in the browser
},
view: {
vis: {},
layout: {},
redraw: {}
},
controller: {
browser: {}
},
database: { // saving and loading the historyMap sessions
user: {},
sessions: {},
// DBSave: {},
// DBLoad: {}
}
};
Also, I created a new file database.js
, which will have all the code related to database, including user login. So far, I only moved part of the code in the historyMapData.js
to there. Some of the code currently in the session.js
should be in there, too.
Wouldn't that be just to rename the functions ?
In database.js
, so far I created a user
object (= historyMap.database.user
). Inside user
, the profile
object stores all the information related to the user and the addUser
function is adapted from the old hisotryMap.API.DBSave.DBaddUser
.
Please follow this pattern and :
user
;session
object and add 'session'-related object and functions there.We can have a discussion if anything is not clear.
Wouldn't that be just to rename the functions ?
Yes, there shouldn't be much change besides renaming. There will be some other small changes, for example if you compare the new historyMap.database.user.addUser
to the old hisotryMap.API.DBSave.DBaddUser
Sure I think should be able to do that with my limited time
Give it a go. Let me know if you want to discuss before our meeting on Wed.
It will be better to get this done before making changes to the load session
code.
@kaimdx just a quick question, what exactly supposed to be in database.js ?
currently session.js includes code that interacts purely with sessions, this means loading session and further.
I would imagine that database.js should have code related to saving to the DB ?
DB Refactoring 1.0
See changes in https://github.com/Vis4Sense/SenseMapExtension/commit/274baf7efed852537f54fb194440bab54237fecf
Status of extension: Working just like the previous version in rebuild-mvc
to do: slightly change Node2DB and Tree2DB
Hi Reday, I found that the code for the historyMap database part does not follow the object-oriented structure defined in historyMap.js (historyMap.nodes is an example). I made an example in the new branch 'rebuild-mvc-db-refactoring': 965a93b8df9a47e218612159553ae9071f95769f. Please follow the pattern to refactor the code.