- InviteToken model with unique token for each invite
- POST /users/invite - create invite by email with role (admin/mecanic)
- POST /auth/accept-invite - accept invite, set password, return JWT
- GET /users - list all users in tenant
- DELETE /users/{id} - deactivate user (cannot deactivate owner)
- Alembic migration for invites table
- 25 passing tests (auth + sync + orders + pdf + portal + invoices + users)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
13 lines
518 B
Python
13 lines
518 B
Python
from sqlalchemy import String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base, UUIDMixin, TenantMixin, TimestampMixin
|
|
|
|
|
|
class InviteToken(Base, UUIDMixin, TenantMixin, TimestampMixin):
|
|
__tablename__ = "invites"
|
|
email: Mapped[str] = mapped_column(String(200))
|
|
rol: Mapped[str] = mapped_column(String(20))
|
|
token: Mapped[str] = mapped_column(String(36), unique=True, index=True)
|
|
used: Mapped[str | None] = mapped_column(Text) # ISO8601 when used, null if pending
|