Skip to content

membership

Pydantic models related to organization memberships.

A membership links a user to an organization with a role.

MemberOut pydantic-model

Bases: BaseModel

A member of an organization, as listed to its other members.

Config:

  • frozen: True

Fields:

created_at pydantic-field

When the member joined.

email pydantic-field

The member's email address.

id pydantic-field

The membership id; the id to address for role changes and removal.

name = None pydantic-field

The member's display name, if set.

role pydantic-field

The member's role in the organization.

user_id pydantic-field

The member's user id.

MemberRoleUpdate pydantic-model

Bases: BaseModel

Change a member's role between admin and member.

Ownership is not a role to assign; it moves through an ownership transfer, which requires the owner's password.

Fields:

Validators:

  • _not_owner → role

role pydantic-field

The member's new role: admin or member.

Membership pydantic-model

Bases: BaseModel

Canonical Membership model — a user's role within an organization.

Config:

  • from_attributes: True
  • frozen: True

Fields:

created_at pydantic-field

Creation timestamp

id pydantic-field

Unique identifier of the membership

org_id pydantic-field

The organization the user belongs to

role pydantic-field

The member's role in the organization

user_id pydantic-field

The member user