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"
No description
23 Replies
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
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
miho
miho15mo ago
That's an error uuuf! Thanks for reporting it. I'll get back to you quickly with the correct code 😊
0xjoona
0xjoona15mo ago
Thank you
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
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.
0xjoona
0xjoona15mo ago
After using the updated docs, I still have an error. @Vinny (@Wasp) @miho
0xjoona
0xjoona15mo ago
No description
0xjoona
0xjoona15mo ago
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'"
miho
miho15mo ago
How does your Task entity look in the Wasp file? Did you run wasp db migrate-dev if/when you maybe changed it?
0xjoona
0xjoona15mo ago
I tried to migrate again but it says already in sync
MEE6
MEE615mo ago
Wohooo @0xjoona, you just became a Waspeteer level 1!
0xjoona
0xjoona15mo ago
Same as the one in docs
No description
0xjoona
0xjoona15mo ago
When I hover over the "Task" in the first line, it only shows the first 3 properties, no userId though
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
hmm... maybe if User and userId aren't optional it will work. did you try removing the question mark? then I would try
return context.entities.Task.findMany({
where: { userId: context.user.id }
})
return context.entities.Task.findMany({
where: { userId: context.user.id }
})
0xjoona
0xjoona15mo ago
I will give that a try.
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
cool. let me know how it goes 🙏
0xjoona
0xjoona15mo ago
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
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
Ah yeah sometimes typescript acts weird. Glad it’s working!
Jox
Jox15mo ago
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. 🙂
No description
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
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:
UpdateTask<UpdateTaskPayload, Task[]>
UpdateTask<UpdateTaskPayload, Task[]>
I would say, since you're only updating one Task, you should use update and not updateMany
Jox
Jox15mo ago
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 🙂
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
haha oh no! sorry about that. Let me take a look.
martinsos
martinsos15mo ago
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?
Vinny (@Wasp)
Vinny (@Wasp)15mo ago
nope I think we can close this
Want results from more Discord servers?
Add your server