I'm following these tutorials to allow an app user to register, take a photo and upload the photo to the database so the photo is tied to their userId.
http://docs.appery.io/tutorials/build...
http://docs.appery.io/tutorials/using...
Later on I will create access to the db where a manager will log in and see the photo data for only the users who are associated with their ManagerCode.
I have one custom db collection called Photo and I will also use the pre-defined User collection.
How can I implement the concept of a foreign key in the database so that when a user takes a photo, it is saved to the db under their userId?
I see that the Users collection has a field called _id
I can put a field called UserId in my Photo collection, but how can I:
Save a user's autogenerated _id to settings in their local storage during user registration so the UserId is always available when a photo is uploaded to the db?
Retrieve the UserId from local storage to use in the DB REST API Add Service so it can be loaded into the Photo collection when the photo is uploaded to the db?