Fix typeorm relations

This commit is contained in:
Alex Mikhalev 2019-07-19 23:59:43 -06:00
parent 5a90ae54e5
commit b987e49beb
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ export class SprinklersDevice implements ISprinklersDevice {
@Column()
name: string = "";
@ManyToMany(type => User)
@ManyToMany(type => User, user => user.devices)
users: User[] | undefined;
constructor(data?: Partial<SprinklersDevice>) {

View File

@ -29,7 +29,7 @@ export class User implements IUser {
@Column()
passwordHash: string = "";
@ManyToMany(type => SprinklersDevice)
@ManyToMany(type => SprinklersDevice, device => device.users)
@JoinTable({ name: "user_sprinklers_device" })
devices: SprinklersDevice[] | undefined;