Add routes for daily weekly and the rest
This commit is contained in:
@@ -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