sphinx-relay/api/models/ts/mediaKey.ts
2020-03-25 16:17:45 -07:00

39 lines
No EOL
772 B
TypeScript

import { Table, Column, Model, DataType } from 'sequelize-typescript';
/*
Used for media uploads. When you upload a file,
also upload the symetric key encrypted for each chat member.
When they buy the file, they can retrieve the key from here.
"received" media keys are not stored here, only in Message
*/
@Table({tableName: 'sphinx_media_keys', underscored: true})
export default class MediaKey extends Model<MediaKey> {
@Column({
type: DataType.BIGINT,
primaryKey: true,
unique: true,
autoIncrement: true
})
id: number
@Column
muid: string
@Column(DataType.BIGINT)
chatId: number
@Column(DataType.BIGINT)
receiver: number
@Column
key: string
@Column(DataType.BIGINT)
messageId: number
@Column
createdAt: Date
}