weiter arbeiten an game und Dockerfile erstellt

This commit is contained in:
fingadumbledore 2023-10-28 16:37:50 +02:00
parent 33cbbab44f
commit b02ec01d4c
6 changed files with 80 additions and 2 deletions

2
Dockerfile Normal file
View File

@ -0,0 +1,2 @@
FROM python:3.11

14
party/game.py Normal file
View File

@ -0,0 +1,14 @@
from pymongo import MongoClient
class game:
status = None
CONNECTION_STRING = None
client = None
collection = None
initialized = False
@classmethod
def init(self, flaschenAnzahl: tuple[int, int] = None):
self.CONNECTION_STRING = "mongodb://localhost:27017/"
self.client = MongoClient(self.CONNECTION_STRING)['partyyy']
self.collection = self.client['game']

View File

@ -74,6 +74,44 @@ def api_chat():
response.status_code = 200
return response
@app.route('/api/game/', methods=['GET'])
def api_game():
response = jsonify(success=True)
response.status_code = 200
return response
@app.route('/api/game/point', methods=['GET','POST'])
def api_game_point():
if app.method == 'POST':
time = 3
return time
@app.route('/api/game/time', methods=['GET', 'POST'])
def api_game_time():
if app.method == 'POST':
point = 3
return point
@app.route('/api/team/', methods=['GET'])
def api_team():
response = jsonify(success=True)
response.status_code = 200
return response
@app.route('/api/team/create', methods=['POST'])
def api_team_create():
team_name = request.form['name']
@app.route('/api/team/join', methods=['POST'])
def api_team_join():
team_name = request.form['tname']
user_name = request.form['uname']
@app.route('/api/team/delete', methods=['POST'])
def api_team_delete():
team_name = request.form['name']
@socketio.on('chat-message')
def handle_chat_message(data):
print(data)

15
party/team.py Normal file
View File

@ -0,0 +1,15 @@
from pymongo import MongoClient
class team:
status = None
CONNECTION_STRING = None
client = None
collection = None
initialized = False
@classmethod
def init(self, flaschenAnzahl: tuple[int, int] = None):
self.CONNECTION_STRING = "mongodb://localhost:27017/"
self.client = MongoClient(self.CONNECTION_STRING)['partyyy']
self.collection = self.client['team']

View File

@ -52,7 +52,10 @@
<h1>Home</h1>
<p>
Willkommen zur diesjährigen 24-stündigen LAN-Party! Wir haben ein spannendes Line-up mit Spiel 1, Spiel 2 und Spiel 3 vorbereitet. Lasst uns gemeinsam unvergessliche Gaming-Momente schaffen! Möge die Party beginnen, und möge die Beste Person gewinnen!</p>
</div>
<p>Aktuelles Spiel: </p>
<p>Verfügbare Mate: </p>
<p>Uptime: </p>
</div>
<!-- Planer -->
<div class="hidden-div">
@ -107,6 +110,9 @@
</tr>
</tbody>
</table>
<button>Team erstellen</button>
<button>Team beitreten</button>
<button>Team löschen</button>
</div>
<div id="punkt" class="hidden1">
@ -146,7 +152,8 @@
<button class="submit_button" type="submit">Add</button>
</center>
</div>
<button>Spiele Zeigen</button>
<p>Aktuelles Spiel: </p>
</div>
<!-- Chat -->

View File

@ -3,3 +3,5 @@ db.createCollection('mate');
db.createCollection('messages');
db.createCollection('events');
db.createCollection('systemMonitor');
db.createCollection('teams')
db.createCollection('game')