dance-engine / dance-engine/the-engine

Standardise response structure to remove nested items

Open
#39 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

In the response model of things like Events with many related objects, instead of nesting them like current the response will have different top level objects which are lists of that type of related thing.

For example a event has three related entities: Location, Items, Bundles.

Currently the `EventResponse` model returns like this:

```json
{
"event": {
"status": "draft",
"ksuid": "2vOyCJojl8ozmjx11c1tqwViE5O",
"banner": "https://d232d73chhwq10.cloudfront.net/demo/event/2vOyCJojl8ozmjx11c1tqwViE5O/banner/2914f9ef-5628-46c5-8ae9-6550371ab606.jpg",
"name": "This is my first event",
"starts_at": "2025-04-30T12:34:00",
"ends_at": "2025-04-30T23:45:00",
"category": ["congress"],
"capacity": 120,
"number_sold": 0,
"description": "{string-of-json}",
"created_at": "2025-04-10T08:57:13.595000Z",
"updated_at": "2025-04-10T09:25:06.873000Z",
"version": 8,
"location": {
"ksuid": "2vOzWJBneaaJ6lFokEL18pZGMgF",
"name": "Liverpool Arts Bar",
"address": "22 Hope Street, Hope Street Quarter, Liverpool, Merseyside, L1 9BY",
# "lat": 53.40262,
"lng": -2.96981
},
"items": [...],
"bundles": [...]
}
}
```

the idea is to replace it to return like this:

```json
{
"event": {
"status": "draft",
"ksuid": "2vOyCJojl8ozmjx11c1tqwViE5O",
"banner": "https://d232d73chhwq10.cloudfront.net/demo/event/2vOyCJojl8ozmjx11c1tqwViE5O/banner/2914f9ef-5628-46c5-8ae9-6550371ab606.jpg",
"name": "This is my first event",
"starts_at": "2025-04-30T12:34:00",
"ends_at": "2025-04-30T23:45:00",
"category": ["congress"],
"capacity": 120,
"number_sold": 0,
"description": "{string-of-json}",
"created_at": "2025-04-10T08:57:13.595000Z",
"updated_at": "2025-04-10T09:25:06.873000Z",
"version": 8
},
"locations": [...],
"items": [...],
"bundles": [...]
}
```

**this needs to be implemented across all responses and front end updates at the same time**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.