mayankpunetha007 / nodejstry Goto Github PK
View Code? Open in Web Editor NEWNode js based notes application
Node js based notes application
If we plan on only implementing undo feature and no redo function in the future the following will be a good solution
There are 2 possibilities here.
If we choose to make it version 7 does the undo function require the user to go to version 6 or version 5?
So from the user perspective the best way possible is to have him write it as version 7 since it is actually version 7 , so what if it's derived from version 5 it is the 7th version of the note.
But when he undo's it from 7 he should move to 5 or 6?
A perfect undo will be to move to 5 and not 6
So one solution would be to maintain a table to store all versions of the user's note and also keep track of user history for operations. In this way of implementing most of the work will be done by the querying the DB.
What I mean by keeping track of user history is to store that the user movements like 1->2->3->4->5->6->5->7->5 etc.
This will make it very easy to implement undo feature.
d) In order to make that happen we introduce a concept of an event, each user operation on a note (save update) is an event with a unique event id. So instead of storing the note order we need a way to get event order for a user note. and each event is associated with a versioned note.
The database will be migrated by adding a single entry to the event table with their current version and in there Versioned task table there will be a single entry for the current version pulled from the tasks(notes) table.
If we have no plans on a redo function all events after the event in main task table are useless. We can have a corn job to delete these entries
Create note(e1) {x : abcd} e1 -> null (parent)
update note(e2) {x: abcde} e1->null, e2->e1
update note( e3) {x: ref} e1 ->null, e2->e1, e3->e2
undo move to e2(e2) {x: abcde} e2->e1, e3->e2
update e2 (e4) {x:asdasd) e4->e2
Clearly, you can see how this functionality can only handle undo operations
The ordered list will store the user operation flow.
Add details to versioned task
Then again add the entry to the task in the order list.
Update entry in order list put the new version on
the order List after programmatically finding the correct location.
Programmatically find location in order list return the previous entry, if exists
Update tasks versionedTaskId
Programmatically find location in order list return the next entry, if exists
Update tasks versionedTaskId
delete all related data from the 2 tables
The idea is to provide the user with a drag and drop functionality where he can arrange is notes as he likes. And his note arrangement will persist in the database and he sees the UI like it was when he last logged in.
This will let user store the position of every note in the DB
For old users the position will be null and current view will be displayed. But they will have the ability to drag and drop their notes. And the new positions will be updated as they use the feature
For the WebSocket technique, there won't be any issues Since all they will see is a more lively UX if they are using from multiple devices.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.