WYHNUS / ExchangeBuddy

Find your exchange buddies!
5 stars 0 forks source link

Endpoint: wikiCustomizedRecommend should return type of item #135

Open irvinlim opened 7 years ago

irvinlim commented 7 years ago

That is, for each wiki return if it is a country or university, and the information with it. This is for #123 (SVG country icons), so that I can differentiate between university and country, and retrieve the alpha2Code from it.

What you can do is to return as follows (suggestion only, follow the actual column names in the db is fine):

{
  "countries": [
    {
      "id": 1,
      "wikiId": 123,
      "name": "Singapore",
      "alpha2Code": "SG"
    },
    ...
  ],
  "universities": [
    {
      "id": 1,
      "wikiId": 124,
      "name": "National University of Singapore (NUS)",
      "imageUrl": "SOME_S3_URL",
    },
    ...
  ]
}

Additionally, it might not be a good idea to return allWikis in the query, but instead have a search endpoint or something, using the search box.

WYHNUS commented 7 years ago

I will update the JSON format during the weekend. :)

I understand the performance issue for returning allWikis, but it is convenient for front-end search... Maybe you can show me the updated design for the new search then I can update the end-point accordingly?

irvinlim commented 7 years ago

The frontend search hasn't been updated, I just depend on your available endpoints. You can implement accordingly, but I guess it should be fulltext search? (or LIKE 'searchTerm%' query).