<file_sep>function WalletService($resource) {
  /**
   * @name WalletService
   *
   * @description
   * A service providing wallet data.
   */

  var that = this;

  /**
   * A resource for retrieving game data.
   */
  that.WalletResource = $resource(_urlPrefixes.API + "viewWallet");


  /**
   * A convenience method for retrieving a wallet object.
   * Retrieval is done via a GET request to the /api/viewWallet endpoint.
   * @param {object} params - the query string object used for a GET request to ../games/ endpoint
   * @returns {object} WalletResource - wallet-related data
   */
  that.viewWallet = function() {
    return that.WalletResource;
  };
}

angular.module("Wallet")
  .service("WalletService", ["$resource", WalletService]);<file_sep>function WalletViewController(WalletService) {  
  var that = this;

  /* Stored wallet objects. */
  that.wallet = null;

  /**
   * Initialize the wallet list controller.
   */
  that.init = function() {
    that.wallet = WalletService.viewWallet().get();
  };
}

angular.module("Wallet")  
  .controller("WalletViewController", [
    "WalletService",
    WalletViewController
  ]);<file_sep>var gulp = require('gulp'),
    webserver = require('gulp-webserver'),
    del = require('del'),
    sass = require('gulp-sass'),
    jshint = require('gulp-jshint'),
    sourcemaps = require('gulp-sourcemaps'),
    browserify = require('browserify'),
    source = require('vinyl-source-stream'),
    buffer = require('vinyl-buffer'),
    uglify = require('gulp-uglify'),
    gutil = require('gulp-util'),
    ngAnnotate = require('browserify-ngannotate');

var CacheBuster = require('gulp-cachebust');
var cachebust = new CacheBuster();

 gulp.task('clean', function (cb) {
    del([
        'dist'
    ], cb);
});


gulp.task('bower', function() {

    var install = require("gulp-install");

    return gulp.src(['./app/bower.json'])
        .pipe(install());
});

gulp.task('sass', function(){
  return gulp.src('app/styles/app.scss')
    .pipe(sass()) // Converts Sass to CSS with gulp-sass
    .pipe(gulp.dest('dist/css/'))
});


//gulp.task('build-css', function() {
//    return gulp.src('./app/css/app.css')
//        .pipe(sourcemaps.init())
////        .pipe(sass())
//        .pipe(cachebust.resources())
////        .on('error', gutil.log)
//        .pipe(sourcemaps.write('./maps'))
//        .pipe(gulp.dest('./dist/css/'));
//});

gulp.task('jshint', function() {
    gulp.src(['./app/*.js', './app/components/**/*.js'])
        .pipe(jshint())
        .pipe(jshint.reporter('default'));
});

gulp.task('build-js', function() {
    var b = browserify({
        entries: './app/app.js',
        debug: true,
        paths: ['./app','./app/components/**'],
        transform: [ngAnnotate]
    });

    return b.bundle()
        .pipe(source('bundle.js'))
        .pipe(buffer())
        .pipe(cachebust.resources())
        .pipe(sourcemaps.init({loadMaps: true}))
        .pipe(uglify())
        .on('error', gutil.log)
        .pipe(sourcemaps.write('./'))
        .pipe(gulp.dest('./dist/js/'));
});


gulp.task('build', [ 'clean', 'sass', 'build-js'], function() {
    return gulp.src('./app/index.html')
        .pipe(cachebust.references())
        .pipe(gulp.dest('./dist'));
});


gulp.task('watch', function() {
    return gulp.watch(['./app/index.html','./app/components/**/*.html', './app/styles/*.*css', './app/**/*.js'], ['build']);
});


gulp.task('webserver', ['watch','build'], function() {
    gulp.src('.')
        .pipe(webserver({
            livereload: false,
            directoryListing: true,
            open: "http://localhost:8001/dist/index.html"
        }));
});


gulp.task('default', ['build']);<file_sep>django
djangorestservice
django-angular
google-cloud-datastore
<file_sep>module.exports = {
  entry: "./app/app.js",
  output: {
    path: "/home/tyler/workspace/CryptoWalletService/frontend/dist/js/",
    filename: "bundle.js",
    sourceMapFilename: "bundle.js.map",
  },

  watch: true,

  module: {
    rules: [
      {
        test: /\.js$/,
        enforce: "pre",
        exclude: /node_modules/,
        loader: "eslint-loader",
        options: {
          configFile: "./config/eslint.json"
        }
      },
      { test: /\.css$/, use: [ "style-loader", "css-loader" ]
      }],
    loaders: [
      { test: /\.html$/, loader: "mustache-loader" },
      { test: /\.json$/, loader: "json-loader" }]
  },

  resolve: {
    extensions: [".js"]
  }
};<file_sep>from django.http import HttpResponse
from django.shortcuts import render
from google.cloud import datastore
import json

# Create your views here.\
def view_wallet(request):

    # Make a call to Google Cloud Datastore
    datastore_client = datastore.Client(project='cryptowalletmanager')
    kind = 'WalletHistory'

    q = datastore_client.query(kind=kind, order=['-Timestamp'])
    r = q.fetch(limit=1)

    for data in r:
        wallet_entity = data
        print(data)

    wallet_summary = {}

    if wallet_entity is not None:
        wallet_summary['USD'] = wallet_entity['TotalUSD']
        wallet_summary['BTC'] = wallet_entity['TotalBTC']

        # coin_summaries = {}
        # exchange_summaries = {}
        # exchange_details = wallet_summary['ExchangeDetails']
        # for exhange_name in exchange_details.keys():
        #     e_data = exchange_details[exhange_name]
        #     e_summary = {'USD': e_data['TotalUSD'], 'BTC': e_data['TotalBTC']}
        #     exchange_summaries[exhange_name] = e_summary
        #
        #     coin_details = exchange_details

    return HttpResponse(json.dumps(wallet_summary))
<file_sep>/* Libs */
require("angular/angular");
require("angular-route/angular-route");
require("angular-resource/angular-resource");

/* Globals */
_ = require("lodash");
_urlPrefixes = {
  API: "api/",
  TEMPLATES: "static/app/"
};

/* Components */
require("./components/home/home");
require("./components/wallet/wallet");

/* App Dependencies */
angular.module("cws", [
  "Home", // this is our component
  "Wallet", // also ours
  "ngResource",
  "ngRoute"

]);

/* Config Vars */
var routesConfig = require("./routes");

/* App Config */
angular.module("cws").config(routesConfig);