Controller/ToolsObjects.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 36 CC 1 SCAR 6.9
CC
1
Cov
0%
load_object
2.0
load_objects
2.0
BEGIN
2.0
CRAP 2.0
1 package Daje::Controller::ToolsObjects;
2 use Mojo::Base 'Mojolicious::Controller', -signatures;
3 use v5.40;
4  
5 # NAME
6 # ====
7 #
8 # Daje::Controller::Tools - Mojolicious Plugin
9 #
10 # SYNOPSIS
11 # ========
12 #
13 #
14 #
15 # DESCRIPTION
16 # ===========
17 #
18 # Daje::Controller::Tools is a Mojolicious plugin.
19 #
20 # METHODS
21 # =======
22 #
23 # Register plugin in L<Mojolicious> application.
24 #
25 # LICENSE
26 # =======
27 #
28 # Copyright (C) janeskil1525.
29 #
30 # This library is free software; you can redistribute it and/or modify
31 # it under the same terms as Perl itself.
32 #
33 # AUTHOR
34 # ======
35 #
36 # janeskil1525 E<lt>janeskil1525@gmail.com
37 #
38  
39 use Data::Dumper;
40  
41 sub load_object ($self) {
42  
43 $self->app->log->debug('Daje::Controller::ToolsObjects::load_object');
44 $self->render_later;
45 # my ($companies_pkey, $users_pkey) = $self->jwt->companies_users_pkey(
46 # $self->req->headers->header('X-Token-Check')
47 # );
48 my $tools_objects_pkey = $self->param('tools_objects_pkey');
49  
50 # $self->app->log->debug($self->req->headers->header('X-Token-Check'));
51 # my $setting = $self->param('setting');
52 $self->tools_objects->load_tools_object_pkey_p($tools_objects_pkey)->then(sub($result) {
53 $self->app->log->debug('Daje::Controller::ToolsObjects::load_object ' . Dumper($result->{data}));
54 $self->render(json => $result->{data});
55 })->catch(sub($err) {
56 $self->app->log->error('Daje::Controller::ToolsObjects::load_object ' . $err);
57 $self->render(json => { 'result' => 0, data => $err });
58 })->wait;
59 }
60  
61 sub load_objects ($self) {
62  
63 $self->app->log->debug('Daje::Controller::ToolsObjects::load_objects');
64 $self->render_later;
65 # my ($companies_pkey, $users_pkey) = $self->jwt->companies_users_pkey(
66 # $self->req->headers->header('X-Token-Check')
67 # );
68  
69 $self->app->log->debug($self->req->headers->header('X-Token-Check'));
70 # my $setting = $self->param('setting');
71 $self->tools_objects->load_full_list_p()->then(sub($result) {
72 $self->render(json => { data => $result->{data}, result => => 1 });
73 })->catch(sub($err) {
74 $self->render(json => { 'result' => 0, data => $err });
75 })->wait;
76 }
77  
78  
79  
80 1;
81  
82 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
83  
84 =head1 NAME
85  
86  
87 Daje::Controller::Tools - Mojolicious Plugin
88  
89  
90  
91 =head1 SYNOPSIS
92  
93  
94  
95  
96  
97  
98 =head1 DESCRIPTION
99  
100  
101 Daje::Controller::Tools is a Mojolicious plugin.
102  
103  
104  
105 =head1 REQUIRES
106  
107 L<Data::Dumper>
108  
109 L<v5.40>
110  
111 L<Mojo::Base>
112  
113  
114 =head1 METHODS
115  
116  
117 Register plugin in L<Mojolicious> application.
118  
119  
120  
121 =head1 AUTHOR
122  
123  
124 janeskil1525 E<lt>janeskil1525@gmail.com
125  
126  
127  
128 =head1 LICENSE
129  
130  
131 Copyright (C) janeskil1525.
132  
133 This library is free software; you can redistribute it and/or modify
134 it under the same terms as Perl itself.
135  
136  
137  
138 =cut
139