TetraTsunami / StudySearch

MadHacks 2023 Project
0 stars 0 forks source link

Create REST API endpoints for user settings #1

Open traitboundnotsatisfied opened 10 months ago

traitboundnotsatisfied commented 10 months ago

There are a few endpoints for processing the data when users update they're settings. These are:

traitboundnotsatisfied commented 10 months ago

Should have the following endpoints:

General Settings

POST request to /api/user/update_settings/gen Expects something like:

name=John+Doe&phone=123-456-7890&email=jdoe%40example.com&pss=on&ppl-min=0&ppl-max=10

(pps is prefer same section, ppl is short for people)

This is the standard way HTML encodes form data, so look for that (you shouldn't have to roll your own parser).

Availibility Settings

POST to /api/user/availability:

[
  [],
  [{"start":"10:00","end":"11:00"}],
  [{"start":"10:00","end":"11:00"}],
  [{"start":"10:00","end":"11:00"},{"start":"14:00","end":"18:00"}],
  [{"start":"10:00","end":"11:00"}],
  [],
  []
]

There are seven lists, one for each day of week. The first is Sunday.

Classes from PDF

This is a POST to /api/user/update_settings/classes_from_pdf. It should send you a file as the pdf field. I don't know how to deal with this in spring boot.

Which Settings are Missing

There should be a way to GET /api/user/missing_settings which gives you which settings are missing. I haven't done anything with this yet but will.

traitboundnotsatisfied commented 10 months ago

The missing_settings endpoint should return something like:

["profile", "classes", "availability"]

in the array means its missing, and not there means its not and we chillin boiz

traitboundnotsatisfied commented 10 months ago

Update: @SizableShrimp started this but only general and missing, and still needs to make it handle the case where you don't yet have a user (for missing it needs to say everything is missing, for general/classes/availabikity it needs to make one)

traitboundnotsatisfied commented 10 months ago

second problem reoslved