line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CatalystX::Eta::Controller::AutoListPOST; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1208
|
use Moose::Role; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
requires 'list_POST'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
around list_POST => \&AutoList_around_list_POST; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub AutoList_around_list_POST { |
10
|
3
|
|
|
3
|
|
37354
|
my $orig = shift; |
11
|
3
|
|
|
|
|
9
|
my $self = shift; |
12
|
3
|
|
|
|
|
8
|
my ($c) = @_; |
13
|
|
|
|
|
|
|
|
14
|
3
|
50
|
|
|
|
13
|
my $data_from = $self->config->{data_from_body} ? 'data' : 'params'; |
15
|
|
|
|
|
|
|
|
16
|
3
|
50
|
|
|
|
215
|
$self->status_bad_request( $c, message => 'missing data' ), $c->detach unless ref $c->req->$data_from eq 'HASH'; |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
320
|
my $params = { %{ $c->req->$data_from } }; |
|
3
|
|
|
|
|
10
|
|
19
|
3
|
50
|
33
|
|
|
238
|
if ( exists $self->config->{prepare_params_for_create} |
20
|
|
|
|
|
|
|
&& ref $self->config->{prepare_params_for_create} eq 'CODE' ) { |
21
|
0
|
|
|
|
|
0
|
$params = $self->config->{prepare_params_for_create}->( $self, $c, $params ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
50
|
|
|
201
|
my $primary_column = $self->config->{primary_key_column} || 'id'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $something = $c->model( $self->config->{result} )->execute( |
27
|
|
|
|
|
|
|
$c, |
28
|
|
|
|
|
|
|
for => ( exists $c->stash->{list_post_for} ? $c->stash->{list_post_for} : 'create' ), |
29
|
|
|
|
|
|
|
with => { |
30
|
|
|
|
|
|
|
%$params, |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
( |
33
|
3
|
50
|
|
|
|
198
|
$self->config->{no_user} ? () : ( |
|
|
50
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
created_by => $c->user->id, |
36
|
|
|
|
|
|
|
user_id => $c->user->id, |
37
|
|
|
|
|
|
|
) |
38
|
|
|
|
|
|
|
), |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$self->status_created( |
44
|
|
|
|
|
|
|
$c, |
45
|
2
|
|
|
|
|
134487
|
location => $c->uri_for( $self->action_for('result'), [ @{ $c->req->captures }, $something->$primary_column ] ) |
|
2
|
|
|
|
|
522
|
|
46
|
|
|
|
|
|
|
->as_string, |
47
|
|
|
|
|
|
|
entity => { |
48
|
|
|
|
|
|
|
$primary_column => $something->$primary_column |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
10314
|
$self->$orig( @_, $something ); |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
16
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|