Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

public class Generator {

private static final String MG_TABLECLASS_INTERFACE =
"""
export interface IMgTableClass {
mg_tableclass: string;
}
""";

private static final String FILE_TS_INTERFACE =
"""
export interface IFile {
Expand Down Expand Up @@ -62,6 +69,9 @@ public void generate(Schema schema, PrintWriter writer, boolean includeHeader) {
writer.println("");
}

writer.write(MG_TABLECLASS_INTERFACE);
writer.println("");

writer.write(FILE_TS_INTERFACE);
writer.println("");

Expand All @@ -80,7 +90,7 @@ public void generate(Schema schema, PrintWriter writer, boolean includeHeader) {
schema.getName().equals(table.getSchemaName())
? table.getTableName()
: table.getSchemaName() + '_' + table.getTableName());
writer.println(String.format("export interface I%s {", tableName));
writer.println(String.format("export interface I%s extends IMgTableClass {", tableName));

for (Column column : table.getColumns()) {
if (column.getColumnType().isHeading()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export interface IMgTableClass {
mg_tableclass: string;
}

export interface IFile {
id?: string;
size?: number;
Expand All @@ -20,15 +24,15 @@ export interface IOntologyNode extends ITreeNode {
order?: number;
}

export interface ICategory {
export interface ICategory extends IMgTableClass {
name: string;
}

export interface ICategory_agg {
count: number
}

export interface IOrder {
export interface IOrder extends IMgTableClass {
orderId: string;
pet?: any;
quantity?: string;
Expand All @@ -41,7 +45,7 @@ export interface IOrder_agg {
count: number
}

export interface IPet {
export interface IPet extends IMgTableClass {
name: string;
category: any;
photoUrls?: string[];
Expand All @@ -55,7 +59,7 @@ export interface IPet_agg {
count: number
}

export interface ITag {
export interface ITag extends IMgTableClass {
order?: number;
name: string;
label?: string;
Expand All @@ -72,7 +76,7 @@ export interface ITag_agg {
count: number
}

export interface IUser {
export interface IUser extends IMgTableClass {
username: string;
firstName?: string;
lastName?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export interface IMgTableClass {
mg_tableclass: string;
}

export interface IFile {
id?: string;
size?: number;
Expand All @@ -20,7 +24,7 @@ export interface IOntologyNode extends ITreeNode {
order?: number;
}

export interface IComponent {
export interface IComponent extends IMgTableClass {
name: string;
parts?: IPart[];
}
Expand All @@ -29,7 +33,7 @@ export interface IComponent_agg {
count: number
}

export interface IPart {
export interface IPart extends IMgTableClass {
name: string;
weight?: number;
}
Expand All @@ -38,7 +42,7 @@ export interface IPart_agg {
count: number
}

export interface IProduct {
export interface IProduct extends IMgTableClass {
name: string;
components?: IComponent[];
}
Expand All @@ -47,7 +51,7 @@ export interface IProduct_agg {
count: number
}

export interface ITypeTest {
export interface ITypeTest extends IMgTableClass {
id: string;
testUuid: string;
testUuidNillable?: string;
Expand Down
Loading