Issue in docs for todoApp using - update
I am facing some issues following the docs from "Authentication" for the todoApp.Everything works fine till I migrated the db to include relation between "User" and "Task" entity. Also the code uses "args" but the parameter does not have "args". Ref: "https://wasp-lang.dev/docs/tutorials/todo-app/06-auth"
One more typo here in the first line : "https://wasp-lang.dev/docs/tutorials/todo-app/05-updating-tasks"
23 Replies
ah you're right about the args typo. thanks for the heads up
are you getting an error after migration? can you share it and/or the code that's causing the issue
That's an error uuuf! Thanks for reporting it. I'll get back to you quickly with the correct code 😊
Thank you
Ok. the tutorial is fixed and the changes should be live on the page soon. Thanks again!
What was the issue you were having after migration? if you're still running into issues/errors, share them with us and we'll help out.
After using the updated docs, I still have an error. @Vinny (@Wasp) @miho
This is the error : "Type '{ user: { id: User; }; }' is not assignable to type 'TaskWhereInput'.
Object literal may only specify known properties, and 'user' does not exist in type 'TaskWhereInput'"
How does your
Task
entity look in the Wasp file? Did you run wasp db migrate-dev
if/when you maybe changed it?I tried to migrate again but it says already in sync
Wohooo @0xjoona, you just became a Waspeteer level 1!
Same as the one in docs
When I hover over the "Task" in the first line, it only shows the first 3 properties, no userId though
hmm... maybe if User and userId aren't optional it will work. did you try removing the question mark?
then I would try
I will give that a try.
cool. let me know how it goes 🙏
It's working magically ✨. I think it was VS code giving me some issues
I'll continue to build and understand the repo and will pick up some Issues
Ah yeah sometimes typescript acts weird. Glad it’s working!
I experienced the same error but it was due to me making a mistake and not updating
Task.update
to Task.updateMany
.
However it did cause me to notice that the tutorial code doesn't highlight that I also had to change UpdateTask<UpdateTaskPayload, Task>
to UpdateTask<UpdateTaskPayload, { count: number }>
as well. 🙂why would you need to return an object of
{ count: number }
?
if you're returning context.entities.Task.updateMany({})
then your return type should be Task[]
, so in all it would look like:
I would say, since you're only updating one Task, you should use update
and not updateMany
I guess you’re saying you disagree with the tutorial code on the wasp site that I screenshot? It’s not my code, I’m just following the instructions 🙂
haha oh no! sorry about that. Let me take a look.
The reason why we use
updateMany
there is because it allows you to provide user
part in the where
field, this is somewhat silly restriction by Prisma that they lifted off in the latest version (next big Wasp release will be using that new Prisma version).
@Vinny (@Wasp) are we ok with this issue then, anything left to update in the docs?nope I think we can close this