Add routes for daily weekly and the rest
This commit is contained in:
8
frontend/wailsjs/go/main/App.d.ts
vendored
8
frontend/wailsjs/go/main/App.d.ts
vendored
@@ -4,12 +4,20 @@ import {main} from '../models';
|
||||
|
||||
export function CreateFood(arg1:main.Food):Promise<main.WailsFood1>;
|
||||
|
||||
export function GetDailyFood():Promise<main.WailsAggregateFood>;
|
||||
|
||||
export function GetFood():Promise<main.WailsFood>;
|
||||
|
||||
export function GetLastPer100(arg1:string):Promise<main.WailsPer100>;
|
||||
|
||||
export function GetMonthlyFood():Promise<main.WailsAggregateFood>;
|
||||
|
||||
export function GetSettings():Promise<main.settings>;
|
||||
|
||||
export function GetWeeklyFood():Promise<main.WailsAggregateFood>;
|
||||
|
||||
export function GetYearlyFood():Promise<main.WailsAggregateFood>;
|
||||
|
||||
export function SetSetting(arg1:string,arg2:number):Promise<main.WailsGenericAck>;
|
||||
|
||||
export function UpdateFood(arg1:main.Food):Promise<main.WailsFood1>;
|
||||
|
||||
@@ -6,6 +6,10 @@ export function CreateFood(arg1) {
|
||||
return window['go']['main']['App']['CreateFood'](arg1);
|
||||
}
|
||||
|
||||
export function GetDailyFood() {
|
||||
return window['go']['main']['App']['GetDailyFood']();
|
||||
}
|
||||
|
||||
export function GetFood() {
|
||||
return window['go']['main']['App']['GetFood']();
|
||||
}
|
||||
@@ -14,10 +18,22 @@ export function GetLastPer100(arg1) {
|
||||
return window['go']['main']['App']['GetLastPer100'](arg1);
|
||||
}
|
||||
|
||||
export function GetMonthlyFood() {
|
||||
return window['go']['main']['App']['GetMonthlyFood']();
|
||||
}
|
||||
|
||||
export function GetSettings() {
|
||||
return window['go']['main']['App']['GetSettings']();
|
||||
}
|
||||
|
||||
export function GetWeeklyFood() {
|
||||
return window['go']['main']['App']['GetWeeklyFood']();
|
||||
}
|
||||
|
||||
export function GetYearlyFood() {
|
||||
return window['go']['main']['App']['GetYearlyFood']();
|
||||
}
|
||||
|
||||
export function SetSetting(arg1, arg2) {
|
||||
return window['go']['main']['App']['SetSetting'](arg1, arg2);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
export namespace main {
|
||||
|
||||
export class AggregatedFood {
|
||||
period: string;
|
||||
amount: number;
|
||||
avgPer100: number;
|
||||
energy: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AggregatedFood(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.period = source["period"];
|
||||
this.amount = source["amount"];
|
||||
this.avgPer100 = source["avgPer100"];
|
||||
this.energy = source["energy"];
|
||||
}
|
||||
}
|
||||
export class Food {
|
||||
rowid: number;
|
||||
date: string;
|
||||
@@ -24,6 +42,40 @@ export namespace main {
|
||||
this.energy = source["energy"];
|
||||
}
|
||||
}
|
||||
export class WailsAggregateFood {
|
||||
data: AggregatedFood[];
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsAggregateFood(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.data = this.convertValues(source["data"], AggregatedFood);
|
||||
this.success = source["success"];
|
||||
this.error = source["error"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class WailsFood {
|
||||
data: Food[];
|
||||
success: boolean;
|
||||
@@ -136,6 +188,7 @@ export namespace main {
|
||||
weightMonthlyLookback: number;
|
||||
weightYearlyLookback: number;
|
||||
target: number;
|
||||
limit: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new settings(source);
|
||||
@@ -156,6 +209,7 @@ export namespace main {
|
||||
this.weightMonthlyLookback = source["weightMonthlyLookback"];
|
||||
this.weightYearlyLookback = source["weightYearlyLookback"];
|
||||
this.target = source["target"];
|
||||
this.limit = source["limit"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user