2023-08-01 17:38:53 +09:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-05-11 21:38:13 +09:00
|
|
|
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
2023-09-22 11:31:08 +09:00
|
|
|
import { id } from './util/id.js';
|
2023-08-18 17:02:13 +09:00
|
|
|
import { MiUser } from './User.js';
|
|
|
|
import { MiUserGroup } from './UserGroup.js';
|
2023-05-11 21:38:13 +09:00
|
|
|
|
2023-08-18 17:02:13 +09:00
|
|
|
@Entity('user_group_invitation')
|
2023-05-11 21:38:13 +09:00
|
|
|
@Index(['userId', 'userGroupId'], { unique: true })
|
2023-08-18 17:02:13 +09:00
|
|
|
export class MiUserGroupInvitation {
|
2023-05-11 21:38:13 +09:00
|
|
|
@PrimaryColumn(id())
|
|
|
|
public id: string;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column({
|
|
|
|
...id(),
|
|
|
|
comment: 'The user ID.',
|
|
|
|
})
|
2023-08-18 17:02:13 +09:00
|
|
|
public userId: MiUser['id'];
|
2023-05-11 21:38:13 +09:00
|
|
|
|
2023-08-18 17:02:13 +09:00
|
|
|
@ManyToOne(type => MiUser, {
|
2023-05-11 21:38:13 +09:00
|
|
|
onDelete: 'CASCADE',
|
|
|
|
})
|
|
|
|
@JoinColumn()
|
2023-08-18 17:02:13 +09:00
|
|
|
public user: MiUser | null;
|
2023-05-11 21:38:13 +09:00
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column({
|
|
|
|
...id(),
|
|
|
|
comment: 'The group ID.',
|
|
|
|
})
|
2023-08-18 17:02:13 +09:00
|
|
|
public userGroupId: MiUserGroup['id'];
|
2023-05-11 21:38:13 +09:00
|
|
|
|
2023-08-18 17:02:13 +09:00
|
|
|
@ManyToOne(type => MiUserGroup, {
|
2023-05-11 21:38:13 +09:00
|
|
|
onDelete: 'CASCADE',
|
|
|
|
})
|
|
|
|
@JoinColumn()
|
2023-08-18 17:02:13 +09:00
|
|
|
public userGroup: MiUserGroup | null;
|
2023-05-11 21:38:13 +09:00
|
|
|
}
|