@@ -2,6 +2,7 @@ defmodule Algora.Accounts.User do
2
2
@ moduledoc false
3
3
use Algora.Schema
4
4
5
+ alias Algora.Accounts.Follow
5
6
alias Algora.Accounts.Identity
6
7
alias Algora.Accounts.User
7
8
alias Algora.Accounts.UserMedia
@@ -37,6 +38,8 @@ defmodule Algora.Accounts.User do
37
38
field :country , :string
38
39
field :timezone , :string
39
40
field :stargazers_count , :integer , default: 0
41
+ field :followers_count , :integer , default: 0
42
+ field :following_count , :integer , default: 0
40
43
field :domain , :string
41
44
field :tech_stack , { :array , :string } , default: [ ]
42
45
field :discovery_tech_stack , { :array , :string } , default: [ ]
@@ -170,6 +173,11 @@ defmodule Algora.Accounts.User do
170
173
has_many :media , UserMedia
171
174
has_many :job_matches , Algora.Matches.JobMatch , foreign_key: :user_id
172
175
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
+
173
181
timestamps ( )
174
182
end
175
183
0 commit comments