fix: user detail relations
This commit is contained in:
parent
e43ec5129d
commit
fabc663021
|
@ -1,13 +1,12 @@
|
||||||
import { Roles } from 'src/configurable/entities/roles.entity';
|
import { Roles } from 'src/configurable/entities/roles.entity';
|
||||||
import {
|
import {
|
||||||
Entity,
|
|
||||||
Column,
|
Column,
|
||||||
PrimaryGeneratedColumn,
|
Entity,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
OneToOne,
|
OneToOne,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { BaseModel } from '../../config/basemodel.entity';
|
import { BaseModel } from '../../config/basemodel.entity';
|
||||||
import { hashPassword } from '../../helper/hash_password';
|
|
||||||
import { Partner } from './partner.entity';
|
import { Partner } from './partner.entity';
|
||||||
import { UserDetail } from './user_detail.entity';
|
import { UserDetail } from './user_detail.entity';
|
||||||
import { COA } from '../../transaction/entities/coa.entity';
|
import { COA } from '../../transaction/entities/coa.entity';
|
||||||
|
@ -59,7 +58,8 @@ export class User extends BaseModel {
|
||||||
)
|
)
|
||||||
partner: Partner;
|
partner: Partner;
|
||||||
|
|
||||||
user_detail: UserDetail;
|
@OneToOne(() => UserDetail, (userDetail) => userDetail.user)
|
||||||
|
userDetail: UserDetail;
|
||||||
|
|
||||||
coa: COA;
|
coa: COA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import {
|
import {
|
||||||
Entity,
|
|
||||||
Column,
|
Column,
|
||||||
PrimaryGeneratedColumn,
|
Entity,
|
||||||
OneToOne,
|
|
||||||
ManyToOne,
|
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
|
OneToOne,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { accountType } from '../../helper/enum-list';
|
|
||||||
import { User } from './user.entity';
|
import { User } from './user.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
|
@ -20,7 +18,7 @@ export class UserDetail {
|
||||||
@Column()
|
@Column()
|
||||||
phone_number: string;
|
phone_number: string;
|
||||||
|
|
||||||
@OneToOne(() => User)
|
@OneToOne(() => User, (user) => user.userDetail)
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
user: User;
|
user: User;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ export class UsersService {
|
||||||
where: {
|
where: {
|
||||||
id: id,
|
id: id,
|
||||||
},
|
},
|
||||||
relations: ['roles', 'superior'],
|
relations: ['roles', 'superior', 'userDetail'],
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user