elonsoc / elonsoc/courseadvysr-api
Create Another Endpoint For Getting Terms
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
On the frontend we hard write the terms in the javascript itself—which isn't a lot of work as it's only updated every new term—isn't a good practice. There should always be a single source of truth.
```tsx
setSelectedTerm(e.currentTarget.value)}
style={{
WebkitAppearance: "none",
border: "none",
MozAppearance: "none",
appearance: "none",
}}
>
Winter 2021
Spring 2021
Summer I 2021
Summer II 2021
Fall 2021
```
From: https://github.com/elonsoc/courseadvysr-web/blob/92ea621d92fdf9680923fe4ed520746b752cd6ed/src/pages/Courses.tsx#L79-L94
In the database, we provide both the term code and title required to make calls for a particular term.
It looks like this:
termcode | title
-- | --
21/01 | Fall 2021
20/01 | Fall 2020
21/02 | Winter 2021
21/04 | Summer I 2021
21/05 | Summer II 2021
21/03 | Spring 2021
To prevent this code smell, an endpoint to query the db for terms is required.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.