-
Notifications
You must be signed in to change notification settings - Fork 2
/
app_gen.exs
65 lines (56 loc) · 1.5 KB
/
app_gen.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import AppGen, only: [
crud_from_schema: 2,
crud_from_schema: 1,
remove_relations: 2,
pre_middleware: 1,
post_middleware: 1,
repo_contexts: 2
]
alias AppGen.Support.Accounts
[
crud_from_schema(Accounts.User,
input_args: [
create: [
relation_inputs: [
:role,
labels: [required: [:label]],
team: {[required: [:name]], [team_organization: [required: [:name]]]}
],
required: [:name, :email],
blacklist: [:email_updated_at]
],
update: [
relation_inputs: [
:role,
labels: [required: [:label]],
team: :team_organization
],
required: [:name, :email],
blacklist_non_required?: true
],
index: [
blacklist: [:email_updated_at, :name]
],
find: [
required: [:id],
blacklist_non_required?: true
]
]
),
crud_from_schema(Accounts.TeamOrganization),
repo_contexts(AppGen.Support.Repo, Accounts),
remove_relations(Accounts.Role, [:users]),
remove_relations(Accounts.Team, :users),
pre_middleware(
subscription: [MyPreMiddleware, MySubscriptionPreMiddleware],
query: [MyQueryPreMiddleware],
mutation: [MyPreMiddleware, MyMutationPreMiddleware],
all: [MyAllPreMiddleware]
),
post_middleware(
subscription: [MyPostMiddleware, MySubscriptionPostMiddleware],
query: [MyQueryPostMiddleware],
mutation: [MyPostMiddleware, MyMutationPostMiddleware],
all: [MyAllPostMiddleware]
)
]