Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
88304e2
coding: pdf api.
Jaredanwolfgang May 24, 2025
d55c9bd
fix: update database host configuration and change ID types to UUID i…
mingzhi2004 May 24, 2025
df61479
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
mingzhi2004 May 24, 2025
d966e3c
fixed import problem.
mingzhi2004 May 24, 2025
b20c6fe
remove material.
Jaredanwolfgang May 24, 2025
af98d4d
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 24, 2025
5b31bf4
Add pytest-cov for test coverage reporting and update README for pyte…
mingzhi2004 May 24, 2025
a7b3fdf
doc: readme update
chanbengz May 24, 2025
9b4d4fd
fix: add ondelete CASCADE to foreign key constraints in multiple models
mingzhi2004 May 24, 2025
3f452e4
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
mingzhi2004 May 24, 2025
f4bdb84
fix: some apis.
Jaredanwolfgang May 24, 2025
ede6fdf
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 24, 2025
8808f44
fix: environment
Jaredanwolfgang May 24, 2025
b79b7f4
fix: filedb
Jaredanwolfgang May 24, 2025
5bf150d
update group
RoderickQiu May 24, 2025
df3b1fd
wip: terminal ws
chanbengz May 24, 2025
a358996
fix calendar api
we-are-Zed May 24, 2025
15ba14b
feat: add groups attribute to User model and update related functiona…
mingzhi2004 May 24, 2025
008e349
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
mingzhi2004 May 24, 2025
0266297
fix schedule
RoderickQiu May 24, 2025
53c5724
add assignment test file.
Jaredanwolfgang May 24, 2025
2e7f391
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 24, 2025
fbd0301
fix group list
RoderickQiu May 24, 2025
4d987b8
some fixes
Jaredanwolfgang May 24, 2025
69037f8
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 24, 2025
107a7e4
fix: websocket.
Jaredanwolfgang May 24, 2025
3f6eb6f
feat: add modify_user endpoint to update user details with validation
mingzhi2004 May 24, 2025
4e93b52
fix: docker image missing make
chanbengz May 24, 2025
3a8a8aa
assignment api fix body to form-data
we-are-Zed May 24, 2025
ba2daa4
fix: environment id.
Jaredanwolfgang May 24, 2025
1602148
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 24, 2025
dfd2088
photo store fix
we-are-Zed May 24, 2025
521c775
fix: run tests when startup
chanbengz May 24, 2025
1d2b5a6
fix: post /environment
Jaredanwolfgang May 24, 2025
2dc4a02
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 24, 2025
964cebd
fix: assignment test.
Jaredanwolfgang May 24, 2025
06a6b20
fix: image build
chanbengz May 24, 2025
eb400cf
fix: dockerfile entrypoint
chanbengz May 24, 2025
1f50c90
fix: paths issue
chanbengz May 24, 2025
ca53474
fix: get_assignments.
Jaredanwolfgang May 25, 2025
5caf0bf
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 25, 2025
39253a9
fix: get_environment Body
Jaredanwolfgang May 25, 2025
83eb33a
fix group id can be null
RoderickQiu May 25, 2025
2a7865d
Revert "fix group id can be null"
RoderickQiu May 25, 2025
5f5f89c
fix: get_environment
Jaredanwolfgang May 25, 2025
97f41b2
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 25, 2025
776b12a
fix: group logic in get_environment.
Jaredanwolfgang May 25, 2025
1ac52b5
fix: group_return logic
Jaredanwolfgang May 25, 2025
29b7c24
commit before create pod
Jaredanwolfgang May 25, 2025
6c2d64d
null for course id
Jaredanwolfgang May 25, 2025
ed9ba39
is_running
Jaredanwolfgang May 25, 2025
7b997cb
fix: wsurl inital nullable
Jaredanwolfgang May 25, 2025
48d656b
uuid to str
Jaredanwolfgang May 25, 2025
7063669
fix: pod name
chanbengz May 25, 2025
d06a9fe
get_environment return type
Jaredanwolfgang May 25, 2025
5a9d3f6
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 25, 2025
4a13676
fix: hash of pod name
chanbengz May 25, 2025
d0389b5
fix: remove layout
chanbengz May 25, 2025
932bd8f
api
Jaredanwolfgang May 25, 2025
ee4352a
base64 prob
Jaredanwolfgang May 25, 2025
5bf2cd7
fix
Jaredanwolfgang May 25, 2025
465cf81
fix bookmark list exception
RoderickQiu May 25, 2025
4c116b1
fix: websocket.
Jaredanwolfgang May 25, 2025
3886b71
Merge branches 'backend' and 'backend' of github.com:sustech-cs304/te…
Jaredanwolfgang May 25, 2025
4bded75
fix ai user info not recorded issue
RoderickQiu May 25, 2025
f19d111
fix: expose service
chanbengz May 25, 2025
d63d1ae
fix: services
chanbengz May 25, 2025
7e8f353
test: try a debug ws
chanbengz May 25, 2025
d086678
term fix
Jaredanwolfgang May 25, 2025
63b63c3
cleanup: remove try
chanbengz May 25, 2025
a8f380a
fix: foward_messages
Jaredanwolfgang May 25, 2025
454762d
Merge branch 'backend' of github.com:sustech-cs304/team-project-25spr…
Jaredanwolfgang May 25, 2025
5a1e3fe
fix: websocket forward.
Jaredanwolfgang May 25, 2025
a508f56
fix: websocket send_bytes.
Jaredanwolfgang May 25, 2025
ee83450
fix: websocket'
Jaredanwolfgang May 25, 2025
cb3234e
fix: add /
Jaredanwolfgang May 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/fastapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: ghcr.io
Expand Down
11 changes: 7 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM ghcr.io/astral-sh/uv:python3.13-alpine

