[API][WIP] Expected JSON Spec for `Hangouts` Endpoint
PARENT TRACKER ISSUE: https://github.com/codebuddies/backend/issues/160
This is a placeholder for the JSON Spec for the Hangouts api endpoint. Opening this as a separate issue from fixtures, as we need to discuss the fields, data types, relations, and formats needed to implement a model for the DB. Roughed out/proposed fields and POST format will go below:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
WIP/Proposed JSON for Proposed_Hangouts/Confirmed_Hangouts Endpoint
Context:
This is me trying to think through what we need. This is the returned JSON from the serializer, and would reflect both the hangouts_hangout table, as well as associated many-to-many and one-to-many relationships with:
-
tagging_taggeditem -
resources_resource -
hangouts_hangout_responses -
hangouts_hangout_resources -
hangouts_hangout_response -
users_user, etc.
The models themselves are a little bit of a different story, and won't have a 1-to-1 relationship with this. One big thing is the sheer size of this -- and it could be even longer, depending on how many RSVPS, notes, etc. get attached.
So we might want to consider breaking the hangout query it into several requests (like only listing resource, note, and user ID #s and then fetching related info in parallel or as needed -- or fetching different statuses at different points).
@lpatmo -- thoughts??
{
"guid": "efaeddd4-f09f-11ea-95ca-0242ac1c0005",
"status": "scheduled",
"hangout_type": "STUDY",
"open_to_rsvp": true,
"pending_rsvps": [
{
"id": 125,
"username": "Fred_Train",
"first_name": "Fred",
"last_name": "Train",
"is_superuser": false
},
{
"id": 6,
"username": "LindaLou",
"first_name": "Linda Lou",
"last_name": "Wickerson",
"is_superuser": false
},
{
"id": 57,
"username": "OnyRa",
"first_name": "Ony",
"last_name": "Randriamiandrisoa",
"is_superuser": false
}
],
"confirmed_rsvps":[
{
"id": 15,
"username": "suuuuze",
"first_name": "Susan",
"last_name": "Zazz",
"is_superuser": false
},
{
"id": 36,
"username": "richardR",
"first_name": "Richard",
"last_name": "Rickelson",
"is_superuser": false
},
{
"id": 57,
"username": "KarenY",
"first_name": "Karen",
"last_name": "Yi",
"is_superuser": false
}
],
"related_responses": [
{
"id": "",
"user_id": "",
"message": ""
},
{
"id": "",
"user_id": "",
"message": ""
},
{
"id": "",
"user_id": "",
"message": ""
}
],
"title": "The Art of Postgresql Study Group",
"slug": "the-art-of-postgresql-study-group",
"short_description": "Cat ipsum dolor sit amet, scamper for pretend you want to go out but then don't. The cat was chasing the mouse bury the poop bury it deep be a nyan cat, feel great about it, be annoying 24/7 poop rainbows in litter box all day. Where is my slave? I'm getting hungry use lap as chair, and leave hair",
"long_description": "Cat ipsum dolor sit amet, scamper for pretend you want to go out but then don't. The cat was chasing the mouse bury the poop bury it deep be a nyan cat, feel great about it, be annoying 24/7 poop rainbows in litter box all day. Where is my slave? I'm getting hungry use lap as chair, and leave hair on owner's clothes intently sniff hand. What the heck just happened, something feels fishy. Cat sit like bread cat is love, cat is life chase ball of string but see owner, run in terror or slap the dog because cats rule is good you understand your place in my world. Cats go for world domination.",
"user": {
"id": 16,
"username": "douggie",
"first_name": "Doug",
"last_name": "Swarthmore",
"is_superuser": false
},
"start_time": "2019-01-23T00:31:06-08:00",
"end_time": "2019-01-23T02:31:06-08:00",
"recurring": true,
"related_sessions": [
{
"id": 13,
"start_time": "2019-02-23T00:31:06-08:00",
"end_time": "2019-02-23T02:31:06-08:00",
"status": "completed",
"pending_rsvps": [],
"confirmed_rsvps": [],
"related_notes": [],
"related_resources": []
},
{
"id": 23,
"start_time": "2019-02-23T00:31:06-08:00",
"end_time": "2019-02-23T02:31:06-08:00",
"status": "hold",
"pending_rsvps": [],
"confirmed_rsvps": [],
"related_notes": [],
"related_resources": []
},
{
"id": 43,
"start_time": "2019-02-23T00:31:06-08:00",
"end_time": "2019-02-23T02:31:06-08:00",
"status": "rescheduled",
"pending_rsvps": [],
"confirmed_rsvps": [],
"related_notes": [],
"related_resources": [],
},
],
"related_resources": [
{
"guid": "2a57313e-f0a0-11ea-ace8-0242ac1c0005",
"author": "Markus Winand",
"title": "modernSQL",
"description": "modernSQL: Because a LOT as changed since SQL-92",
"url": "https://modern-sql.com/",
"referring_url": "https://use-the-index-luke.com/",
"other_referring_source": "Markus Winand",
"user": {
"id": 1,
"username": "bethanyg",
"first_name": "",
"last_name": "",
"is_superuser": true
},
"date_published": "2018-01-23T00:31:06-08:00",
"created": "2020-09-06T17:22:08.401553-07:00",
"modified": "2020-01-08T00:31:06-08:00",
"media_type": "Website",
"paid": false,
"tags": [
{
"guid": "a35b7c8c-f0a2-11ea-ace8-0242ac1c0005",
"slug": "databases",
"name": "databases"
},
{
"guid": "a35c7574-f0a2-11ea-ace8-0242ac1c0005",
"slug": "sql",
"name": "SQL"
},
{
"guid": "d52f92ca-f0a2-11ea-9b8a-0242ac1c0005",
"slug": "queries",
"name": "queries"
},
{
"guid": "022a87b2-f0a3-11ea-8ceb-0242ac1c0005",
"slug": "indexes",
"name": "indexes"
},
{
"guid": "022af094-f0a3-11ea-8ceb-0242ac1c0005",
"slug": "back-end",
"name": "back end"
}
]
},
{
"guid": "a9c906ea-f0a0-11ea-95ca-0242ac1c0005",
"author": "Kendra Little",
"title": "Dear SQL DBA",
"description": "Kendra Little answers burning questions from SQL Server Database Administrators -- from dealing with SAN Administrators to handling index rebuilds, she helps DBAs improve their jobs.",
"url": "https://player.fm/series/dear-sql-dba",
"referring_url": "",
"other_referring_source": "Stacia Chipchase ([email protected])",
"user": {
"id": 1,
"username": "bethanyg",
"first_name": "",
"last_name": "",
"is_superuser": true
},
"date_published": "2019-09-18T21:56:09-07:00",
"created": "2020-09-06T17:25:42.218348-07:00",
"modified": "2019-09-18T21:56:09-07:00",
"media_type": "Blog",
"paid": false,
"tags": [
{
"guid": "a35a76a2-f0a2-11ea-ace8-0242ac1c0005",
"slug": "dba",
"name": "dba"
},
{
"guid": "a35aed44-f0a2-11ea-ace8-0242ac1c0005",
"slug": "q-and-a",
"name": "Q and A"
},
{
"guid": "a35b7c8c-f0a2-11ea-ace8-0242ac1c0005",
"slug": "databases",
"name": "databases"
},
{
"guid": "a35bf090-f0a2-11ea-ace8-0242ac1c0005",
"slug": "database-administration",
"name": "database administration"
},
{
"guid": "a35c7574-f0a2-11ea-ace8-0242ac1c0005",
"slug": "sql",
"name": "SQL"
}
]
},
{
"guid": "d62b9068-f4b0-11ea-9576-0242ac1c0005",
"author": "Markus Winand",
"title": "modernSQL THIS IS A DUPE",
"description": "modernSQL: Because a LOT as changed since SQL-92",
"url": "https://modern-sql.com/",
"referring_url": "https://use-the-index-luke.com/",
"other_referring_source": "Markus Winand",
"user": {
"id": 1,
"username": "bethanyg",
"first_name": "",
"last_name": "",
"is_superuser": true
},
"date_published": "2018-01-23T00:31:06-08:00",
"created": "2020-09-11T21:31:33.282499-07:00",
"modified": "2020-01-08T00:31:06-08:00",
"media_type": "Website",
"paid": false,
"tags": []
},
{
"guid": "a9c906ea-f0a0-11ea-95ca-0242ac1c0005",
"author": "Kendra Little",
"title": "Dear SQL DBA",
"description": "Kendra Little answers burning questions from SQL Server Database Administrators -- from dealing with SAN Administrators to handling index rebuilds, she helps DBAs improve their jobs.",
"url": "https://player.fm/series/dear-sql-dba",
"referring_url": "",
"other_referring_source": "Stacia Chipchase ([email protected])",
"user": {
"id": 69,
"username": "zoe_bird",
"first_name": "",
"last_name": "",
"is_superuser": false
},
"date_published": "2019-09-18T21:56:09-07:00",
"created": "2020-09-06T17:25:42.218348-07:00",
"modified": "2019-09-18T21:56:09-07:00",
"media_type": "Blog",
"paid": false,
"tags": [
{
"guid": "a35a76a2-f0a2-11ea-ace8-0242ac1c0005",
"slug": "dba",
"name": "dba"
},
{
"guid": "a35aed44-f0a2-11ea-ace8-0242ac1c0005",
"slug": "q-and-a",
"name": "Q and A"
},
{
"guid": "a35b7c8c-f0a2-11ea-ace8-0242ac1c0005",
"slug": "databases",
"name": "databases"
},
{
"guid": "a35bf090-f0a2-11ea-ace8-0242ac1c0005",
"slug": "database-administration",
"name": "database administration"
},
{
"guid": "a35c7574-f0a2-11ea-ace8-0242ac1c0005",
"slug": "sql",
"name": "SQL"
}
]
}
],
"related_notes": [
{
"id": 4,
"user_id": 15,
"type": "TIL",
"public": true,
"hangout_session_id": 13,
"content": "Going to catch the red dot today going to catch the red dot today chase mice attack feet stare at imaginary bug gnaw the corn cob. "
},
{
"id": 10,
"user_id": 15,
"type": "note",
"public": false,
"hangout_session_id": 13,
"content": "Going to catch the red dot today going to catch the red dot today chase mice attack feet stare at imaginary bug gnaw the corn cob. "
},
{
"id": 11,
"user_id": 36,
"type": "note",
"public": true,
"hangout_session_id": 13,
"content": "Furrier and even more furrier hairball leave hair on owner's clothes and taco cat backwards spells taco cat scoot butt on the rug murder hooman toes or get scared by sudden appearance of cucumber gnaw the corn cob. "
}
],
"internal_platform": false,
"external_platform_link": "https://zoom.us/j/5551112222",
"tags": [
{
"guid": "831b8188-f0a2-11ea-9b8a-0242ac1c0005",
"slug": "postgres",
"name": "postgres"
},
{
"guid": "831c2afc-f0a2-11ea-9b8a-0242ac1c0005",
"slug": "docker",
"name": "docker"
},
{
"guid": "a35b7c8c-f0a2-11ea-ace8-0242ac1c0005",
"slug": "databases",
"name": "databases"
},
{
"guid": "ce37ae08-f0a2-11ea-95ca-0242ac1c0005",
"slug": "backend",
"name": "backend"
},
{
"guid": "3a1de844-f0a3-11ea-ace8-0242ac1c0005",
"slug": "dev-ops",
"name": "dev ops"
},
{
"guid": "3a1ee46a-f0a3-11ea-ace8-0242ac1c0005",
"slug": "데이터-베이스",
"name": "데이터 베이스"
}
],
"created": "2020-09-23T20:38:59.016848-07:00",
"modified": "2020-09-23T20:38:59.016578-07:00"
}
oof the more I look at this, the more I think we need associated views:
- Confirmed Hangouts - with only minimal info
- Unconfirmed Hangouts - with only minimal info
- Hangouts w/pending and confirmed RSVPs
- Unconfirmed Hangouts with responses
- Hangout details -- one Hangout with all associated info
Pretty sure I am leaving stuff out. What am I leaving out??
😅 Very tough to do this without having designs to look at!! Thanks for starting the conversation. I agree it's a good idea to break this down into views!
Here are the endpoints I'm thinking right now would be good to have, assuming we can continue to pass in params:
GET /hangouts?status=pending
This is essentially a list of all the "proposed" hangouts that'll be visible on codebuddies.org/connect
Fields needed in the response:
- guid, created, status, hangout_type, title, slug, short_description, user, open_to_RSVP, tags
- Note: I think we might also want to return a count of related_responses here, so people can see at a glance how many reactions this hangout proposal got
- Note: I think we might also want to return a count of express_interest reactions here as another number we can display to the user
GET /hangouts?status=scheduled,rescheduled <-- (is this doable to pass in two different statuses separated by a comma? need to research further.)
A list of the upcoming (or in progress - the FE will take care of the UI display) hangouts. Btw, not sure we absolutely need to support the difference between scheduled and rescheduled... happy to hear arguments for having the distinction
Fields expected in the response:
- guid,
- created,
- status,
- hangout_type,
- title
- slug,
- short_description,
- user,
- open_to_RSVP,
- tags,
- count of related_responses,
- count of express_interest,
- start_time
- end_time
GET /hangouts?user=XXXX
We'll need this param to display all the hangouts on a user's profile page.
GET /hangouts?user=XXXX&status=completed
Maybe we can support this to distinguish between all the different types of a single user's hangouts
On a hangout detail page, we make two calls, the second based on the HangoutResponses model:
class HangoutResponses:(models.Model):
hangout_id = models.ForeignKey(Hangout, on_delete=models.CASCADE, blank=True,
null=True, related_name='related_responses')
hangout_session_id = models.ForeignKey(HangoutSessions, on_delete=models.CASCADE,
blank=True, null=True, related_name='related_session_responses')
user_id = user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET(get_sentinel_user))
express_interest = models.BooleanField(blank=False, null=False, default=False)
request_to_join = models.BooleanField(blank=False, null=False, default=False)
rsvp = models.BooleanField(blank=False, null=False, default=False)
response_comment = models.TextField(max_length=300, blank=True, null=True)
status = models.TextField(max_length=10, blank=False, null=False)
GET /hangouts/{hangout_id}
Fields expected in the response:
- guid
- created
- status,
- hangout_type,
- title, slug,
- short_description,
- long_description,
- user,
- open_to_RSVP,
- tags
GET /hangouts/{hangout_id}/responses
Fields expected in the response (from the HangoutResponse table)
- user_id
- response_comment
- rsvp
- express_interest
- request_to_join
... we'll have to make sure users can't update their own RSVP (maybe??) but can only update their request_to_join status
Anyway, this isn't complete at all (still have to write out the full responses), but please let me know what you think! I also want to get buy-in from the FE contributors too, once we have a better idea of the design (and hopefully we're all still mostly on the same page there).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Keeping open, since work is ongoing.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still open.