A user’s project will be stored in the following way:
[folder] Project A
- [folder] metadata
- [file] project.json
- [file] file1.json
- [file] file2.json
...
- [folder] project_git (the git repo)
- [file] text.json (of the format for draft.js)
The metadata folder contains project information.
The project.json contains a list of file names mapped to unique ids. It can possibly also contain any more metadata we may need / think of.
The fileX.json contains a map of version names to their commit hashes for the given file.
The unique ids correspond to branches within the project_git folder, which is the git repo with the user’s projects. Each branch contains the different files that the user works on.
The file in each branch is named text.json (of the format that draft.js needs). This way we don’t need to worry about the user renaming the files, we just change the mapping in project.json.
The file view can pull data from the project.json to display the list of files to the user. With project.json outside the git repo, it ensures simple access regardless of the branch the repo is in.