source-academy / backend

Backend of Source Academy @ NUS, LMS extension of Source Academy (Elixir, Ecto, Phoenix, PostgreSQL)
https://sourceacademy.nus.edu.sg
Apache License 2.0
39 stars 50 forks source link

Server-side pagination params should use atoms, not string #1174

Closed RichDom2185 closed 2 months ago

RichDom2185 commented 2 months ago

For both filter and sorting params:

image

They should be parsed from the query params at the controller level and passed down to the handler function via arguments

RichDom2185 commented 2 months ago

Can refer to:

https://github.com/source-academy/backend/blob/d867927ac0ce101235da19803dd2cca948946c39/lib/cadet/assessments/assessments.ex#L577-L581

To see how it's done when working with maps.

By right, parsing logic should be separate from the main logic. See https://github.com/source-academy/backend/blob/d867927ac0ce101235da19803dd2cca948946c39/lib/cadet/jobs/xml_parser.ex#L22