apartment-legal-server-erd
Tables (23)
apartments
- id — BIGSERIAL
- code — VARCHAR(255) — NOT NULL
- name — VARCHAR(255) — NOT NULL
- address — VARCHAR(255) — NOT NULL
- postal_code — VARCHAR(20)
- total_buildings — INT
- total_units — INT
- management_office_phone — VARCHAR(50)
- features — TEXT — NOT NULL
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
contract_reviews
- id — BIGSERIAL
- contract_id — BIGINT — NOT NULL
- reviewer_id — BIGINT
- is_completed — BOOLEAN — NOT NULL
- completed_at — TIMESTAMP
- opinion_content — TEXT
- opinion_files — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
contract_templates
- id — BIGSERIAL
- created_by_id — BIGINT — NOT NULL
- name — VARCHAR(255) — NOT NULL
- type — contract_type_enum — NOT NULL
- description — TEXT
- content — TEXT — NOT NULL
- variables — TEXT
- is_active — BOOLEAN — NOT NULL
- is_official — BOOLEAN — NOT NULL
- usage_count — INT — NOT NULL
- category — VARCHAR(100)
- tags — TEXT
- file_url — VARCHAR(500)
- preview_image_url — VARCHAR(500)
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
contracts
- id — BIGSERIAL
- user_id — BIGINT — NOT NULL
- lawyer_id — BIGINT
- apartment_id — BIGINT — NOT NULL
- title — VARCHAR(255) — NOT NULL
- preferred_review_type — review_type_enum — NOT NULL
- type — contract_type_enum — NOT NULL
- status — contract_status_enum — NOT NULL
- files — JSONB
- review_items — TEXT
- additional_request — TEXT
- metadata — JSONB
- summary — TEXT
- has_inbox_update — BOOLEAN — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
counsel_messages
- id — BIGSERIAL
- session_id — BIGINT
- depth_consultation_id — BIGINT
- role — counsel_message_role_enum — NOT NULL
- content — TEXT — NOT NULL
- tts_audio_url — VARCHAR(500)
- facts_organized — BOOLEAN — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
counsel_reviews
- id — BIGSERIAL
- review_type — review_type_enum — NOT NULL
- session_id — BIGINT — NOT NULL
- reviewer_id — BIGINT
- is_completed — BOOLEAN — NOT NULL
- completed_at — TIMESTAMP
- opinion_content — TEXT
- opinion_files — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
counsel_sessions
- id — BIGSERIAL
- uuid — UUID — NOT NULL
- title — VARCHAR(255) — NOT NULL
- preferred_review_type — review_type_enum
- user_id — BIGINT — NOT NULL
- apartment_id — BIGINT
- lawyer_id — BIGINT
- status — counsel_status_enum — NOT NULL
- has_inbox_update — BOOLEAN — NOT NULL
- summary — TEXT
- edited_summary — TEXT
- facts_organized — BOOLEAN — NOT NULL
- case_type — VARCHAR(100)
- completed_at — TIMESTAMP
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
depth_consultations
- id — BIGSERIAL
- legal_case_id — BIGINT — NOT NULL
- uuid — UUID — NOT NULL
- depth_level — INT — NOT NULL
- lawyer_prompt — TEXT
- summary — TEXT
- requested_evidences — TEXT
- requested_at — TIMESTAMP
- completed_at — TIMESTAMP
- is_completed — BOOLEAN — NOT NULL
- facts_organized — BOOLEAN — NOT NULL
- case_type — VARCHAR(100)
- edited_summary — TEXT
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
evidences
- id — BIGSERIAL
- service_type — evidence_service_type_enum — NOT NULL
- depth_consultation_id — BIGINT
- counsel_session_id — BIGINT
- file_url — VARCHAR(500) — NOT NULL
- original_file_name — VARCHAR(255)
- file_size — INT
- description — TEXT
- requested_by_lawyer — BOOLEAN — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
legal_case_products
- id — BIGSERIAL
- legal_case_id — BIGINT — NOT NULL
- product_id — BIGINT — NOT NULL
- price — NUMERIC(10,2) — NOT NULL
- quantity — INT — NOT NULL
- is_paid — BOOLEAN — NOT NULL
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
legal_case_recommended_products
- legal_case_id — BIGINT — Primary key — NOT NULL
- product_id — BIGINT — Primary key — NOT NULL
legal_cases
- id — BIGSERIAL
- legal_case_number — VARCHAR(50) — NOT NULL
- legal_case_uuid — UUID — NOT NULL
- counsel_session_id — BIGINT — NOT NULL
- client_id — BIGINT — NOT NULL
- lawyer_id — BIGINT
- apartment_id — BIGINT
- current_depth_level — INT — NOT NULL
- signature_receipt_id — VARCHAR(255)
- signature_status — VARCHAR(50)
- signature_response_data — JSONB
- signature_completed_at — TIMESTAMP
- status — legal_case_status_enum — NOT NULL
- has_inbox_update — BOOLEAN — NOT NULL
- completed_at — TIMESTAMP
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
notice_reviews
- id — BIGSERIAL
- notice_id — BIGINT — NOT NULL
- reviewer_id — BIGINT
- is_completed — BOOLEAN — NOT NULL
- completed_at — TIMESTAMP
- opinion_content — TEXT
- opinion_files — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
notices
- id — BIGSERIAL
- title — VARCHAR(255)
- preferred_review_type — review_type_enum — NOT NULL
- type — notice_type_enum — NOT NULL
- files — JSONB — NOT NULL
- review_items — TEXT
- additional_request — TEXT
- status — notice_status_enum — NOT NULL
- user_id — BIGINT — NOT NULL
- lawyer_id — BIGINT
- apartment_id — BIGINT — NOT NULL
- summary — TEXT
- has_inbox_update — BOOLEAN — NOT NULL
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
oauth_accounts
- id — BIGSERIAL
- user_id — BIGINT — NOT NULL
- service_type — service_type_enum
- provider — VARCHAR(20) — NOT NULL
- provider_id — VARCHAR(255) — NOT NULL
- access_token — VARCHAR(500)
- refresh_token — VARCHAR(500)
- token_expires_at — TIMESTAMP
- profile — JSONB
- connected_at — TIMESTAMP — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
official_document_reviews
- id — BIGSERIAL
- official_document_id — BIGINT — NOT NULL
- reviewer_id — BIGINT
- is_completed — BOOLEAN — NOT NULL
- completed_at — TIMESTAMP
- opinion_content — TEXT
- opinion_files — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
official_documents
- id — BIGSERIAL
- title — VARCHAR(255)
- preferred_review_type — review_type_enum — NOT NULL
- recipient — official_doc_recipient_enum — NOT NULL
- files — JSONB — NOT NULL
- review_items — TEXT
- additional_request — TEXT
- status — official_doc_status_enum — NOT NULL
- user_id — BIGINT — NOT NULL
- lawyer_id — BIGINT
- apartment_id — BIGINT — NOT NULL
- summary — TEXT
- has_inbox_update — BOOLEAN — NOT NULL
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
orders
- id — BIGSERIAL
- order_number — UUID — NOT NULL
- legal_case_id — BIGINT — NOT NULL
- product_name — VARCHAR(255) — NOT NULL
- amount — NUMERIC(12,0) — NOT NULL
- status — order_status_enum — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
payments
- id — BIGSERIAL
- order_id — BIGINT — NOT NULL
- portone_payment_id — VARCHAR(100) — NOT NULL
- amount_paid — NUMERIC(12,0) — NOT NULL
- status — payment_status_enum — NOT NULL
- method — payment_method_enum
- pg_provider — VARCHAR(50)
- details — JSONB
- paid_at — TIMESTAMP
- cancelled_at — TIMESTAMP
- cancellation_details — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
products
- id — BIGSERIAL
- name — VARCHAR(255) — NOT NULL
- description — TEXT
- category — product_category_enum — NOT NULL
- base_price — NUMERIC(10,2) — NOT NULL
- is_variable_price — BOOLEAN — NOT NULL
- is_active — BOOLEAN — NOT NULL
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
refresh_tokens
- id — BIGSERIAL
- user_id — BIGINT — NOT NULL
- token — VARCHAR(500) — NOT NULL
- expires_at — TIMESTAMP — NOT NULL
- is_revoked — BOOLEAN — NOT NULL
- revoked_at — TIMESTAMP
- replaced_by_token — VARCHAR(500)
- user_agent — VARCHAR(255)
- ip_address — VARCHAR(50)
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
users
- id — BIGSERIAL
- email — VARCHAR(255) — NOT NULL
- username — VARCHAR(100)
- password — VARCHAR(255)
- name — VARCHAR(100) — NOT NULL
- phone — VARCHAR(30)
- profile_image_url — VARCHAR(500)
- birth_date — VARCHAR(20)
- role — user_role_enum — NOT NULL
- is_active — BOOLEAN — NOT NULL
- last_login_at — TIMESTAMP
- service_type — service_type_enum
- is_registered — BOOLEAN — NOT NULL
- terms_of_service — BOOLEAN — NOT NULL
- privacy_policy — BOOLEAN — NOT NULL
- age_verification — BOOLEAN — NOT NULL
- agreed_at — TIMESTAMP
- apartment_id — BIGINT
- building_number — VARCHAR(20)
- unit_number — VARCHAR(20)
- law_firm — VARCHAR(255)
- monthly_token_count — INT — NOT NULL
- last_token_reset_date — TIMESTAMP
- metadata — JSONB
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP
verification_codes
- id — BIGSERIAL
- phone_number — VARCHAR(20) — NOT NULL
- code — VARCHAR(6) — NOT NULL
- attempts — INT — NOT NULL
- verified — BOOLEAN — NOT NULL
- expires_at — TIMESTAMP — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
- deleted_at — TIMESTAMP