Skip to content

Commit fcbd30f

Browse files
committed
fix: bug on frontend
1 parent bd6c08f commit fcbd30f

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
lines changed

backend/app/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def get_current_user(
6161
stmt = select(User).where(
6262
cast("ColumnElement[bool]", User.username == token_data.username)
6363
)
64-
db_user = session.execute(stmt).one()
64+
db_user = session.execute(stmt).scalar_one()
6565
if not db_user:
6666
raise credentials_exception
6767
return db_user

backend/app/tasks/repository.py

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def create(self, data: TaskInput) -> TaskOutput:
2020
return TaskOutput(**dict(task))
2121

2222
def list(self, offset: int, limit: int) -> List[TaskOutput]:
23-
# import pdb; pdb.set_trace()
2423
stmt = (
2524
select(Task)
2625
.where(

backend/app/tasks/service.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def update(self, task_id: int, data: TaskInput) -> TaskOutput:
4141
task.due_date = data.due_date
4242

4343
task.user_id = self.current_user_id
44+
task.status = data.status
4445
self.repository.update(task)
4546
return TaskOutput(**dict(task))
4647

frontend/src/contexts/TaskContext.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const TaskProvider = ({ children }: { children: ReactNode }) => {
115115
const newTask: Task = await(await apiFetch(`/tasks/${task.id}`, {
116116
method: 'PATCH',
117117
headers: authHeader(user),
118-
body: { status: calculateStatus(task.status) }
118+
body: { ...task, status: calculateStatus(task.status) }
119119
})).json();
120120

121121
setTasks((prevTasks) =>

0 commit comments

Comments
 (0)