Skip to content

Commit

Permalink
add room
Browse files Browse the repository at this point in the history
  • Loading branch information
WSL0809 committed May 22, 2024
1 parent 01822de commit 6b7174b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Session

from auth import roles_required
from auth import roles_required, get_current_active_user
from auth_schema import User
from model import Room
from database import get_db
from pydantic import BaseModel
Expand All @@ -26,7 +27,7 @@ class AddRoomResp(BaseModel):

@router.post("/add_room", response_model=AddRoomResp)
@roles_required("admin")
async def add_room(room_info: AddRoomRecv, db: Session = Depends(get_db)):
async def add_room(room_info: AddRoomRecv, current_user: User = Depends(get_current_active_user), db: Session = Depends(get_db)):
try:
room = Room(room_number=room_info.room_number, notes=room_info.notes)
db.add(room)
Expand Down

0 comments on commit 6b7174b

Please sign in to comment.