In order to maintain a large number of entities it would be beneficial to be able to use inheritance to not have to redefine entity fields.
The following demonstrates this:
class BaseEntity {
@Field({ description: "The identifier of the entity." })
public id: string;
@Field({ description: "The time at which the entity was created." })
public createdAt: Date;
@Field({ description: "The time at which the entity was updated." })
public updatedAt: Date;
}
@ObjectType({ description: "A user" })
export User extends Model {
@Field({ description: "The name of the user." })
public name: string = "";
}
My bad. Decorating the base class with ObjectType will make this work.
Most helpful comment
My bad. Decorating the base class with ObjectType will make this work.