import { BaseEntity, JSONData } from '../../fsrepo/entity'

export class Upload extends BaseEntity {
    constructor(
        @BaseEntity.Serialize('id')
        public id: string,
        @BaseEntity.Serialize('filename')
        public filename: string,
        @BaseEntity.Serialize('mime')
        public mime: string,
        @BaseEntity.Serialize('date')
        public date: Date,
        @BaseEntity.Serialize('lifespan')
        public lifespan: number,
        @BaseEntity.Serialize('size')
        public size: number,
        @BaseEntity.Serialize('views')
        public views: number = 0
    ) {
        super()
    }

    static fromJSON({id, filename, mime, date, lifespan, size, views}: JSONData<Upload>): Upload {
        return new Upload(id, filename, mime, new Date(date),
                          lifespan, size, views)
    }
}

import { BaseEntity, JSONData } from '../../fsrepo/entity'

export class Upload extends BaseEntity {
    constructor(
        @BaseEntity.Serialize('id')
        public id: string,
        @BaseEntity.Serialize('filename')
        public filename: string,
        @BaseEntity.Serialize('mime')
        public mime: string,
        @BaseEntity.Serialize('date')
        public date: Date,
        @BaseEntity.Serialize('lifespan')
        public lifespan: number,
        @BaseEntity.Serialize('size')
        public size: number
    ) {
        super()
    }

    static fromJSON({id, filename, mime, date, lifespan, size}: JSONData<Upload>): Upload {
        return new Upload(id, filename, mime, new Date(date),
                          lifespan, size)
    }
}

Remove views counter from uploads
Remove views counter from uploads

It's pretty useless...any query on the old site would cause it to
increment so it was never accurate. I will set up some metric later on.
