1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2025-01-10 20:04:31 +09:00
cherrypick/packages/backend/src/models/entities/UserGroupInvitation.ts

48 lines
1.0 KiB
TypeScript
Raw Normal View History

/*
* 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 '../id.js';
2023-08-18 17:02:13 +09:00
import { MiUser } from './User.js';
import { MiUserGroup } from './UserGroup.js';
2023-08-18 17:02:13 +09:00
@Entity('user_group_invitation')
@Index(['userId', 'userGroupId'], { unique: true })
2023-08-18 17:02:13 +09:00
export class MiUserGroupInvitation {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the UserGroupInvitation.',
})
public createdAt: Date;
@Index()
@Column({
...id(),
comment: 'The user ID.',
})
2023-08-18 17:02:13 +09:00
public userId: MiUser['id'];
2023-08-18 17:02:13 +09:00
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
2023-08-18 17:02:13 +09:00
public user: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The group ID.',
})
2023-08-18 17:02:13 +09:00
public userGroupId: MiUserGroup['id'];
2023-08-18 17:02:13 +09:00
@ManyToOne(type => MiUserGroup, {
onDelete: 'CASCADE',
})
@JoinColumn()
2023-08-18 17:02:13 +09:00
public userGroup: MiUserGroup | null;
}