fossasia / pslab-webapp

PSLab Web App https://pslab.io
Apache License 2.0
1.48k stars 42 forks source link

Backend functionality for storing user created scripts #16

Closed jithinbp closed 7 years ago

jithinbp commented 7 years ago

@viveksb007 @asitava1998 @CloudyPadmal In the last PR , I embedded ace.js text editor on a page that allowed users to write their own Python code.

Now the question is how to store these. Should they go into a database along with the Primary key user-email and a unique id for searchability, or Should they be stored as text files in a directory.

Which begs the larger question ... if users are allowed to upload experiment results/screenshots as the app evolves, where is such data typically stored?

viveksb007 commented 7 years ago

We can create an API in backend to store data on database. Then we can send parameters like code, link for screenshot (after uploading it somewhere),etc. Android App, desktop app and remote app all can make an api call to save experiment. In android app user can't write and execute code at runtime yet. As far as storing is concerned we can store code both locally in database and as text file and can make a POST call to store code,etc in remote db.

jithinbp commented 7 years ago

okay. I'm going with the following

asitava1998 commented 7 years ago

@jithinbp I agree with the approach you mentioned. Typically, data which is unlikely to be modified like screenshots should not be stored in databases but in some file system. If the code is being changed quite a few times, it is better to store in the database.