Controller/ToolsObjectViews.pm untested

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