|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
from flask import Flask
|
|
|
|
|
from flask import Flask, request
|
|
|
|
|
import mysql.connector
|
|
|
|
|
|
|
|
|
|
mydb = mysql.connector.connect(
|
|
|
|
|
@ -12,7 +12,17 @@ app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
@app.get('/meetings/<id>')
|
|
|
|
|
def show(id):
|
|
|
|
|
cursor.execute('SELECT NOW();')
|
|
|
|
|
for row in cursor:
|
|
|
|
|
print(row)
|
|
|
|
|
return 'hi'
|
|
|
|
|
cursor.execute('SELECT * FROM meetings WHERE id=%s', [id])
|
|
|
|
|
result = cursor.fetchone()
|
|
|
|
|
print(result)
|
|
|
|
|
return {
|
|
|
|
|
"id":result[0],
|
|
|
|
|
"num_participants":result[1],
|
|
|
|
|
"start_time":result[2].strftime("%Y-%m-%d %H:%M:%S"),
|
|
|
|
|
"end_time":result[3] if result[3] == None else result[2].strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@app.post('/meetings')
|
|
|
|
|
def create():
|
|
|
|
|
cursor.execute('INSERT INTO meetings (num_participants) VALUES (%s)', [request.json['num_participants']])
|
|
|
|
|
return request.json
|
|
|
|
|
|