This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/lib/Pear/LocalLoop/Controller/Api/User.pm
2017-04-23 17:02:01 +01:00

29 lines
556 B
Perl

package Pear::LocalLoop::Controller::Api::User;
use Mojo::Base 'Mojolicious::Controller';
use Mojo::JSON;
has error_messages => sub {
return {
day => {
is_iso_datetime => { message => 'Invalid ISO8601 Datetime', status => 400 },
},
};
};
sub post_day {
my $c = shift;
my $validation = $c->validation;
$validation->input( $c->stash->{api_json} );
$validation->optional('day')->is_iso_datetime;
return $c->api_validation_error if $validation->has_error;
$c->render( json => {
success => Mojo::JSON->true,
});
}
1;