Skip to content

Commit 308901a

Browse files
committed
fix: typing
1 parent 47b7ced commit 308901a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/app/api/tasks/[id]/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export const GET = async (req: Request) => {
2020

2121
export const PUT = async (req: Request) => {
2222
try {
23-
const { title, description, author } = await req.json();
23+
const { title, description, author_id } = await req.json();
2424
const id = req.url.split("tasks/")[1];
25-
updateTask(id, {title, description, author});
25+
updateTask(id, {title, description, author_id});
2626
return NextResponse.json({ message: "OK" }, { status: 200 });
2727
} catch (err) {
2828
return NextResponse.json({message: 'Error'}, {status: 500})

src/app/lib/tasks_controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export const deleteTask = async (id: string) => {
4141
};
4242

4343

44-
export const updateTask = async (id:string | number, {title, description, author}:TaskInput) => {
44+
export const updateTask = async (id:string | number, {title, description, author_id}:TaskInput) => {
4545
const { data, error } = await supabase
4646
.from('tasks')
47-
.update({ title, description, author })
47+
.update({ title, description, author_id })
4848
.eq('id', id);
4949

5050
if (error) throw new Error(error.message);

src/models/models.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export interface TaskProps{
2828
export interface TaskInput{
2929
title: string;
3030
description: string;
31-
start_date: string;
31+
start_date?: string;
3232
status?: "incomplete" | "completed";
33-
tags: string[];
34-
end_date: string;
33+
tags?: string[];
34+
end_date?: string;
3535
author_id: string;
3636
}
3737

0 commit comments

Comments
 (0)