Update model

This commit is contained in:
2024-08-09 18:52:17 +02:00
parent 4c2d104f49
commit 0eab74d979
3 changed files with 94 additions and 0 deletions

View File

@@ -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"];
}
}
}