-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete item #52
base: main
Are you sure you want to change the base?
Delete item #52
Conversation
.env
Outdated
@@ -0,0 +1,13 @@ | |||
# Environment variables declared in this file are automatically made available to Prisma. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't commit this file
git rm --cached name_of_file
tsconfig.json
Outdated
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"module": "commonjs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/pages/api/deleteItem.ts
Outdated
if (err instanceof ZodError) { | ||
response.status(400).send(`Wrong Data Sent =>${JSON.stringify(err)}`); | ||
} else { | ||
response.status(418).send("Something is wrong"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you're a teapot? 😄
src/pages/api/deleteItem.ts
Outdated
ListID: null, | ||
}, | ||
}); | ||
response.status(201).send("Removed Items"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
200 is more fitting here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks going to change it to 200.
src/pages/api/deleteItem.ts
Outdated
id: id, | ||
}, | ||
data: { | ||
ListID: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use disconnect: true
instead of nulling the reference to the foreign key here.
https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#disconnect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
working, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse merge before PR and see comments @peelerzin
Removed .env file succesfully and tsconfig problem |
Hey,
Here is my solution for the issue 44 to delete items from a list without removing the item itself.
After creating a patch request, it does indeed removed the item.