procrastinator_bas
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
Haha, thanks. I was able to resolve it.
I gave the bot the final correct code, but I'm not sure it's gonna do something with it 😉
This issue is resolved. 👍
37 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
@kapa.ai , Almost correct. 🙂
I can't return the prsima.transaction, it does not fit the correct return type.
This altered code does work:
37 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
@kapa.ai Is
import prisma from '@wasp/dbClient'
correct?
I get this error: Cannot find module '@wasp/dbClient' or its corresponding type declarations.
Where should prisma be located? I'm using wasp 0.14.37 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Getting the user in the rootcomponent
I'm sorry, I meant in the props for the Header function.
Here is my code:
26 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
@kapa.ai My IDE says
context.entities.$transaction
does not exist. Is that syntax correct?
Or should I directly use prisma? If so, how do I import it?37 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Getting the user in the rootcomponent
@sodic I am using Typescript.
If I hover over useAuth it shows me the
UseQueryResult<AuthUser | null>
type. I'm guessing AuthUser will be undefined at first render?
@kapa.ai
Your code gives me a typescript error on this part: <Header user={user} />
I needed to change the type of user to AuthUser | null | undefined
to get it to work.26 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
@kapa.ai Is this all in 1 transaction?
If any part of these database calls fail, I would want all of it to roll back, so I don't skip numbers unnecessarily.
37 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
It is a working solution to my question, but after analyzing further the requirements have changed (don't they always?).
If I have a class of 10 students, delete student 3 and add a new one, that student will get a number that is already assigned.
Numbers do not need to be re-used after deleting a student and a number opens up..
So I do believe I need to store the latest assigned number in the class table and get that number when adding a new student.
@kapa.ai , do you want to give it another try with the new requirements?
37 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Getting the user in the rootcomponent
@kapa.ai If the user is not loggedIn, what will be the value of user?
26 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #🙋questions
Accessing/changing another entity when performing a db action
Good bot. 🙂
37 replies