| 1 | package Daje::Controller::ToolsTableObjects; | ||
| 2 | use Mojo::Base 'Mojolicious::Controller', -signatures; | ||
| 3 | use v5.42; | ||
| 4 | |||
| 5 | # NAME | ||
| 6 | # ==== | ||
| 7 | # | ||
| 8 | # Daje::Controller::ToolsTableObjects - Mojolicious Controller | ||
| 9 | # | ||
| 10 | # SYNOPSIS | ||
| 11 | # ======== | ||
| 12 | # | ||
| 13 | # | ||
| 14 | # | ||
| 15 | # DESCRIPTION | ||
| 16 | # =========== | ||
| 17 | # | ||
| 18 | # Daje::Controller::ToolsTableObjects is a Mojolicious Controller. | ||
| 19 | # | ||
| 20 | # METHODS | ||
| 21 | # ======= | ||
| 22 | # | ||
| 23 | # load_table_objects($self) | ||
| 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_table_object($self) { | ||
| 42 | |||
| 43 | $self->app->log->debug('Daje::Controller::ToolsTableObjects::load_table_objects'); | ||
| 44 | my $tools_object_tables_pkey = $self->param('tools_object_tables_pkey'); | ||
| 45 | $self->render_later; | ||
| 46 | # my ($companies_pkey, $users_pkey) = $self->jwt->companies_users_pkey( | ||
| 47 | # $self->req->headers->header('X-Token-Check') | ||
| 48 | # ); | ||
| 49 | |||
| 50 | $self->app->log->debug($self->req->headers->header('X-Token-Check')); | ||
| 51 | |||
| 52 | $self->tools_objects_tables->load_tools_objects_tables_pkey_p($tools_object_tables_pkey)->then(sub($result) { | ||
| 53 | $self->render(json => $result->{data}); | ||
| 54 | })->catch(sub($err) { | ||
| 55 | $self->render(json => { result => 0, data => $err }); | ||
| 56 | })->wait; | ||
| 57 | |||
| 58 | } | ||
| 59 | |||
| 60 | sub load_table_objects($self) { | ||
| 61 | |||
| 62 | $self->app->log->debug('Daje::Controller::ToolsTableObjects::load_table_objects'); | ||
| 63 | my $tools_objects_fkey = $self->param('tools_objects_fkey'); | ||
| 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 | |||
| 71 | $self->tools_objects_tables->load_tools_objects_tables_fkey_p($tools_objects_fkey)->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 | 1; | ||
| 79 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 80 | |||
| 81 | =head1 NAME | ||
| 82 | |||
| 83 | |||
| 84 | Daje::Controller::ToolsTableObjects - Mojolicious Controller | ||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | =head1 SYNOPSIS | ||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | =head1 DESCRIPTION | ||
| 96 | |||
| 97 | |||
| 98 | Daje::Controller::ToolsTableObjects is a Mojolicious Controller. | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | =head1 REQUIRES | ||
| 103 | |||
| 104 | L<Data::Dumper> | ||
| 105 | |||
| 106 | L<v5.42> | ||
| 107 | |||
| 108 | L<Mojo::Base> | ||
| 109 | |||
| 110 | |||
| 111 | =head1 METHODS | ||
| 112 | |||
| 113 | |||
| 114 | load_table_objects($self) | ||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | =head1 AUTHOR | ||
| 119 | |||
| 120 | |||
| 121 | janeskil1525 E<lt>janeskil1525@gmail.com | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | =head1 LICENSE | ||
| 126 | |||
| 127 | |||
| 128 | Copyright (C) janeskil1525. | ||
| 129 | |||
| 130 | This library is free software; you can redistribute it and/or modify | ||
| 131 | it under the same terms as Perl itself. | ||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | =cut | ||
| 136 |