Lines 19-25
use Modern::Perl;
Link Here
|
19 |
|
19 |
|
20 |
use Mojo::Base 'Mojolicious::Controller'; |
20 |
use Mojo::Base 'Mojolicious::Controller'; |
21 |
|
21 |
|
22 |
use Koha::SFTP::Servers; |
22 |
use Koha::File::Transports; |
23 |
|
23 |
|
24 |
use Try::Tiny qw( catch try ); |
24 |
use Try::Tiny qw( catch try ); |
25 |
|
25 |
|
Lines 37-43
sub list {
Link Here
|
37 |
my $c = shift->openapi->valid_input or return; |
37 |
my $c = shift->openapi->valid_input or return; |
38 |
|
38 |
|
39 |
return try { |
39 |
return try { |
40 |
my $sftp_servers_set = Koha::SFTP::Servers->new; |
40 |
my $sftp_servers_set = Koha::File::Transports->new; |
41 |
my $sftp_servers = $c->objects->search($sftp_servers_set); |
41 |
my $sftp_servers = $c->objects->search($sftp_servers_set); |
42 |
return $c->render( |
42 |
return $c->render( |
43 |
status => 200, |
43 |
status => 200, |
Lines 58-64
sub get {
Link Here
|
58 |
my $c = shift->openapi->valid_input or return; |
58 |
my $c = shift->openapi->valid_input or return; |
59 |
|
59 |
|
60 |
return try { |
60 |
return try { |
61 |
my $sftp_server = Koha::SFTP::Servers->find( $c->param('sftp_server_id') ); |
61 |
my $sftp_server = Koha::File::Transports->find( $c->param('sftp_server_id') ); |
62 |
|
62 |
|
63 |
return $c->render_resource_not_found("FTP/SFTP server") |
63 |
return $c->render_resource_not_found("FTP/SFTP server") |
64 |
unless $sftp_server; |
64 |
unless $sftp_server; |
Lines 116-122
Controller method that handles updating a Koha::SFTP::Server object
Link Here
|
116 |
sub update { |
116 |
sub update { |
117 |
my $c = shift->openapi->valid_input or return; |
117 |
my $c = shift->openapi->valid_input or return; |
118 |
|
118 |
|
119 |
my $sftp_server = Koha::SFTP::Servers->find( $c->param('sftp_server_id') ); |
119 |
my $sftp_server = Koha::File::Transports->find( $c->param('sftp_server_id') ); |
120 |
|
120 |
|
121 |
return $c->render_resource_not_found("FTP/SFTP server") |
121 |
return $c->render_resource_not_found("FTP/SFTP server") |
122 |
unless $sftp_server; |
122 |
unless $sftp_server; |
Lines 153-159
Controller method that handles deleting a Koha::SFTP::Server object
Link Here
|
153 |
sub delete { |
153 |
sub delete { |
154 |
my $c = shift->openapi->valid_input or return; |
154 |
my $c = shift->openapi->valid_input or return; |
155 |
|
155 |
|
156 |
my $sftp_server = Koha::SFTP::Servers->find( $c->param('sftp_server_id') ); |
156 |
my $sftp_server = Koha::File::Transports->find( $c->param('sftp_server_id') ); |
157 |
|
157 |
|
158 |
return $c->render_resource_not_found("FTP/SFTP server") |
158 |
return $c->render_resource_not_found("FTP/SFTP server") |
159 |
unless $sftp_server; |
159 |
unless $sftp_server; |
Lines 175-181
Controller method that invokes Koha::SFTP::Server->test_conn
Link Here
|
175 |
sub test { |
175 |
sub test { |
176 |
my $c = shift->openapi->valid_input or return; |
176 |
my $c = shift->openapi->valid_input or return; |
177 |
|
177 |
|
178 |
my $sftp_server = Koha::SFTP::Servers->find( $c->param('sftp_server_id') ); |
178 |
my $sftp_server = Koha::File::Transports->find( $c->param('sftp_server_id') ); |
179 |
|
179 |
|
180 |
return $c->render_resource_not_found("FTP/SFTP server") |
180 |
return $c->render_resource_not_found("FTP/SFTP server") |
181 |
unless $sftp_server; |
181 |
unless $sftp_server; |
182 |
- |
|
|