IIT-BHU-InstiApp / lite-hai-backend

https://lite-hai.copsiitbhu.co.in/
13 stars 20 forks source link

Optimizing response json #56

Open numberbee7070 opened 4 years ago

numberbee7070 commented 4 years ago

Eliminate repetitive fields from JSON response.

for example, here club details appear thrice. (path: /workshops/{id}/)

{
  "id": 1,
  "title": "workshop1",
  "description": "first workshop",
  "club": {
    "id": 1,
    "name": "cops",
    "council": {
      "id": 1,
      "name": "SNTC",
      "small_image_url": null,
      "large_image_url": null
    },
    "small_image_url": null,
    "large_image_url": null
  },
  "date": "2020-10-10",
  "time": "11:12:24",
  "location": "lt3",
  "latitude": null,
  "longitude": null,
  "audience": "freshers",
  "resources": [
    {
      "id": 1,
      "name": "source1",
      "link": "http://example.com",
      "resource_type": "Material"
    },
    {
      "id": 2,
      "name": "source2",
      "link": "http://example.com",
      "resource_type": "Prerequisite"
    }
  ],
  "contacts": [],
  "image_url": null,
  "is_interested": null,
  "interested_users": 0,
  "is_workshop_contact": false,
  "is_por_holder": false,
  "tags": [
    {
      "id": 1,
      "tag_name": "dev",
      "club": {
        "id": 1,
        "name": "cops",
        "council": {
          "id": 1,
          "name": "SNTC",
          "small_image_url": null,
          "large_image_url": null
        },
        "small_image_url": null,
        "large_image_url": null
      }
    },
    {
      "id": 2,
      "tag_name": "cp",
      "club": {
        "id": 1,
        "name": "cops",
        "council": {
          "id": 1,
          "name": "SNTC",
          "small_image_url": null,
          "large_image_url": null
        },
        "small_image_url": null,
        "large_image_url": null
      }
    }
  ],
  "link": null
}