Ejemplo n.º 1
0
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))
Ejemplo n.º 2
0
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"})
Ejemplo n.º 3
0
Archivo: view.py Proyecto: 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))