Rework the fuck of everything

This commit is contained in:
2025-10-19 15:17:36 +02:00
parent 123b2961a2
commit e016dd7851
19 changed files with 762 additions and 155 deletions

View File

@@ -50,6 +50,40 @@ export namespace main {
return a;
}
}
export class WailsBill {
data: Bill;
success: boolean;
error: string;
static createFrom(source: any = {}) {
return new WailsBill(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data = this.convertValues(source["data"], Bill);
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 WailsBills {
data: Bill[];
success: boolean;
@@ -152,6 +186,20 @@ export namespace main {
return a;
}
}
export class WailsVoid {
success: boolean;
error: string;
static createFrom(source: any = {}) {
return new WailsVoid(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.success = source["success"];
this.error = source["error"];
}
}
}