1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2025-01-10 11:53:11 +09:00
cherrypick/packages/backend/src/models/UserGroupInvitation.ts
caipira113 26bd0b086a
fix
2023-10-20 04:05:11 +09:00

43 lines
928 B
TypeScript

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