users

5 rows


Description

Пользователи системы

Columns

Column Type Size Nulls Auto Default Children Parents Comments
email text 2147483647 null

Email адрес (уникальный, используется для входа)

password_hash text 2147483647 null

Хеш пароля (bcrypt)

first_name text 2147483647 null

Имя пользователя

last_name text 2147483647 null

Фамилия пользователя

avatar_url text 2147483647 null

URL аватара в MinIO

totp_secret text 2147483647 null

Секретный ключ для TOTP 2FA

is_2fa_enabled bool 1 null

Флаг включенной двухфакторной аутентификации

is_2fa_email_enabled bool 1 null
preferred_2fa_method text 2147483647 null
phone text 2147483647 null

Номер телефона

preferred_transport text 2147483647 null

Предпочитаемая транспортная компания (FK на transport_companies)

default_pvz_address text 2147483647 null

Адрес ПВЗ по умолчанию

pvz_addresses jsonb 2147483647 null

JSONB: адреса доставки по транспортным компаниям ({tc_id: {address, is_home_delivery, comment}})

is_active bool 1 null

Флаг активности пользователя

is_verified bool 1 null

Флаг подтвержденного email

is_admin bool 1 null

Глобальный админ системы (только через БД, нет API)

last_login timestamptz 35,6 null

Дата последнего входа

id uuid 2147483647 null
anonymous_hints.receiver_id anonymous_hints_receiver_id_fkey C
anonymous_hints.sender_id anonymous_hints_sender_id_fkey C
box_participants.user_id box_participants_user_id_fkey C
draw_results.performed_by draw_results_performed_by_fkey N
email_2fa_codes.user_id email_2fa_codes_user_id_fkey C
email_verification_codes.user_id email_verification_codes_user_id_fkey C
friendships.requester_id friendships_requester_id_fkey R
friendships.user_id_1 friendships_user_id_1_fkey C
friendships.user_id_2 friendships_user_id_2_fkey C
notifications.user_id notifications_user_id_fkey C
ownership_transfer_requests.from_user_id ownership_transfer_requests_from_user_id_fkey C
ownership_transfer_requests.to_user_id ownership_transfer_requests_to_user_id_fkey C
password_reset_codes.user_id password_reset_codes_user_id_fkey C
refresh_tokens.user_id refresh_tokens_user_id_fkey C
team_invite_tokens.invited_by team_invite_tokens_invited_by_fkey C
team_invites.created_by team_invites_created_by_fkey C
team_members.user_id team_members_user_id_fkey C
teams.owner_id teams_owner_id_fkey R
user_consents.user_id user_consents_user_id_fkey C
votes.voter_id votes_voter_id_fkey C

Уникальный идентификатор пользователя (UUID)

created_at timestamptz 35,6 now()

Дата регистрации

updated_at timestamptz 35,6 now()

Дата последнего обновления профиля

birthday date 13 null

Дата рождения пользователя для уведомлений друзьям

Indexes

Constraint Name Type Sort Column(s)
users_pkey Primary key Asc id
ix_users_created_at Performance Asc created_at
ix_users_email Must be unique Asc email
ix_users_is_active Performance Asc is_active
ix_users_preferred_transport Performance Asc preferred_transport

Check Constraints

Constraint Name Constraint
chk_users_email_format (email ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'::text)
chk_users_phone_format ((phone IS NULL) OR (phone ~ '^\+?[0-9\s\-\(\)]+$'::text))

Relationships