The code below works fine:
% mix ash.gen.resource Helpdesk.Support.Employee \
--default-actions read,create,update,destroy \
--uuid-primary-key id \
--attribute first_name:string:required:public \
--timestamps \
--extend postgres
However, if I create Helpdesk.Employee
instead of Helpdesk.Support.Employee
, I get the following warning:
% mix ash.gen.resource Helpdesk.Employee \
--default-actions read,create,update,destroy \
--uuid-primary-key id \
--attribute first_name:string:required:public \
--timestamps \
--extend postgres
Igniter:
Create: lib/helpdesk/employee.ex
1 | defmodule Helpdesk.Employee do
2 | use Ash.Resource, otp_app: :helpdesk, domain: Helpdesk, data_layer: AshPostgres.DataLayer
3 |
4 | postgres do
5 | table "employees"
6 | repo Helpdesk.Repo
7 | end
8 |
9 | actions do
10 | defaults [:read, :destroy, create: [:first_name], update: [:first_name]]
11 | end
12 |
13 | attributes do
14 | uuid_primary_key :id
15 |
16 | attribute :first_name, :string do
17 | allow_nil? false
18 | public? true
19 | end
20 |
21 | timestamps()
22 | end
23 | end
24 |
Igniter - Warnings:
* Domain Elixir.Helpdesk was not an `Ash.Domain`, so could not add `Helpdesk.Employee` to its resource list.
Proceed with changes? [Yn]
When I proceed anyways, it only creates employee.ex and skips out on domain code, repo, etc.