-
-
Notifications
You must be signed in to change notification settings - Fork 5
Adds About and Social API #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sherlouk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove all the duplication caused by the optionality, as it's adding a tonne of complexity.
| let aboutResponse = try await aboutController.onGet(request: aboutRequest) | ||
|
|
||
| guard let data = aboutResponse.body.data else { return nil } | ||
| let genericResponse = try JSONDecoder().decode(GenericResponse<AboutResponse>.self, from: data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave the teams API #159 a free pass because it wasn't decoding JSON, but we absolutely should not be calling our own internal APIs through the service and then parsing JSON responses - it's extremely wasteful on bandwidth, memory, and compute cycles.
I'd recommend pulling the data out into a more accessible location first, and accessing it from the API and HomeRouteController.
| let aboutData: AboutResponse? = try await fetchAboutData(req: req) | ||
| let socialData: SocialResponse? = try await fetchSocialData(req: req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're adding a lot of complexity to the views to handle the fact these are optional. Let's make them required, which will be easier when we address the other PR comment, and then simplify the UI to always use it.
| let foundedYear: String | ||
| let founderName: String | ||
| let founderTwitter: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of extracting these values? How can we leverage the new team API to prevent duplicating data?
| <div class="d-flex pt-2 pt-sm-3 pt-md-4"> | ||
| #if(social): | ||
| #for(link in social.socialLinks): | ||
| #if(link.id != "spotify"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed, we can add Spotify. There was no reason for it to be header only aside from I missed it.
|
Feel free to re-open once changes have been made, and rebased on top of latest |
🚀 Add V2 APIs for About and Social Links
Summary
Adds new V2 API endpoints to serve About section and Social media links data, enabling mobile app consumption and maintaining consistency between web and mobile platforms.
Changes
New APIs:
GET /api/v2/about- Returns structured about informationGET /api/v2/social- Returns array of social media links with icons and URLsArchitecture:
GenericResponse<T>wrapperAboutResponse,SocialResponse)Web Integration:
HomeContextto include about and social dataAPI Responses
Testing
Ready for production deployment 🎯