mealpair

Tables (9)

Untitled (user_social_accounts)

  • Key (id) — uuid — Primary key — NOT NULL
  • id (user_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (provider) — text — NOT NULL
  • Field (provider_user_id) — text — NOT NULL
  • Field (created_at) — timestamptz — NOT NULL

Untitled (refresh_tokens)

  • Key (id) — uuid — Primary key — NOT NULL
  • id (user_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (token_hash) — text — NOT NULL — 갱신 시 이전 토큰 revoke 후 새 토큰 발급
  • Field2 (expires_at) — timestamptz — NOT NULL
  • Field (revoked_at) — timestamptz — 사용자가 직접 로그아웃 or POST로 재발급 요청 시 기입
  • Field (crated_at) — timestamptz — NOT NULL

Untitled (push_tokens)

  • Key (id) — uuid — Primary key — NOT NULL
  • id (user_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (platform) — text — NOT NULL — ios(APNs), android(FCM)
  • Field (push_token) — text — NOT NULL — 로그아웃 시 해당 토큰 삭제
  • Field (device_label) — text
  • Field (last_seen_at) — timestamptz — NOT NULL — 마지막으로 이 기기에서 앱을 켠 시점
  • Field (created_at) — timestamptz — NOT NULL

Untitled (pairs)

  • Key (id) — uuid — Primary key — NOT NULL
  • Field (status) — text — NOT NULL — pending, connected, ended
  • id (creator_id) — uuid — Foreign key → users.id — NOT NULL
  • id (partner_id) — uuid — Foreign key → users.id
  • Field (invite_code) — text — NOT NULL
  • Field (invite_expires_at) — timestamptz
  • Field (creator_auto_share_default) — boolean — NOT NULL — meal 생성시 share의 기본값
  • Field (creator_muted) — boolean — NOT NULL — true 시 partner 알림 안 받음
  • Field (partner_auto_share_default) — boolean — NOT NULL
  • Field (partner_muted) — boolean — NOT NULL — true 시 creator 알림 안 받음
  • Field (connected_at) — timestamptz
  • Field (ended_at) — timestamptz
  • id (ended_by_id) — uuid — Foreign key → users.id
  • Field (ended_reason) — text
  • Field (created_at) — timestamptz — NOT NULL
  • Field (updated_at) — timestamptz — NOT NULL

Untitled (meals)

  • Key (id) — uuid — Primary key — NOT NULL
  • id (user_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (status) — text — NOT NULL — analyzing -> ready / failed
  • Field (share_policy) — text — NOT NULL — auto / private_once
  • Field (meal_type) — text — NOT NULL — breakfast, lunch, dinner, snack, latenight
  • Field (recorded_at) — timestamptz — NOT NULL
  • Field (recorded_local_date) — date — NOT NULL
  • Field (photo_url) — text
  • Field (food_name) — text
  • Field (calories_kcal) — integer
  • Field (protien_g) — numeric(4, 1)
  • Field (carbs_g) — numeric(4, 1)
  • Field (fat_g) — numeric(4, 1)
  • Field (extended_nutrients) — jsonb
  • Field (note) — text
  • Field (analysis_provider) — text
  • Field (analysis_model) — text
  • Field (analysis_confidence) — smallint
  • Field (analysis_failure_reason) — text
  • Field (finalized_at) — timestamptz — AI 결과 확인하고 저장 누른 시점. 자동공유 트리거
  • Field (deleted_at) — timestamptz
  • Field (created_at) — timestamptz — NOT NULL
  • Field (updated_at) — timestamptz — NOT NULL

Untitled (meal_shares)

  • Key (id) — uuid — Primary key — NOT NULL
  • Key (meal_id) — uuid — Foreign key → Untitled.Key — NOT NULL
  • Key (pair_id) — uuid — Foreign key → Untitled.Key — NOT NULL
  • id (sender_id) — uuid — Foreign key → users.id — NOT NULL
  • id (recipient_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (status) — text — NOT NULL — queued -> pushed -> seen
  • Field (reaction_type) — text
  • Field (shared_at) — timestamptz — NOT NULL
  • Field (pushed_at) — timestamptz — FCM/APNs 푸시 성공 시점
  • Field (seen_at) — timestamptz
  • Field (created_at) — timestamptz — NOT NULL
  • Field (updated_at) — timestamptz — NOT NULL

Untitled (weights)

  • Key (id) — uuid — Primary key — NOT NULL
  • id (user_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (weight_kg) — numeric(4,1) — NOT NULL
  • Field (recorded_on) — date — NOT NULL — 하루에 한개만 유일
  • Field (created_at) — timestamptz — NOT NULL
  • Field (updated_at) — timestamptz — NOT NULL

Untitled (subscriptions)

  • Key (id) — uuid — Primary key — NOT NULL
  • id (user_id) — uuid — Foreign key → users.id — NOT NULL
  • Field (tier) — text — free / premium
  • Field (status) — text — NOT NULL — active, inactive, expired, cancelled
  • Field (provider) — text — app_store, play_store
  • Field (product_code) — text
  • Field (purchase_token) — text
  • Field (current_period_start) — timestamptz
  • Field (current_period_end) — timestamptz
  • Field (created_at) — timestampyz — NOT NULL
  • Field (updated_at) — timestamptz — NOT NULL

users

  • id — uuid — Primary key — NOT NULL
  • nickname (email) — text — NOT NULL
  • avata_url (nickname) — text — NOT NULL
  • language_code (avata_url) — text
  • time_zone (language_code) — text — NOT NULL
  • weight_unit (timezone) — text — NOT NULL
  • week_start_day (weight_unit) — text — NOT NULL — kg, 파운드 선택
  • sex (week_start_day) — smallint — NOT NULL — 몇 주차 시작
  • birth_year (sex) — text
  • height_cm (birth_year) — smallint
  • activity_level (height_cm) — numeric(4, 1)
  • goal_type (activity_level) — text — 평소 활동량
  • target_weight_kg (goal_type) — text — 체중 감량 / 벌크업 / 식습관 공유 등등
  • target_calories (target_weight_kg) — numeric(5, 2)
  • target_protien_g (target_calories) — int
  • target_carbs_g (target_protien_g) — int
  • target_fat_g (target_carbs_g) — int
  • created_at (target_fat_g) — int
  • updated_at (created_at) — timestamptz — NOT NULL
  • (updated_at) — timestamptz — NOT NULL
  • Field (deleted_at) — timestamptz — deleted시 NOT NULL