Skip to content

Conversation

@kmuralidharan91
Copy link
Collaborator

🚀 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 information
    • GET /api/v2/social - Returns array of social media links with icons and URLs
  • Architecture:

    • Follows existing project patterns with GenericResponse<T> wrapper
    • Structured response models (AboutResponse, SocialResponse)
    • Integrated with V2 API routing
  • Web Integration:

    • Updated templates to use API data with hardcoded fallbacks
    • Modified HomeContext to include about and social data
    • Ensures backward compatibility

API Responses

// /api/v2/about
{
  "data": {
    "title": "About",
    "description": ["Founded by Adam Rush...", "..."],
    "foundedYear": "2019",
    "founderName": "Adam Rush",
    "founderTwitter": "https://twitter.com/Adam9Rush"
  }
}

// /api/v2/social  
{
  "data": {
    "socialLinks": [
      {
        "id": "twitter",
        "name": "Twitter", 
        "url": "https://twitter.com/swift_leeds",
        "icon": "bx bxl-twitter",
        "displayName": "@Swift_Leeds",
        "order": 1
      }
      // ... 5 more social links
    ]
  }
}

Testing

  • ✅ APIs return correct JSON structure
  • ✅ Web templates render with API data
  • ✅ Fallbacks work when API unavailable
  • ✅ Ready for mobile app consumption

Ready for production deployment 🎯

@kmuralidharan91 kmuralidharan91 self-assigned this Sep 10, 2025
@kmuralidharan91 kmuralidharan91 added the enhancement New feature or request label Sep 10, 2025
@github-actions github-actions bot temporarily deployed to add-about-social-api September 10, 2025 23:08 Destroyed
Copy link
Collaborator

@Sherlouk Sherlouk left a 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)
Copy link
Collaborator

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.

Comment on lines +97 to +98
let aboutData: AboutResponse? = try await fetchAboutData(req: req)
let socialData: SocialResponse? = try await fetchSocialData(req: req)
Copy link
Collaborator

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.

Comment on lines +7 to +9
let foundedYear: String
let founderName: String
let founderTwitter: String
Copy link
Collaborator

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"):
Copy link
Collaborator

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.

@Sherlouk
Copy link
Collaborator

Feel free to re-open once changes have been made, and rebased on top of latest main.

@Sherlouk Sherlouk closed this Oct 11, 2025
@Sherlouk Sherlouk deleted the add-about-social-api branch October 17, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants