refactor(backend): update directory structure for models
This commit is contained in:
47
packages/backend/src/models/UserMemo.ts
Normal file
47
packages/backend/src/models/UserMemo.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { id } from './util/id.js';
|
||||
import { MiUser } from './User.js';
|
||||
|
||||
@Entity('user_memo')
|
||||
@Index(['userId', 'targetUserId'], { unique: true })
|
||||
export class MiUserMemo {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of author.',
|
||||
})
|
||||
public userId: MiUser['id'];
|
||||
|
||||
@ManyToOne(type => MiUser, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: MiUser | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of target user.',
|
||||
})
|
||||
public targetUserId: MiUser['id'];
|
||||
|
||||
@ManyToOne(type => MiUser, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn()
|
||||
public targetUser: MiUser | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 2048,
|
||||
comment: 'Memo.',
|
||||
})
|
||||
public memo: string;
|
||||
}
|
Reference in New Issue
Block a user