WORKDIR /app
COPY uv.lock pyproject.toml .
COPY app/ ./app
COPY uv.lock pyproject.toml ./
COPY entrypoint.sh ./

RUN uv sync --frozen
ADD app /app/app
ADD test /app/test

RUN uv sync --frozen && chmod +x entrypoint.sh
ENV PATH="/app/.venv/bin:$PATH"

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "5000", "--workers", "4"]
ENTRYPOINT ["./entrypoint.sh"]
25 changes: 15 additions & 10 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ This is the backend guide for the PeachIDE project.

### Prerequisites

0. Setup PostgreSQL database and set the environment variable

```bash
export POSTGRES_USER="YOUR_USERNAME" # e.g. postgres is the default user
export POSTGRES_PASSWORD="YOUR_PASSWORD"
export POSTGRES_DB="YOUR_DATABASE_NAME" # e.g. postgres is the default database
```

1. Install `uv` the package manager

```bash
Expand Down Expand Up @@ -41,6 +49,12 @@ Run testing with pytest
python3 -m pytest
```

To generate the test coverage report, run

```
pytest --cov=app test/
```

### Code Style

```
Expand All @@ -63,13 +77,4 @@ Create a new route with single py or a directory.

## Deployment

TBD

## Test Report

To generate the test coverage report.
run

```
cd backend && pytest --cov=app test/
```
See https://github.com/sustech-cs304/team-project-25spring-2/wiki/Deployment
19 changes: 11 additions & 8 deletions backend/app/ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

@router.get("/chat")
async def chat(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user)
db: Session = Depends(get_db), current_user: User = Depends(get_current_user)
):
chats = db.query(Chat).all()
if not chats:
Expand All @@ -36,6 +35,7 @@ async def chat(
return [
{
"chat_id": chat.chat_id,
"user_id": chat.user_id,
"title": chat.title,
}
for chat in chats
Expand All @@ -46,7 +46,7 @@ async def chat(
async def get_chat(
chat_id: str,
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user)
current_user: User = Depends(get_current_user),
):
chat = db.query(Chat).filter(Chat.chat_id == chat_id).first()
if not chat:
Expand All @@ -63,12 +63,15 @@ async def get_chat(

@router.post("/chat")
async def create_chat(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user)
db: Session = Depends(get_db), current_user: User = Depends(get_current_user)
):
chat_id = str(uuid.uuid4())
chat = Chat(
chat_id=chat_id, user_id=None, material_id=None, title="New Chat", messages=[]
chat_id=chat_id,
user_id=current_user.user_id,
material_id=None,
title="New Chat",
messages=[],
)

db.add(chat)
Expand All @@ -83,7 +86,7 @@ async def update_chat_name(
chat_id: str,
title: str = Form(...),
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user)
current_user: User = Depends(get_current_user),
):
chat = db.query(Chat).filter(Chat.chat_id == chat_id).first()
if not chat:
Expand Down Expand Up @@ -113,7 +116,7 @@ async def update_chat_name(
async def delete_chat(
chat_id: str,
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user)
current_user: User = Depends(get_current_user),
):
chat = db.query(Chat).filter(Chat.chat_id == chat_id).first()
if not chat:
Expand Down
1 change: 1 addition & 0 deletions backend/app/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async def register(user_data: UserCreate, db: Session = Depends(get_db)):
email=user_data.email,
is_teacher=user_data.is_teacher,
courses=[],
groups=[],
)

db.add(db_user)
Expand Down
Loading