Merge pull request #101 from Pear-Trading/finn/medals

Added placeholder API for user points
This commit is contained in:
Finn 2018-02-08 12:17:12 +00:00 committed by GitHub
commit 480c8ed78f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View File

@ -161,6 +161,7 @@ sub startup {
my $api_v1_user = $api_v1->under('/user');
$api_v1_user->post('/medals')->to('api-v1-user-medals#index');
$api_v1_user->post('/points')->to('api-v1-user-points#index');
my $api_v1_supplier = $api_v1->under('/supplier');

View File

@ -0,0 +1,39 @@
package Pear::LocalLoop::Controller::Api::V1::User::Points;
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} );
# Placeholder data
my $snippets_placeholder = {
points_total => 1,
point_last => 1,
trans_count => 1,
avg_multi => 1,
};
my $widget_line_placeholder = { labels => [], data => [] };
my $widget_progress_placeholder = {
this_week => 1,
last_week => 1,
max => 1,
sum => 1,
count => 1,
};
return $c->render(
json => {
success => Mojo::JSON->true,
snippets => $snippets_placeholder,
widget_line => $widget_line_placeholder,
widget_progress => $widget_progress_placeholder,
}
);
}
1;