mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-19 15:55:21 +01:00
b9cb6d1c10
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
46 lines
838 B
TypeScript
46 lines
838 B
TypeScript
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
|
import { User } from './user.js';
|
|
import { id } from '../id.js';
|
|
|
|
@Entity()
|
|
export class UserGroup {
|
|
@PrimaryColumn(id())
|
|
public id: string;
|
|
|
|
@Index()
|
|
@Column('timestamp with time zone', {
|
|
comment: 'The created date of the UserGroup.'
|
|
})
|
|
public createdAt: Date;
|
|
|
|
@Column('varchar', {
|
|
length: 256,
|
|
})
|
|
public name: string;
|
|
|
|
@Index()
|
|
@Column({
|
|
...id(),
|
|
comment: 'The ID of owner.'
|
|
})
|
|
public userId: User['id'];
|
|
|
|
@ManyToOne(type => User, {
|
|
onDelete: 'CASCADE'
|
|
})
|
|
@JoinColumn()
|
|
public user: User | null;
|
|
|
|
@Column('boolean', {
|
|
default: false,
|
|
})
|
|
public isPrivate: boolean;
|
|
|
|
constructor(data: Partial<UserGroup>) {
|
|
if (data == null) return;
|
|
|
|
for (const [k, v] of Object.entries(data)) {
|
|
(this as any)[k] = v;
|
|
}
|
|
}
|
|
}
|