add classes
This commit is contained in:
parent
d59f743708
commit
f0defdd918
4 changed files with 31 additions and 12 deletions
|
@ -1,7 +1,6 @@
|
|||
from flask import Flask, request, Response, jsonify
|
||||
from flask import Flask, Response, jsonify, request
|
||||
from flask_cors import CORS
|
||||
|
||||
from .classes import Room
|
||||
from room import Room
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Room:
|
||||
id: int
|
||||
coord: ...
|
||||
name: str
|
||||
pin: int | None
|
18
backend/src/room.py
Normal file
18
backend/src/room.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
from song import Song
|
||||
|
||||
type UserScoredSong = tuple[Song, int]
|
||||
|
||||
|
||||
@dataclass
|
||||
class Room:
|
||||
id: int
|
||||
coord: tuple[float, float]
|
||||
name: str
|
||||
pin: int | None
|
||||
tags: set[str]
|
||||
creative: bool
|
||||
|
||||
playlist: set[UserScoredSong]
|
||||
history: list[Song]
|
11
backend/src/song.py
Normal file
11
backend/src/song.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Song:
|
||||
mbid: str
|
||||
title: str
|
||||
artist: str
|
||||
tags: list[str]
|
||||
image_id: str
|
||||
youtube_id: str
|
Loading…
Add table
Add a link
Reference in a new issue