From 46a2727ef8ecee941c9ed24e86a78d542abb2b82 Mon Sep 17 00:00:00 2001 From: Finn Date: Mon, 5 Feb 2018 14:58:55 +0000 Subject: [PATCH] Added placeholder API for user points --- lib/Pear/LocalLoop.pm | 1 + .../Controller/Api/V1/User/Points.pm | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lib/Pear/LocalLoop/Controller/Api/V1/User/Points.pm diff --git a/lib/Pear/LocalLoop.pm b/lib/Pear/LocalLoop.pm index 59e1934..5bd5e26 100644 --- a/lib/Pear/LocalLoop.pm +++ b/lib/Pear/LocalLoop.pm @@ -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'); diff --git a/lib/Pear/LocalLoop/Controller/Api/V1/User/Points.pm b/lib/Pear/LocalLoop/Controller/Api/V1/User/Points.pm new file mode 100644 index 0000000..5dc7a25 --- /dev/null +++ b/lib/Pear/LocalLoop/Controller/Api/V1/User/Points.pm @@ -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;