username
email
registryDate
gotWarnings
? If we answer this question and let's say I shouldn't create a user model since I use Kinde, how should I handle the situation users register their restaurants in my app? I'm not trying to ask something unrelated but how that relation works with the Kinde user and restaurant if I create the restaurant model. I use Convex as my Backend and very new to both Kinde and Convex.Let's clarify the approach: 1. Kinde and User Management: No user model needed: Kinde handles user management (registration, login, etc.) and stores user data securely. You don't need to create a separate user model in your Convex database. Accessing user information: You can access the currently logged-in user's information (e.g., user ID) within Convex functions using Kinde's provided methods or libraries. 2. Restaurant Model in Convex: Create a Restaurant table: Define a Restaurant table in your Convex schema with relevant fields like: name (string) ownerId (string, referencing the Kinde user ID) address (string) otherRestaurantDetails (any additional information) 3. Linking Restaurants to Users: When a user registers a restaurant: Inside your Convex function handling restaurant registration, retrieve the currently logged-in user's ID using Kinde's methods. Store this user ID in the ownerId field of the newly created restaurant record in the Restaurant table. 4. Access Control and Data Ownership: Convex function authorization: Within your Convex functions, you can use the auth object to check the currently logged-in user and their permissions. This allows you to restrict access to restaurant data based on ownership (e.g., only the owner can modify a restaurant's information). Example Flow: User logs in using Kinde. User fills out a form to register their restaurant. The frontend sends a request to a Next.js API route. The API route calls a Convex function to handle restaurant registration. The Convex function: Retrieves the logged-in user's ID from Kinde. Creates a new record in the Restaurant table with the restaurant details and sets the ownerId to the retrieved user ID.
kinde_id