feat quickly

This commit is contained in:
2026-01-12 00:44:57 +08:00
parent 43ca340d54
commit 1d5bc97cdd
30 changed files with 2664 additions and 140 deletions

View File

@@ -0,0 +1,101 @@
export namespace backend {
export class DatabaseConfig {
name: string;
targetPath: string;
modelPackagePath: string;
static createFrom(source: any = {}) {
return new DatabaseConfig(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.targetPath = source["targetPath"];
this.modelPackagePath = source["modelPackagePath"];
}
}
export class ProjectConfig {
name: string;
path: string;
static createFrom(source: any = {}) {
return new ProjectConfig(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.path = source["path"];
}
}
export class Settings {
theme: string;
language: string;
notifications: boolean;
autoStart: boolean;
mysqlModelPath: string;
defaultQueryPackagePath: string;
modelBasePath: string;
swaggerDir: string;
databases: DatabaseConfig[];
projects: ProjectConfig[];
static createFrom(source: any = {}) {
return new Settings(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.theme = source["theme"];
this.language = source["language"];
this.notifications = source["notifications"];
this.autoStart = source["autoStart"];
this.mysqlModelPath = source["mysqlModelPath"];
this.defaultQueryPackagePath = source["defaultQueryPackagePath"];
this.modelBasePath = source["modelBasePath"];
this.swaggerDir = source["swaggerDir"];
this.databases = this.convertValues(source["databases"], DatabaseConfig);
this.projects = this.convertValues(source["projects"], ProjectConfig);
}
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 SwaggerFile {
name: string;
path: string;
size: number;
modifiedTime: string;
static createFrom(source: any = {}) {
return new SwaggerFile(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.path = source["path"];
this.size = source["size"];
this.modifiedTime = source["modifiedTime"];
}
}
}