Update model
This commit is contained in:
@@ -58,6 +58,76 @@ export namespace main {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class WailsFood1 {
|
||||
data: Food;
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsFood1(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.data = this.convertValues(source["data"], Food);
|
||||
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 settings {
|
||||
foodDaysLookback: number;
|
||||
foodAggregatedDaysLookback: number;
|
||||
foodDailyLookback: number;
|
||||
foodWeeklyLookback: number;
|
||||
foodMonthlyLookback: number;
|
||||
foodYearlyLookback: number;
|
||||
weightDaysLookback: number;
|
||||
weightAggregatedDaysLookback: number;
|
||||
weightDailyLookback: number;
|
||||
weightWeeklyLookback: number;
|
||||
weightMonthlyLookback: number;
|
||||
weightYearlyLookback: number;
|
||||
target: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new settings(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.foodDaysLookback = source["foodDaysLookback"];
|
||||
this.foodAggregatedDaysLookback = source["foodAggregatedDaysLookback"];
|
||||
this.foodDailyLookback = source["foodDailyLookback"];
|
||||
this.foodWeeklyLookback = source["foodWeeklyLookback"];
|
||||
this.foodMonthlyLookback = source["foodMonthlyLookback"];
|
||||
this.foodYearlyLookback = source["foodYearlyLookback"];
|
||||
this.weightDaysLookback = source["weightDaysLookback"];
|
||||
this.weightAggregatedDaysLookback = source["weightAggregatedDaysLookback"];
|
||||
this.weightDailyLookback = source["weightDailyLookback"];
|
||||
this.weightWeeklyLookback = source["weightWeeklyLookback"];
|
||||
this.weightMonthlyLookback = source["weightMonthlyLookback"];
|
||||
this.weightYearlyLookback = source["weightYearlyLookback"];
|
||||
this.target = source["target"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user