diff --git a/server/entities/SprinklersDevice.ts b/server/entities/SprinklersDevice.ts index 42ab082..0499313 100644 --- a/server/entities/SprinklersDevice.ts +++ b/server/entities/SprinklersDevice.ts @@ -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) { diff --git a/server/entities/User.ts b/server/entities/User.ts index 4318ef1..bc2d701 100644 --- a/server/entities/User.ts +++ b/server/entities/User.ts @@ -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;