@@ -2,6 +2,7 @@ defmodule Algora.Accounts.User do
22 @ moduledoc false
33 use Algora.Schema
44
5+ alias Algora.Accounts.Follow
56 alias Algora.Accounts.Identity
67 alias Algora.Accounts.User
78 alias Algora.Accounts.UserMedia
@@ -37,6 +38,8 @@ defmodule Algora.Accounts.User do
3738 field :country , :string
3839 field :timezone , :string
3940 field :stargazers_count , :integer , default: 0
41+ field :followers_count , :integer , default: 0
42+ field :following_count , :integer , default: 0
4043 field :domain , :string
4144 field :tech_stack , { :array , :string } , default: [ ]
4245 field :discovery_tech_stack , { :array , :string } , default: [ ]
@@ -170,6 +173,11 @@ defmodule Algora.Accounts.User do
170173 has_many :media , UserMedia
171174 has_many :job_matches , Algora.Matches.JobMatch , foreign_key: :user_id
172175
176+ has_many :following_relationships , Follow , foreign_key: :follower_id
177+ has_many :following , through: [ :following_relationships , :followed ]
178+ has_many :follower_relationships , Follow , foreign_key: :followed_id
179+ has_many :followers , through: [ :follower_relationships , :follower ]
180+
173181 timestamps ( )
174182 end
175183
0 commit comments