This commit is contained in:
syuilo 2020-03-28 18:07:41 +09:00
parent 9ea1ed8559
commit 614a1d74dd
21 changed files with 229 additions and 91 deletions

View file

@ -4,6 +4,7 @@ import { id } from '../id';
import { Note } from './note';
import { FollowRequest } from './follow-request';
import { UserGroupInvitation } from './user-group-invitation';
import { AccessToken } from './access-token';
@Entity()
export class Notification {
@ -35,11 +36,13 @@ export class Notification {
/**
* (initiator)
*/
@Index()
@Column({
...id(),
nullable: true,
comment: 'The ID of sender user of the Notification.'
})
public notifierId: User['id'];
public notifierId: User['id'] | null;
@ManyToOne(type => User, {
onDelete: 'CASCADE'
@ -59,16 +62,19 @@ export class Notification {
* receiveFollowRequest -
* followRequestAccepted -
* groupInvited -
* app -
*/
@Index()
@Column('enum', {
enum: ['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited'],
enum: ['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app'],
comment: 'The type of the Notification.'
})
public type: 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollVote' | 'receiveFollowRequest' | 'followRequestAccepted' | 'groupInvited';
public type: 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollVote' | 'receiveFollowRequest' | 'followRequestAccepted' | 'groupInvited' | 'app';
/**
*
*/
@Index()
@Column('boolean', {
default: false,
comment: 'Whether the Notification is read.'
@ -114,10 +120,52 @@ export class Notification {
@Column('varchar', {
length: 128, nullable: true
})
public reaction: string;
public reaction: string | null;
@Column('integer', {
nullable: true
})
public choice: number;
public choice: number | null;
/**
* body
*/
@Column('varchar', {
length: 2048, nullable: true
})
public customBody: string | null;
/**
* header
* ()
*/
@Column('varchar', {
length: 256, nullable: true
})
public customHeader: string | null;
/**
* icon(URL)
* ()
*/
@Column('varchar', {
length: 1024, nullable: true
})
public customIcon: string | null;
/**
* ()
*/
@Index()
@Column({
...id(),
nullable: true
})
public appAccessTokenId: AccessToken['id'] | null;
@ManyToOne(type => AccessToken, {
onDelete: 'CASCADE'
})
@JoinColumn()
public appAccessToken: AccessToken | null;
}