[TASK-007] fix: Sync entities with DDL - add missing fields
- user.entity: Add display_name, phone_verified, is_owner, password_changed_at, failed_login_attempts, locked_until, preferences, last_activity_at - role.entity: Add slug, permissions, parent_role_id, level for hierarchy - tenant.entity: Add subscription_status, stripe_customer_id, stripe_subscription_id, subscription_ends_at, deleted_at Closes DDL↔Backend coherence gaps identified in TASK-007 analysis. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c683ab0353
commit
a881c5cc2b
@ -31,12 +31,18 @@ export class User {
|
||||
@Column({ type: 'varchar', length: 100, nullable: true })
|
||||
last_name: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
display_name: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 255, nullable: true })
|
||||
avatar_url: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
phone: string | null;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
phone_verified: boolean;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: ['active', 'inactive', 'suspended', 'pending_verification'],
|
||||
@ -45,6 +51,9 @@ export class User {
|
||||
})
|
||||
status: string;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
is_owner: boolean;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
email_verified: boolean;
|
||||
|
||||
@ -63,6 +72,15 @@ export class User {
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
mfa_enabled_at: Date | null;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
password_changed_at: Date | null;
|
||||
|
||||
@Column({ type: 'int', default: 0 })
|
||||
failed_login_attempts: number;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
locked_until: Date | null;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
last_login_at: Date | null;
|
||||
|
||||
@ -72,6 +90,12 @@ export class User {
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
metadata: Record<string, any> | null;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
preferences: Record<string, any> | null;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
last_activity_at: Date | null;
|
||||
|
||||
@CreateDateColumn({ type: 'timestamp with time zone' })
|
||||
created_at: Date;
|
||||
|
||||
|
||||
@ -26,9 +26,22 @@ export class Role {
|
||||
@Index()
|
||||
code: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
@Index()
|
||||
slug: string | null;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
description: string | null;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
permissions: string[] | null;
|
||||
|
||||
@Column({ type: 'uuid', nullable: true })
|
||||
parent_role_id: string | null;
|
||||
|
||||
@Column({ type: 'int', default: 0 })
|
||||
level: number;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
is_system: boolean;
|
||||
|
||||
|
||||
@ -36,9 +36,26 @@ export class Tenant {
|
||||
@Column({ type: 'uuid', nullable: true })
|
||||
plan_id: string | null;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: ['trialing', 'active', 'past_due', 'cancelled', 'unpaid'],
|
||||
enumName: 'tenants.subscription_status',
|
||||
nullable: true,
|
||||
})
|
||||
subscription_status: 'trialing' | 'active' | 'past_due' | 'cancelled' | 'unpaid' | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 255, nullable: true })
|
||||
stripe_customer_id: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 255, nullable: true })
|
||||
stripe_subscription_id: string | null;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
trial_ends_at: Date | null;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
subscription_ends_at: Date | null;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
settings: Record<string, any> | null;
|
||||
|
||||
@ -50,4 +67,7 @@ export class Tenant {
|
||||
|
||||
@UpdateDateColumn({ type: 'timestamp with time zone' })
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
deleted_at: Date | null;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user