ataractic
ataractic16mo ago

What are newUserProps()

I'm reading saaskit source, and I don't understand the point of newUserProps(). Why not just define isSubscribed in the createUser() function with all the other values as it is in the interface as well? We could just set it to false by default?
8 Replies
ataractic
ataracticOP16mo ago
ataractic
ataracticOP16mo ago
If I want to add properties to my user, should i add them to newUserProps() or directly into createUser() ?
ioB
ioB16mo ago
@iuioiua
iuioiua
iuioiua16mo ago
Hi there. Previously, the method you suggested was used. However, we moved the logic that generates the objects outside their respective createX() functions as it significantly improved usability. See https://github.com/denoland/saaskit/pull/292, https://github.com/denoland/saaskit/pull/290 and https://github.com/denoland/saaskit/pull/284 for more context.
GitHub
refactor: items logic in KV by iuioiua · Pull Request #284 · denola...
Before, functions within util/db.ts did too much. E.g. createItem() generated an item, set it in KV, and then returned the generated item. Now, functions only do one thing, making things easier to ...
ataractic
ataracticOP16mo ago
thank you for linking these PRs. So if I want to add my own members i should add them to newUserProps() as long as I don't need to get the object from the key value
iuioiua
iuioiua16mo ago
Sorry, I don’t understand
ataractic
ataracticOP16mo ago
anyways that's not really important, what I wanted is working now
iuioiua
iuioiua16mo ago
Nice! Let me know if you have any other questions with SaaSKit 🙂