Open mycwnet opened 4 months ago
I started documenting in the wiki, tons more to do in that regard, I'll try to make those relationships clear in it as I write it.
That will take a while so basically this, working backwards.
Message isn't reliant on a chat, as if no chat between the user and prisoner exists it creates one. Chat is reliant on an existing user and prisoner. Prisoner is reliant on existing prison.
So basically seeding will need to go in this order:
As far as production vs development, I agree all of this should exist on development but not production. For production the best idea I can come up with is to have one default user created by the hook, but make certain that users details are hidden in the .env file.
Another option would be that as soon as the API is created it emails us a link to create an admin account, though we'll need to set up smtp stuff which will probably need to be done anyway so we can handle forgotten passwords, but may be a little while down the timeline.
I don't know what seeds will need to exist for production so this is only concerning pre-production.
Basically I don't know how to use the application right now. I believe that we need users to do a chat? So I think we should probably seed the db with a number of users other than just admin. Especially since we'll have more need for users when we start testing roles and whatnot.
We also though create chats and messages between some users, probably a good amount since we'll be testing deletion and such and don't want to have to restart the app frequently to test.
I can create the seeds the problem is that I don't know what I need to know to create the seeds correctly. This has come up basically everytime I run the app. If I need to test something I will run into a problem of not having the data, and having to create it, but not knowing in a number of cases what data needs to go where. So @paxblueribbon I am adding you to the assignees on this issue so that you can maybe create some documentation for the various fields.
For instance:
If I want to write a message I assume that in the post values for Create Chat the user value is the id, and prisoner likewise. Presently though we have no way to create users other than db seeds I believe and in order to create a prisoner it looks like I also need to create a prison. So yeah, basically to say hello I have to have at least one user, one prison, one prisoner, one chat and one message. And while most of the fields I could intuit I'd rather just have something canonical to reference.
So I guess a simple list of what classes each class is dependent on and what values go in which fields would do.
But since seeds will just use whatever functions we use on the backed throw in any important info if like a function needs to be written or updated presently or in the near future.