bitcain docs

Social

Social

Trader profiles, social feeds, follows, and community features.

6 tables in this group.

trader_profiles

Public trader profiles with performance statistics for social features

ColumnTypeNullableDefault
iduuidNogen_random_uuid()
user_iduuidNo
display_namevarchar(100)Yes
biotextYes
avatar_urltextYes
total_tradesint4Yes0
winning_tradesint4Yes0
losing_tradesint4Yes0
win_ratenumericYes0.00
total_pnlnumericYes0.00
total_pnl_percentnumericYes0.00
avg_trade_duration_secondsint4Yes0
best_trade_pnlnumericYes0.00
worst_trade_pnlnumericYes0.00
max_drawdownnumericYes0.00
sharpe_rationumericYes0.00
follower_countint4Yes0
following_countint4Yes0
rankint4Yes
rank_percentilenumericYes
stats_last_updatedtimestamptzYes
created_attimestamptzNonow()
updated_attimestamptzNonow()

RLS Policies:

  • trader_profiles_public_select — SELECT for {authenticated}
  • trader_profiles_service_all — ALL for {service_role}
  • trader_profiles_user_insert — INSERT for {authenticated}
  • trader_profiles_user_update — UPDATE for {authenticated}

Indexes:

  • idx_trader_profiles_display_name
  • idx_trader_profiles_follower_count
  • idx_trader_profiles_rank
  • idx_trader_profiles_total_pnl
  • idx_trader_profiles_user_id
  • idx_trader_profiles_win_rate
  • trader_profiles_pkey
  • trader_profiles_user_id_key

user_follows

Follow relationships between traders

ColumnTypeNullableDefault
iduuidNogen_random_uuid()
follower_iduuidNo
followed_iduuidNo
created_attimestamptzNonow()

RLS Policies:

  • user_follows_delete — DELETE for {authenticated}
  • user_follows_insert — INSERT for {authenticated}
  • user_follows_select — SELECT for {authenticated}
  • user_follows_service_all — ALL for {service_role}

Indexes:

  • idx_user_follows_created_at
  • idx_user_follows_followed_id
  • idx_user_follows_follower_id
  • user_follows_pkey
  • user_follows_unique

social_feed_events

Activity feed events for social trading

ColumnTypeNullableDefault
iduuidNogen_random_uuid()
event_typefeed_event_typeNo
user_iduuidNo
titlevarchar(255)No
descriptiontextYes
metadatajsonbYes'{}'::jsonb
trade_iduuidYes
discussion_iduuidYes
visibilityprivacy_levelNo'public'::privacy_level
view_countint4Yes0
like_countint4Yes0
comment_countint4Yes0
is_flaggedboolYesfalse
is_hiddenboolYesfalse
created_attimestamptzNonow()

RLS Policies:

  • social_feed_events_delete — DELETE for {authenticated}
  • social_feed_events_insert — INSERT for {authenticated}
  • social_feed_events_select — SELECT for {authenticated}
  • social_feed_events_service_all — ALL for {service_role}
  • social_feed_events_update — UPDATE for {authenticated}

Indexes:

  • idx_social_feed_events_created_at
  • idx_social_feed_events_discussion_id
  • idx_social_feed_events_event_type
  • idx_social_feed_events_metadata_gin
  • idx_social_feed_events_public_feed
  • idx_social_feed_events_trade_id
  • idx_social_feed_events_user_id
  • idx_social_feed_events_visibility
  • social_feed_events_pkey

user_privacy_settings

Privacy controls for social trading features

ColumnTypeNullableDefault
iduuidNogen_random_uuid()
user_iduuidNo
profile_visibilityprivacy_levelNo'public'::privacy_level
show_tradesboolNotrue
show_portfolio_valueboolNofalse
show_pnlboolNotrue
allow_followersboolNotrue
anonymous_modeboolNofalse
show_in_leaderboardboolNotrue
show_trade_historyboolNofalse
created_attimestamptzNonow()
updated_attimestamptzNonow()

RLS Policies:

  • user_privacy_settings_service_all — ALL for {service_role}
  • user_privacy_settings_user_insert — INSERT for {authenticated}
  • user_privacy_settings_user_select — SELECT for {authenticated}
  • user_privacy_settings_user_update — UPDATE for {authenticated}

Indexes:

  • idx_user_privacy_settings_public
  • idx_user_privacy_settings_user_id
  • user_privacy_settings_pkey
  • user_privacy_settings_user_id_key

moderation_reports

Content moderation reports for community safety

ColumnTypeNullableDefault
iduuidNogen_random_uuid()
reporter_iduuidNo
reported_event_iduuidYes
reported_user_iduuidYes
report_typereport_typeNo
reasontextNo
statusmoderation_statusNo'pending'::moderation_status
reviewed_byuuidYes
reviewed_attimestamptzYes
review_notestextYes
action_takentextYes
created_attimestamptzNonow()
updated_attimestamptzNonow()

RLS Policies:

  • moderation_reports_insert — INSERT for {authenticated}
  • moderation_reports_reporter_select — SELECT for {authenticated}
  • moderation_reports_service_all — ALL for {service_role}

Indexes:

  • idx_moderation_reports_pending
  • idx_moderation_reports_report_type
  • idx_moderation_reports_reported_event_id
  • idx_moderation_reports_reported_user_id
  • idx_moderation_reports_reporter_id
  • idx_moderation_reports_status
  • moderation_reports_pkey

user_feedback

User feedback with semantic embeddings for similarity search and clustering

ColumnTypeNullableDefault
iduuidNogen_random_uuid()
user_iduuidYes
texttextNo
classificationtextYes
sentiment_scorefloat8Yes
priority_scoreint4Yes
embeddingvectorYes
processedboolYesfalse
archon_task_idtextYes
created_attimestamptzYesnow()
updated_attimestamptzYesnow()

RLS Policies:

  • Service role can manage all feedback — ALL for {public}
  • Users can insert own feedback — INSERT for {public}
  • Users can update own feedback — UPDATE for {public}
  • Users can view own feedback — SELECT for {public}

Indexes:

  • user_feedback_classification_idx
  • user_feedback_created_at_idx
  • user_feedback_embedding_idx
  • user_feedback_pkey
  • user_feedback_processed_idx
  • user_feedback_user_id_idx

On this page