You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
745 B
39 lines
745 B
7 years ago
|
import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from "typeorm";
|
||
|
|
||
|
import { User } from "./User";
|
||
|
|
||
|
@Entity()
|
||
|
export class SprinklersDevice {
|
||
|
@PrimaryGeneratedColumn()
|
||
|
id!: number;
|
||
|
|
||
|
@Column()
|
||
|
name: string = "";
|
||
|
|
||
|
@ManyToMany((type) => User)
|
||
|
users: User[] | undefined;
|
||
|
|
||
|
constructor(data?: Partial<SprinklersDevice>) {
|
||
|
if (data) {
|
||
|
Object.assign(this, data);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// @Entity()
|
||
|
export class UserSprinklersDevice {
|
||
|
@PrimaryGeneratedColumn()
|
||
|
id!: number;
|
||
|
|
||
|
@Column()
|
||
|
userId: string = "";
|
||
|
@Column()
|
||
|
sprinklersDeviceId: string = "";
|
||
|
|
||
|
constructor(data?: UserSprinklersDevice) {
|
||
|
if (data) {
|
||
|
Object.assign(this, data);
|
||
|
}
|
||
|
}
|
||
|
}
|