예제 #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))