Skip to content

Embedded struct with the same name produces same class  #54

@loeffel-io

Description

@loeffel-io

User

type User struct {
	makeless_go_model.User

	UserRoleId *iota.UserRole `gorm:"not null,index" json:"userRoleId"`
	UserRole   *UserRole      `json:"userRole"`
}
/* Do not change, this code is generated from Golang structs */


export class UserRole {
    id?: number;
    name?: string;

    static createFrom(source: any = {}) {
        return new UserRole(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.name = source["name"];
    }
}
export class Token {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    token?: string;
    note?: string;
    userId?: number;
    user?: User;
    teamId?: number;
    team?: Team;

    static createFrom(source: any = {}) {
        return new Token(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.token = source["token"];
        this.note = source["note"];
        this.userId = source["userId"];
        this.user = this.convertValues(source["user"], User);
        this.teamId = source["teamId"];
        this.team = this.convertValues(source["team"], Team);
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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 TeamInvitation {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    teamId?: number;
    team?: Team;
    teamUserId?: number;
    teamUser?: TeamUser;
    email?: string;
    expire?: Time;
    accepted?: boolean;

    static createFrom(source: any = {}) {
        return new TeamInvitation(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.teamId = source["teamId"];
        this.team = this.convertValues(source["team"], Team);
        this.teamUserId = source["teamUserId"];
        this.teamUser = this.convertValues(source["teamUser"], TeamUser);
        this.email = source["email"];
        this.expire = this.convertValues(source["expire"], Time);
        this.accepted = source["accepted"];
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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 Team {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    name?: string;
    userId?: number;
    user?: User;
    teamUsers: TeamUser[];
    teamInvitations: TeamInvitation[];
    tokens: Token[];

    static createFrom(source: any = {}) {
        return new Team(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.name = source["name"];
        this.userId = source["userId"];
        this.user = this.convertValues(source["user"], User);
        this.teamUsers = this.convertValues(source["teamUsers"], TeamUser);
        this.teamInvitations = this.convertValues(source["teamInvitations"], TeamInvitation);
        this.tokens = this.convertValues(source["tokens"], Token);
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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 TeamUser {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    teamId?: number;
    team?: Team;
    userId?: number;
    user?: User;
    role?: string;
    teamInvitations: TeamInvitation[];

    static createFrom(source: any = {}) {
        return new TeamUser(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.teamId = source["teamId"];
        this.team = this.convertValues(source["team"], Team);
        this.userId = source["userId"];
        this.user = this.convertValues(source["user"], User);
        this.role = source["role"];
        this.teamInvitations = this.convertValues(source["teamInvitations"], TeamInvitation);
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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 User {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    name?: string;
    email?: string;
    emailVerification?: EmailVerification;
    teamUsers: TeamUser[];
    tokens: Token[];

    static createFrom(source: any = {}) {
        return new User(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.name = source["name"];
        this.email = source["email"];
        this.emailVerification = this.convertValues(source["emailVerification"], EmailVerification);
        this.teamUsers = this.convertValues(source["teamUsers"], TeamUser);
        this.tokens = this.convertValues(source["tokens"], Token);
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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 EmailVerification {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    verified?: boolean;
    userId?: number;
    user?: User;

    static createFrom(source: any = {}) {
        return new EmailVerification(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.verified = source["verified"];
        this.userId = source["userId"];
        this.user = this.convertValues(source["user"], User);
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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 DeletedAt {


    static createFrom(source: any = {}) {
        return new DeletedAt(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);

    }
}
export class Time {


    static createFrom(source: any = {}) {
        return new Time(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);

    }
}
export class User {
    id: number;
    createdAt: Time;
    updatedAt: Time;
    deletedAt?: DeletedAt;
    name?: string;
    email?: string;
    emailVerification?: EmailVerification;
    teamUsers: TeamUser[];
    tokens: Token[];
    userRoleId?: number;
    userRole?: UserRole;

    static createFrom(source: any = {}) {
        return new User(source);
    }

    constructor(source: any = {}) {
        if ('string' === typeof source) source = JSON.parse(source);
        this.id = source["id"];
        this.createdAt = this.convertValues(source["createdAt"], Time);
        this.updatedAt = this.convertValues(source["updatedAt"], Time);
        this.deletedAt = this.convertValues(source["deletedAt"], DeletedAt);
        this.name = source["name"];
        this.email = source["email"];
        this.emailVerification = this.convertValues(source["emailVerification"], EmailVerification);
        this.teamUsers = this.convertValues(source["teamUsers"], TeamUser);
        this.tokens = this.convertValues(source["tokens"], Token);
        this.userRoleId = source["userRoleId"];
        this.userRole = this.convertValues(source["userRole"], UserRole);
    }

	convertValues(a: any, classs: any, asMap: boolean = false): any {
	    if (!a) {
	        return a;
	    }
	    if (a.slice) {
	        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;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions