mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-19 15:55:21 +01:00
3cb0cc7989
Resolve #10097
41 lines
803 B
TypeScript
41 lines
803 B
TypeScript
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
|
import { id } from '../id.js';
|
|
import { User } from './User.js';
|
|
import { Channel } from './Channel.js';
|
|
|
|
@Entity()
|
|
@Index(['userId', 'channelId'], { unique: true })
|
|
export class ChannelFavorite {
|
|
@PrimaryColumn(id())
|
|
public id: string;
|
|
|
|
@Index()
|
|
@Column('timestamp with time zone', {
|
|
comment: 'The created date of the ChannelFavorite.',
|
|
})
|
|
public createdAt: Date;
|
|
|
|
@Index()
|
|
@Column({
|
|
...id(),
|
|
})
|
|
public channelId: Channel['id'];
|
|
|
|
@ManyToOne(type => Channel, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
@JoinColumn()
|
|
public channel: Channel | null;
|
|
|
|
@Index()
|
|
@Column({
|
|
...id(),
|
|
})
|
|
public userId: User['id'];
|
|
|
|
@ManyToOne(type => User, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
@JoinColumn()
|
|
public user: User | null;
|
|
}
|