ok-os-job-change-team / tetsuya-twitter-clone-bootcamp

哲也のtwitter clone作成リポジトリ
1 stars 0 forks source link

#72 フォロー機能を追加する #74

Closed kawabuchi-tetsuya closed 2 months ago

kawabuchi-tetsuya commented 3 months ago

今回対応した issue

残りの作業

できるようになること(ユーザ目線)

できなくなること(ユーザ目線)

その他

動作確認

https://github.com/user-attachments/assets/4210514f-80a9-4469-a8d1-affde456ada2

kawabuchi-tetsuya commented 3 months ago

https://github.com/ok-os-job-change-team/tetsuya-twitter-clone-bootcamp/pull/74/commits/ce47a6e47b79ef09f73983df6ba26b92991c7acf N+1問題を解消しました。

動作確認

https://github.com/user-attachments/assets/6e865058-40cb-4875-98dd-a636f981a1f8

ER図

erDiagram

%% 1:0or多
USERS ||--o{ POSTS : "has many / belongs to"
USERS ||--o{ FAVORITES : "has many / belongs to"
POSTS ||--o{ FAVORITES : "has many / belongs to"

 USERS {
  bigint id PK
  string email
  string password_digest
  datetime created_at
  datetime updated_at
}

POSTS {
  bigint id PK
  bigint user_id FK
  string title
  string content
  datetime created_at
  datetime updated_at
}

FAVORITES {
  bigint id PK
  bigint post_id FK
  bigint user_id FK
  datetime created_at
  datetime updated_at
}

ユーザーフォロー機能

erDiagram

%% ユーザーフォロー機能
"USERS (FOLLOWERS)" ||--o{ RELATIONSHIPS : "has many / belongs to"
"USERS (FOLLOWEES)" ||--o{ RELATIONSHIPS : "has many / belongs to"

"USERS (FOLLOWERS)" {
  bigint id PK
  string email
  string password_digest
  datetime created_at
  datetime updated_at
}

"USERS (FOLLOWEES)" {
  bigint id PK
  string email
  string password_digest
  datetime created_at
  datetime updated_at
}

RELATIONSHIPS {
  bigint id PK
  bigint follower_id FK
  bigint followee_id FK
  datetime created_at
  datetime updated_at
}
kawabuchi-tetsuya commented 3 months ago

@ochi-sho-private-study 変更しました。 https://github.com/ok-os-job-change-team/tetsuya-twitter-clone-bootcamp/pull/74/commits/3cc1533d92c6a7377ab3ac71b80e157e25f5539b

kawabuchi-tetsuya commented 3 months ago

@ochi-sho-private-study followee? メソッドを active_relationship.rbから削除しました。 https://github.com/ok-os-job-change-team/tetsuya-twitter-clone-bootcamp/pull/74/commits/b1d7d5e60f42499933337af1d02a151a3d21131c

kawabuchi-tetsuya commented 3 months ago

@ochi-sho-private-study ひとまず対応しました。 https://github.com/ok-os-job-change-team/tetsuya-twitter-clone-bootcamp/pull/74/commits/c53016707e6fd8d3f29bdc82ffac8d8fd1c3f2a4