Regardless of how they get used, we need to connect the back-end endpoints up to RTK query. Part of this is already done but we're missing a bunch. Having all this done up front will save us time when we have to hook it up to whatever components.
If you're familiar with Rails you can just look at the back-end code in /backend for reference. The API controllers live in /backend/app/controllers. Here are some other docs that might help:
*to be honest I'm not sure what the utility of these guys is, I kind of thought these would be covered by survey_visits
A wrinkle is that we have three instances of createApi for some reason. Per the RTK Query docs:
In most cases, you should use this once per app, with "one API slice per base URL" as a rule of thumb.
so we should probably consolidate src/api/apiSlice.js, src/redux/adminViewApiSlice.js, and src/redux/apiSlice.js into a single file.
Additionally, you're going to have to add new "tables" to the jsonserver config in frontend/front/src/dummyData/jsonServerData. Each rails controller needs an equivalent .js file here that is referenced in db.js. /backend/db/schema.rb defines the shape of the data as it is in the database. For now don't worry about getting fancy with json-server, just focus on the CRUD endpoints.
Regardless of how they get used, we need to connect the back-end endpoints up to RTK query. Part of this is already done but we're missing a bunch. Having all this done up front will save us time when we have to hook it up to whatever components.
If you're familiar with Rails you can just look at the back-end code in
/backend
for reference. The API controllers live in/backend/app/controllers
. Here are some other docs that might help:For endpoints we currently have:
homes
user
(should actually besurveyors
)surveys
homesurvey
(should besurvey_visits
)and we need:
assignments
property_assessments
survey_answers
*survey_responses
**to be honest I'm not sure what the utility of these guys is, I kind of thought these would be covered by survey_visits
A wrinkle is that we have three instances of
createApi
for some reason. Per the RTK Query docs:so we should probably consolidate
src/api/apiSlice.js
,src/redux/adminViewApiSlice.js
, andsrc/redux/apiSlice.js
into a single file.Additionally, you're going to have to add new "tables" to the
jsonserver
config infrontend/front/src/dummyData/jsonServerData
. Each rails controller needs an equivalent.js
file here that is referenced indb.js
./backend/db/schema.rb
defines the shape of the data as it is in the database. For now don't worry about getting fancy with json-server, just focus on the CRUD endpoints.