|
@@ -1,7 +1,7 @@
|
|
|
|
|
+import { differenceInMilliseconds } from 'date-fns';
|
|
|
import {
|
|
import {
|
|
|
Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne, Index,
|
|
Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne, Index,
|
|
|
} from 'typeorm';
|
|
} from 'typeorm';
|
|
|
-import { differenceInMilliseconds } from 'date-fns';
|
|
|
|
|
import { Installation } from './installation';
|
|
import { Installation } from './installation';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -50,14 +50,9 @@ export class RelationMock {
|
|
|
@Column({ type: 'json' })
|
|
@Column({ type: 'json' })
|
|
|
permittedChannelsForEachCommand : PermittedChannelsForEachCommand
|
|
permittedChannelsForEachCommand : PermittedChannelsForEachCommand
|
|
|
|
|
|
|
|
- @CreateDateColumn()
|
|
|
|
|
|
|
+ @Column({ type: 'timestamp' })
|
|
|
expiredAtCommands: Date;
|
|
expiredAtCommands: Date;
|
|
|
|
|
|
|
|
- isExpiredCommands():boolean {
|
|
|
|
|
- const now = Date.now();
|
|
|
|
|
- return this.expiredAtCommands.getTime() < now;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
getDistanceInMillisecondsToExpiredAt(baseDate:Date):number {
|
|
getDistanceInMillisecondsToExpiredAt(baseDate:Date):number {
|
|
|
return differenceInMilliseconds(this.expiredAtCommands, baseDate);
|
|
return differenceInMilliseconds(this.expiredAtCommands, baseDate);
|
|
|
}
|
|
}
|