Skip to content

Commit f1b956a

Browse files
committed
Add support for distinct sort tests
1 parent baf4e32 commit f1b956a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/support/resources/comment.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

test/support/resources/post.ex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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)))

0 commit comments

Comments
 (0)