How can add an action in Mixin?

Hi sorry, this is my Mixin to create version for my records, how can add an action inside it?
defmodule MishkaCms.Runtime.Resources.Mixins.PagePaperTrailMixin do
def postgres do
quote do
postgres do
table "page_versions"
repo MishkaCms.Repo

references do
reference :version_source, on_delete: :delete
end
end
end
end
end
defmodule MishkaCms.Runtime.Resources.Mixins.PagePaperTrailMixin do
def postgres do
quote do
postgres do
table "page_versions"
repo MishkaCms.Repo

references do
reference :version_source, on_delete: :delete
end
end
end
end
end
The action i want to add
read :get_any do
get? true
multitenancy :bypass
end
read :get_any do
get? true
multitenancy :bypass
end
Thank you in advance
Solution:
yes, that should work
Jump to solution
2 Replies
Shahryar
ShahryarOP•2mo ago
is it like this? as easy like it? :thinkies: 😂
defmodule MishkaCms.Runtime.Resources.Mixins.PagePaperTrailMixin do
def postgres do
quote do
postgres do
table "page_versions"
repo MishkaCms.Repo

references do
reference :version_source, on_delete: :delete
end
end

actions do
read :get_any do
get? true
multitenancy :bypass
end
end
end
end
end
defmodule MishkaCms.Runtime.Resources.Mixins.PagePaperTrailMixin do
def postgres do
quote do
postgres do
table "page_versions"
repo MishkaCms.Repo

references do
reference :version_source, on_delete: :delete
end
end

actions do
read :get_any do
get? true
multitenancy :bypass
end
end
end
end
end
or am i wrong?!
Solution
ZachDaniel
ZachDaniel•2mo ago
yes, that should work

Did you find this page helpful?