0xsirsaif / fastapiusers-edgedb

Edgedb adapter for fastapi-users
MIT License
9 stars 1 forks source link

How to define the user model? #8

Open mabagoury opened 1 year ago

mabagoury commented 1 year ago

In the fastapi users docs, there is a full example using SQLAlchemy. In the example, the user model extends a SQLAlchemyBaseUserTableUUID class. It defines some fields like an id. Is there a respective one with the EgeDB adapter? If not, what default fields should we define in the user model for fastapi users to do its business logic correctly?

Funding

Fund with Polar

mabagoury commented 1 year ago

In the SQLAlchemy adapter, 2 required positional arguments are passed to the database constructor: a client and a user model. I think this is how the FastAPIUsers class knows about the additional fields defined by an application. In this adapter, just the client is passed. Also, the SQLAlchemy adapter defines base user classes that have the base fields like is_active and is_verified. So, I think such classes should be defined first, and the database Adapter constructor should be adjusted to accept and use these types and their children.