Added routing and placeholder for medal data
This commit is contained in:
parent
da86e52735
commit
613272f413
2 changed files with 51 additions and 0 deletions
|
@ -158,6 +158,10 @@ sub startup {
|
||||||
|
|
||||||
my $api_v1 = $api->under('/v1');
|
my $api_v1 = $api->under('/v1');
|
||||||
|
|
||||||
|
my $api_v1_user = $api_v1->under('/user');
|
||||||
|
|
||||||
|
$api_v1_user->post('/medals')->to('api-v1-user-medals#index');
|
||||||
|
|
||||||
my $api_v1_supplier = $api_v1->under('/supplier');
|
my $api_v1_supplier = $api_v1->under('/supplier');
|
||||||
|
|
||||||
$api_v1_supplier->post('/location')->to('api-v1-supplier-location#index');
|
$api_v1_supplier->post('/location')->to('api-v1-supplier-location#index');
|
||||||
|
|
47
lib/Pear/LocalLoop/Controller/Api/V1/User/Medals.pm
Normal file
47
lib/Pear/LocalLoop/Controller/Api/V1/User/Medals.pm
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
package Pear::LocalLoop::Controller::Api::V1::User::Medals;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
use Mojo::JSON qw/true false/;
|
||||||
|
|
||||||
|
sub index {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $validation = $c->validation;
|
||||||
|
$validation->input( $c->stash->{api_json} );
|
||||||
|
|
||||||
|
my $global = {
|
||||||
|
group_name => {
|
||||||
|
threshold => {
|
||||||
|
awarded => true,
|
||||||
|
awarded_at => '2017-01-02T01:00:00Z',
|
||||||
|
threshold => 1,
|
||||||
|
points => 1,
|
||||||
|
},
|
||||||
|
total => 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
my $organisation = {
|
||||||
|
org_id => {
|
||||||
|
group_name => {
|
||||||
|
threshold => {
|
||||||
|
awarded => true,
|
||||||
|
awarded_at => '2017-01-02T01:00:00Z',
|
||||||
|
threshold => 1,
|
||||||
|
points => 1,
|
||||||
|
multiplier => 1,
|
||||||
|
},
|
||||||
|
total => 1,
|
||||||
|
},
|
||||||
|
name => 'Placeholder',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return $c->render(
|
||||||
|
json => {
|
||||||
|
success => Mojo::JSON->true,
|
||||||
|
global => $global,
|
||||||
|
organisation => $organisation,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Reference in a new issue