Skip to content

Commit

Permalink
- fixed reqs.txt in server
Browse files Browse the repository at this point in the history
- action @4 instead of @3
- fixed permission of GET /users
  • Loading branch information
HardMax71 committed Sep 1, 2024
1 parent 7c1ec36 commit 767fb7c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions server/app/api/v1/endpoints/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ def create_chat(
db_chat = chat_crud.create_chat(db, current_user.id, chat.user2_id)
return ChatResponse.model_validate(db_chat)


@router.get("/{chat_id}", response_model=ChatResponse)
def get_chat(
chat_id: int,
db: Session = Depends(deps.get_db),
current_user: User = Depends(deps.get_current_active_user)
chat_id: int,
db: Session = Depends(deps.get_db),
current_user: User = Depends(deps.get_current_active_user)
):
chat = chat_crud.get_chat(db, chat_id, current_user.id)
if not chat:
raise HTTPException(status_code=404, detail="Chat not found")
return ChatResponse.model_validate(chat)


@router.get("/", response_model=ChatListResponse)
def get_user_chats(
db: Session = Depends(deps.get_db),
Expand Down Expand Up @@ -62,7 +64,7 @@ def create_message(
chat = chat_crud.get_chat(db, chat_id, current_user.id)
if not chat:
raise HTTPException(status_code=404, detail="Chat not found")
db_message = chat_crud.create_message(db, chat_id, current_user.id, message)
chat_crud.create_message(db, chat_id, current_user.id, message)
return ChatResponse.model_validate(chat)


Expand Down
2 changes: 1 addition & 1 deletion server/app/api/v1/endpoints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def read_users(
skip: int = Query(0),
limit: int = Query(100),
db: Session = Depends(deps.get_db),
current_user: models.User = Depends(deps.get_current_admin)
current_user: models.User = Depends(deps.get_current_active_user)
):
users = crud.user.get_multi_with_filters(
db,
Expand Down
4 changes: 2 additions & 2 deletions server/app/crud/chat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List

from sqlalchemy import or_, and_
from sqlalchemy.orm import Session, relationship
from sqlalchemy.orm import Session

from app.models.chat import Chat, Message
from public_api.shared_schemas import MessageCreate
Expand Down Expand Up @@ -47,4 +47,4 @@ def get_chat_messages(self, db: Session, chat_id: int, user_id: int) -> List[Mes
return []


chat = CRUDChat()
chat = CRUDChat()
Binary file modified server/nexusware.db
Binary file not shown.
2 changes: 1 addition & 1 deletion server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dnspython==2.6.1
ecdsa==0.19.0
email_validator==2.2.0
fastapi==0.112.2
h11==0.14.0
h11>=0.11.0
idna==3.8
joblib==1.4.2
Mako==1.3.5
Expand Down

0 comments on commit 767fb7c

Please sign in to comment.