Improve suggestions json
This commit is contained in:
parent
7a9d29a2da
commit
6194dfbf34
1 changed files with 2 additions and 3 deletions
|
@ -1,10 +1,9 @@
|
|||
from typing import Any
|
||||
|
||||
import dotenv
|
||||
from flask import Flask, Response, jsonify, request
|
||||
from flask_cors import CORS
|
||||
from flask_socketio import SocketIO, emit
|
||||
import uuid
|
||||
from dataclasses import asdict
|
||||
|
||||
from .state import State
|
||||
from .connect import get_connection
|
||||
|
@ -201,7 +200,7 @@ def get_room_suggestion():
|
|||
if (room := state.rooms.get(int(room_id))) is None:
|
||||
return error("Invalid room id")
|
||||
|
||||
return {"success": True, "songs": room.songs}
|
||||
return {"success": True, "songs": [asdict(song) | {"upvote": score} for song, score in room.songs.values()]}
|
||||
|
||||
|
||||
@app.post("/api/song/voting")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue