ニジカ投稿局 https://tv.nizika.tv
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.
 
 
 
 
 

65 lines
1.2 KiB

  1. import { type VideoDetails } from '@peertube/peertube-models'
  2. import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Table, UpdatedAt } from 'sequelize-typescript'
  3. import { VideoModel } from '../video/video.js'
  4. import { AbuseModel } from './abuse.js'
  5. import { SequelizeModel } from '../shared/index.js'
  6. @Table({
  7. tableName: 'videoAbuse',
  8. indexes: [
  9. {
  10. fields: [ 'abuseId' ]
  11. },
  12. {
  13. fields: [ 'videoId' ]
  14. }
  15. ]
  16. })
  17. export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {
  18. @CreatedAt
  19. createdAt: Date
  20. @UpdatedAt
  21. updatedAt: Date
  22. @AllowNull(true)
  23. @Default(null)
  24. @Column
  25. startAt: number
  26. @AllowNull(true)
  27. @Default(null)
  28. @Column
  29. endAt: number
  30. @AllowNull(true)
  31. @Default(null)
  32. @Column(DataType.JSONB)
  33. deletedVideo: VideoDetails
  34. @ForeignKey(() => AbuseModel)
  35. @Column
  36. abuseId: number
  37. @BelongsTo(() => AbuseModel, {
  38. foreignKey: {
  39. allowNull: false
  40. },
  41. onDelete: 'cascade'
  42. })
  43. Abuse: Awaited<AbuseModel>
  44. @ForeignKey(() => VideoModel)
  45. @Column
  46. videoId: number
  47. @BelongsTo(() => VideoModel, {
  48. foreignKey: {
  49. allowNull: true
  50. },
  51. onDelete: 'set null'
  52. })
  53. Video: Awaited<VideoModel>
  54. }