Started on user day entry
This commit is contained in:
parent
b03b7ccc5f
commit
1598909958
6 changed files with 142 additions and 1 deletions
|
@ -1,5 +1,34 @@
|
|||
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;
|
||||
|
||||
__END__
|
||||
use Data::Dumper;
|
||||
use Mojo::JSON;
|
||||
use DateTime;
|
||||
|
|
Reference in a new issue