File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ defmodule AshPostgres.Test.Comment do
6969 "hello"
7070 end ) }
7171 end )
72+
73+ calculate ( :double_likes , :integer , expr ( ( likes || 0 ) * 2 ) )
7274 end
7375
7476 relationships do
Original file line number Diff line number Diff line change @@ -673,6 +673,18 @@ defmodule AshPostgres.Test.Post do
673673 public? ( true )
674674 end
675675
676+ has_one :most_liked_comment , AshPostgres.Test.Comment do
677+ sort ( likes: :desc )
678+ from_many? ( true )
679+ public? ( true )
680+ end
681+
682+ has_one :most_popular_comment , AshPostgres.Test.Comment do
683+ sort ( double_likes: :desc )
684+ from_many? ( true )
685+ public? ( true )
686+ end
687+
676688 has_many :comments_matching_post_title , AshPostgres.Test.Comment do
677689 public? ( true )
678690 filter ( expr ( title == parent_expr ( title ) ) )
You can’t perform that action at this time.
0 commit comments