]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/video/video-views.ts
Add downloadingEnabled property to video model
[github/Chocobozzz/PeerTube.git] / server / models / video / video-views.ts
CommitLineData
6b616860
C
1import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Table } from 'sequelize-typescript'
2import { VideoModel } from './video'
3import * as Sequelize from 'sequelize'
4
5@Table({
6 tableName: 'videoView',
7 indexes: [
8 {
9 fields: [ 'videoId' ]
0926af7a
C
10 },
11 {
12 fields: [ 'startDate' ]
6b616860
C
13 }
14 ]
15})
16export class VideoViewModel extends Model<VideoViewModel> {
17 @CreatedAt
18 createdAt: Date
19
20 @AllowNull(false)
21 @Column(Sequelize.DATE)
22 startDate: Date
23
24 @AllowNull(false)
25 @Column(Sequelize.DATE)
26 endDate: Date
27
28 @AllowNull(false)
29 @Column
30 views: number
31
32 @ForeignKey(() => VideoModel)
33 @Column
34 videoId: number
35
36 @BelongsTo(() => VideoModel, {
37 foreignKey: {
38 allowNull: false
39 },
40 onDelete: 'CASCADE'
41 })
42 Video: VideoModel
43
44}