refactor: remove @Entity annotation from abstract entities
This commit is contained in:
parent
0ac84df449
commit
442174e462
|
@ -1,6 +1,5 @@
|
|||
import { Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class BaseEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Check, Column, Entity, ManyToOne, OneToMany } from 'typeorm';
|
||||
import { Check, Column, ManyToOne, OneToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../../base-entity';
|
||||
|
||||
export interface IMultiNamed {
|
||||
|
@ -12,7 +12,6 @@ export interface IMultiName {
|
|||
}
|
||||
|
||||
export function MultiNamed<T extends Constructor>(BaseClass: T = null, multiNameClass: string): T {
|
||||
@Entity()
|
||||
@Check(`LENGTH(nameCanonical) > 0`)
|
||||
class MixinClass extends BaseClass implements IMultiNamed {
|
||||
@Column()
|
||||
|
@ -26,7 +25,6 @@ export function MultiNamed<T extends Constructor>(BaseClass: T = null, multiName
|
|||
}
|
||||
|
||||
export function MultiName(multiNamedClass: string): Constructor {
|
||||
@Entity()
|
||||
@Check(`LENGTH(name) > 0`)
|
||||
class MultiNameClass extends BaseEntity implements IMultiName {
|
||||
@Column()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Check, Column, Entity } from 'typeorm';
|
||||
import { Check, Column } from 'typeorm';
|
||||
|
||||
export const minValue = 0;
|
||||
export const maxValue = Number.MAX_SAFE_INTEGER;
|
||||
|
@ -8,7 +8,6 @@ export interface IRateable {
|
|||
}
|
||||
|
||||
export function Rateable<T extends Constructor>(BaseClass: T = null): T {
|
||||
@Entity()
|
||||
@Check(`rating >= ${minValue} AND rating <= ${maxValue}`)
|
||||
class MixinClass extends BaseClass implements IRateable {
|
||||
@Column({ nullable: true })
|
||||
|
|
Loading…
Reference in New Issue