
I want to save the preferences of my users during the signup phase, like this:
email: 'user@example.com',
password: 'password',
data: {'userType': 'doctor'}, // other is patient
);
but account.create does not have the data property. I have two different users, how can I separate them when signing up or?

Hi @Hz.Bootlegger ,
you can handle such situation like this:
await account.create(
email: 'user@example.com',
password: 'password',
).then((response) async {
//! TODO: you will need to login the user.
//! before running `updatePrefs`.
await account.updatePrefs(
prefs: {'userType': 'doctor'},
);
return response;
}).then((response) {
/// do whatever you want todo with `response` returned from `account.create` here
});

that's how you can handle it on client side.

or you can create function using Server SDK that can handles user creation process including updating prefs for that user. and you can call that function using function URL on client side to create user instead of using account.create
from Appwrite SDK.

do you mean I'd open a session in between codebase but dont lead user to homepage as really logged in then update their pref and log out?

like fake session

yeah you can do it that way if you don't want to use function or server sdk, but I think that's not good way to approch it, you should use function approch instead.

server function replaces all account.create stuff ?

yes

you just need to send http POST request

to function URL

so its actually a rest

and function can handle the account.create & account.updatePrefs

functions can be executed via URLs as REST API.

okay I like it. Would you share the example link

you can get started with functions here: https://appwrite.io/docs/products/functions/quick-start

in this case the function I needed should be available for anyone but guests right?

or any is enough

guests is correct


for creating new user using server SDK in your function, refer this: https://appwrite.io/docs/references/cloud/server-nodejs/users#create

and for updating user's prefs using server SDK in function, refer this: https://appwrite.io/docs/references/cloud/server-nodejs/account#updatePrefs
Recommended threads
- Relationships restricted to a max depth ...
When I do query like: ``` await _databases.listDocuments( databaseId: AppwriteConfig.DATABASE_ID, collectionId: AppwriteConfig.SERVICES_COLLECTI...
- How can we add more than 8 attributes in...
Hey, when I tried to add attribute in my collection it showed me this Error "The maximum number or size of attributes for this collection has been reached." How...
- implement caching
It it possible to cache response for few minutes? I dont want to create function or implement a whole reverse server just to cache it in somewhere ?
