示例#1
0
文件: routes.py 项目: emmyclef/Api
def crt_room(movie):
    created_room = str(uuid.uuid4())
    movie = Movie.query.filter_by(public_id=movie).first()
    host = current_user.name
    room = Room()
    room.unique_id = created_room
    room.host = host
    room.admin = True
    db.session.add(room)
    db.session.commit()
    return redirect(
        url_for('raw.watching', movie=movie.name, room=created_room))
示例#2
0
文件: view.py 项目: SteveParadox/Api
def create_room(current_user, movie):
    try:
        created_room = str(uuid.uuid4())
        movie = Movie.query.filter_by(public_id=movie).first()
        host = current_user.name
        room = Room()
        room.unique_id = created_room
        room.host = host
        room.admin = True
        db.session.add(room)
        db.session.commit()

        return jsonify({
            "message": f"Room {created_room} created by {host} ",
            "movie name": movie.name
        })
    except:
        return jsonify({"message": "Cannot find movie id"})
示例#3
0
文件: view.py 项目: emmyclef/Api
def create_room(movie):
    created_room = str(uuid.uuid4())
    movie = Movie.query.filter_by(public_id=movie).first()
    host = current_user.name
    room = Room()
    room.unique_id = created_room
    room.host = host
    room.admin = True
    db.session.add(room)
    db.session.commit()
    '''return jsonify(
        {
            "message": f"Room {created_room} created by {host} ",
            "movie": movie.movies,
            "movie name": movie.name
        }
    )'''
    return redirect(
        url_for('chat.watch', movie=movie.public_id, room=created_room))