order.ts 741 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import {
  2. Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne,
  3. } from 'typeorm';
  4. import { Installation } from './installation';
  5. @Entity()
  6. export class Order {
  7. @PrimaryGeneratedColumn()
  8. readonly id: number;
  9. @CreateDateColumn()
  10. readonly createdAt: Date;
  11. @UpdateDateColumn()
  12. readonly updatedAt: Date;
  13. @ManyToOne(() => Installation)
  14. readonly installation: Installation;
  15. @Column({ nullable: true, default: false })
  16. isCompleted?: boolean;
  17. @Column()
  18. growiUrl: string;
  19. @Column()
  20. tokenGtoP: string;
  21. @Column()
  22. tokenPtoG: string;
  23. isExpired():boolean {
  24. const now = Date.now();
  25. const expiredAt = this.createdAt.getTime() + 600000;
  26. return expiredAt < now;
  27. }
  28. }