Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local storage for conversations #9

Open
abhipaiangle opened this issue Oct 11, 2020 · 11 comments
Open

Local storage for conversations #9

abhipaiangle opened this issue Oct 11, 2020 · 11 comments

Comments

@abhipaiangle
Copy link
Contributor

Description

Present version stores the conversations in the python application which gets deleted when the application is refreshed.

Proposed Solution

Local storage has to be used and conversations are to be stored in browser cookies so that they are preserved for the particular user involved in the conversation.

Alternatives Considered

In case the mentioned solution is not possible, the alternative can be storage of conversations in PostgreSQL database with a specific limit to account for database expense.

@sauntheninja2
Copy link

I would like to work in this and long term woudn't it be more beneficial to store the conversations in a database as opposed cookies

@abhipaiangle
Copy link
Contributor Author

That was actually an alternative since it would need extra database storage. I think we can go for it. Since there is a number of messages limit to every conversation, it won't be a problem. Only hoping that PostgreSQL database would be sufficient for this.

@sauntheninja2
Copy link

So how should the data be stored? The name the message and the message id right?

@abhipaiangle
Copy link
Contributor Author

Display name, channel name, message, time would be sufficient I guess.

@sauntheninja2
Copy link

The best way to do it would be do convert the dictionary into objects and then store them in the database right?

@abhipaiangle
Copy link
Contributor Author

@sauntheninja2 Yeah. For PostgreSQL databasing, check this code . Follow the raw DB commands like the ones used in the code since the database will be similar. If you want to do it with psql ORM, let me know.

@sauntheninja2
Copy link

psql ORM I feel will scale better and be easier to read

@abhipaiangle
Copy link
Contributor Author

Ok. Proceed then. Make a different .py file for the objects

@abhipaiangle
Copy link
Contributor Author

@sauntheninja2 Hey I have added Postgres Database to the app. You can access the database using os.getenv('DATABASE_URL') . On local system you have to set Environment variable DATABASE_URL to

postgres://hbadpcocmlhrpv:0479faf1070d0a31a66f179aaab53aec23bf9a4aa3e5c7e09e52126cc5847d32@ec2-54-146-142-58.compute-1.amazonaws.com:5432/d47ndu81md817c

@sauntheninja2
Copy link

Yes i wondering whether i have to create the database or not thanks

@abhipaiangle
Copy link
Contributor Author

Last 5 days remaining for hacktoberfest to end although there is no deadline for you to send in PRs. Make your contribution ASAP if the issue is fixed @sauntheninja2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants