Contest.ts 916 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
  2. import { ContestEntry } from "./ContestEntry";
  3. import { ContestVote } from "./ContestVote";
  4. @Entity()
  5. export class Contest {
  6. @PrimaryGeneratedColumn()
  7. id: number;
  8. @Column()
  9. startDate: Date;
  10. @Column()
  11. endDate: Date;
  12. @Column()
  13. channel: string;
  14. @Column()
  15. announceWinners: boolean;
  16. @Column()
  17. voteReaction: string;
  18. @Column({ default: 1 })
  19. maxWinners: number;
  20. @Column({ default: true })
  21. uniqueWinners: boolean;
  22. @Column({ default: false })
  23. active: boolean;
  24. // @OneToMany(type => ContestEntry, entry => entry.contest)
  25. @OneToMany("ContestEntry", "contest")
  26. entries: ContestEntry[];
  27. // @OneToMany(type => ContestVote, vote => vote.contest)
  28. @OneToMany("ContestVote", "contest")
  29. votes: ContestVote[];
  30. }