Entidades y Realciones(Falta enrutar bien)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Entity,PrimaryColumn, Column,} from 'typeorm';
|
||||
import { Entity, PrimaryColumn, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { TipoUsuario } from './tipo_usuario.entity';
|
||||
|
||||
@Entity({ name: 'usuario' })
|
||||
export class User {
|
||||
|
||||
@PrimaryColumn({ type: 'int', length:11, nullable:false })
|
||||
@PrimaryColumn({ type: 'int', length: 11, nullable: false })
|
||||
id_usuario: number;
|
||||
|
||||
@Column({ type: 'int', nullable: false })
|
||||
@@ -27,4 +28,7 @@ export class User {
|
||||
@Column({ type: 'datetime', nullable: true })
|
||||
lastlog: Date;
|
||||
|
||||
@ManyToOne(() => TipoUsuario, tipoUsuario => tipoUsuario.users)
|
||||
@JoinColumn({ name: 'id_tipo_usuario' })
|
||||
tipoUsuario: TipoUsuario;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user