Skip to content
Init is coming / May 19 - 23
Back

[SOLVED] Setting user preference after registration

  • 0
  • Flutter
  • Accounts
Ipsoka
12 Apr, 2023, 20:30

Hey, is it possible to initially set the preferences of a user without being logged in, i.e. after an account as been created?

TL;DR
TL;DR: The user wants to save metadata for each account without duplicating the account ID. The suggested solution is to create a Users/Profiles collection with a document for each user and add attributes for the metadata. It's recommended to create the document server-side and use a function trigger on account creation. Storing the metadata in user preferences is not ideal as users can update or delete it. The user wants to generate and save a unique code for each account. They are also wondering if it's possible to set the preferences of a user after account creation without being logged in. Solution: Create a Users/Profiles collection and store metadata
Ipsoka
12 Apr, 2023, 20:31

I want to generate a code for every account and would like to save it after registration, how is that possible or is the update preferences endpoint not meant for such things?

Drake
12 Apr, 2023, 20:39

what is this code used for?

Ipsoka
12 Apr, 2023, 20:40

Its a unique code that users of the app can share to connect with eachother

Ipsoka
12 Apr, 2023, 20:40

And I dont want to use the DB ID of that user for that

Ipsoka
12 Apr, 2023, 20:40

Its not something the user is supposed to change

Drake
12 Apr, 2023, 20:40

and what if they delete that value?

Drake
12 Apr, 2023, 20:41

users are free to update user preferences so it might not be good to store that value in there

Ipsoka
12 Apr, 2023, 20:41

I see, so I should create a document for that

Ipsoka
12 Apr, 2023, 20:42

Or can I save metadata other then update preferences?

Ipsoka
12 Apr, 2023, 20:42

For accounts

Ipsoka
12 Apr, 2023, 20:43

And another question, should this document be created server side or client side? If I dont want it to be changed at all by anyone that is

Drake
12 Apr, 2023, 20:43

what do you mean?

Drake
12 Apr, 2023, 20:44

server side. best thing is to probably have a function trigger on account creation

Ipsoka
12 Apr, 2023, 20:45

Im basically trying to save metadata for each account that has been created, but this meta data should be static. I wanted to avoid duplicating the accounts db id, but I guess thats the path I should take. A triggers seems right

Drake
12 Apr, 2023, 21:02

our typical approach is to create a Users/Profiles collection where each document is a user. the id of the document should match the id of hte user. then, you can add attributes for whatever custom data you need to store

Ipsoka
12 Apr, 2023, 21:13

[SOLVED] Setting user preference after registration

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more