refactor: prefix Mi for all entities (misskey-dev#11719) (MisskeyIO#160)

cheery-pick from misskey-dev@792622aeadf3e36d50cddec3c64b2ff0105ea927
This commit is contained in:
まっちゃとーにゅ
2023-08-26 08:42:29 +09:00
committed by GitHub
parent 651905e08f
commit 58bbff3738
234 changed files with 2061 additions and 2061 deletions

View File

@@ -6,8 +6,8 @@
import { Column, Entity, PrimaryColumn, Index } from 'typeorm';
import { id } from '../id.js';
@Entity()
export class AbuseReportResolver {
@Entity('abuse_report_resolver')
export class MiAbuseReportResolver {
@PrimaryColumn(id())
public id: string;

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class AbuseUserReport {
@Entity('abuse_user_report')
export class MiAbuseUserReport {
@PrimaryColumn(id())
public id: string;
@@ -20,35 +20,35 @@ export class AbuseUserReport {
@Index()
@Column(id())
public targetUserId: User['id'];
public targetUserId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public targetUser: User | null;
public targetUser: MiUser | null;
@Index()
@Column(id())
public reporterId: User['id'];
public reporterId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public reporter: User | null;
public reporter: MiUser | null;
@Column({
...id(),
nullable: true,
})
public assigneeId: User['id'] | null;
public assigneeId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()
public assignee: User | null;
public assignee: MiUser | null;
@Index()
@Column('boolean', {

View File

@@ -5,11 +5,11 @@
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { App } from './App.js';
import { MiUser } from './User.js';
import { MiApp } from './App.js';
@Entity()
export class AccessToken {
@Entity('access_token')
export class MiAccessToken {
@PrimaryColumn(id())
public id: string;
@@ -44,25 +44,25 @@ export class AccessToken {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column({
...id(),
nullable: true,
})
public appId: App['id'] | null;
public appId: MiApp['id'] | null;
@ManyToOne(type => App, {
@ManyToOne(type => MiApp, {
onDelete: 'CASCADE',
})
@JoinColumn()
public app: App | null;
public app: MiApp | null;
@Column('varchar', {
length: 128,

View File

@@ -6,8 +6,8 @@
import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
import { id } from '../id.js';
@Entity()
export class Ad {
@Entity('ad')
export class MiAd {
@PrimaryColumn(id())
public id: string;
@@ -64,7 +64,7 @@ export class Ad {
default: 0, nullable: false,
})
public dayOfWeek: number;
constructor(data: Partial<Ad>) {
constructor(data: Partial<MiAd>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,10 +5,10 @@
import { Entity, Index, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class Announcement {
@Entity('announcement')
export class MiAnnouncement {
@PrimaryColumn(id())
public id: string;
@@ -91,15 +91,15 @@ export class Announcement {
...id(),
nullable: true,
})
public userId: User['id'] | null;
public userId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
constructor(data: Partial<Announcement>) {
constructor(data: Partial<MiAnnouncement>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Announcement } from './Announcement.js';
import { MiUser } from './User.js';
import { MiAnnouncement } from './Announcement.js';
@Entity()
@Entity('announcement_read')
@Index(['userId', 'announcementId'], { unique: true })
export class AnnouncementRead {
export class MiAnnouncementRead {
@PrimaryColumn(id())
public id: string;
@@ -21,21 +21,21 @@ export class AnnouncementRead {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column(id())
public announcementId: Announcement['id'];
public announcementId: MiAnnouncement['id'];
@ManyToOne(type => Announcement, {
@ManyToOne(type => MiAnnouncement, {
onDelete: 'CASCADE',
})
@JoinColumn()
public announcement: Announcement | null;
public announcement: MiAnnouncement | null;
}

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { UserList } from './UserList.js';
import { MiUser } from './User.js';
import { MiUserList } from './UserList.js';
@Entity()
export class Antenna {
@Entity('antenna')
export class MiAntenna {
@PrimaryColumn(id())
public id: string;
@@ -27,13 +27,13 @@ export class Antenna {
...id(),
comment: 'The owner ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,
@@ -48,13 +48,13 @@ export class Antenna {
...id(),
nullable: true,
})
public userListId: UserList['id'] | null;
public userListId: MiUserList['id'] | null;
@ManyToOne(type => UserList, {
@ManyToOne(type => MiUserList, {
onDelete: 'CASCADE',
})
@JoinColumn()
public userList: UserList | null;
public userList: MiUserList | null;
@Column('varchar', {
length: 1024, array: true,

View File

@@ -5,10 +5,10 @@
import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class App {
@Entity('app')
export class MiApp {
@PrimaryColumn(id())
public id: string;
@@ -24,13 +24,13 @@ export class App {
nullable: true,
comment: 'The owner ID.',
})
public userId: User['id'] | null;
public userId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'SET NULL',
nullable: true,
})
public user: User | null;
public user: MiUser | null;
@Index()
@Column('varchar', {

View File

@@ -5,11 +5,11 @@
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { App } from './App.js';
import { MiUser } from './User.js';
import { MiApp } from './App.js';
@Entity()
export class AuthSession {
@Entity('auth_session')
export class MiAuthSession {
@PrimaryColumn(id())
public id: string;
@@ -28,21 +28,21 @@ export class AuthSession {
...id(),
nullable: true,
})
public userId: User['id'] | null;
public userId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
nullable: true,
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public appId: App['id'];
public appId: MiApp['id'];
@ManyToOne(type => App, {
@ManyToOne(type => MiApp, {
onDelete: 'CASCADE',
})
@JoinColumn()
public app: App | null;
public app: MiApp | null;
}

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('blocking')
@Index(['blockerId', 'blockeeId'], { unique: true })
export class Blocking {
export class MiBlocking {
@PrimaryColumn(id())
public id: string;
@@ -24,24 +24,24 @@ export class Blocking {
...id(),
comment: 'The blockee user ID.',
})
public blockeeId: User['id'];
public blockeeId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public blockee: User | null;
public blockee: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The blocker user ID.',
})
public blockerId: User['id'];
public blockerId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public blocker: User | null;
public blocker: MiUser | null;
}

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { DriveFile } from './DriveFile.js';
import { MiUser } from './User.js';
import { MiDriveFile } from './DriveFile.js';
@Entity()
export class Channel {
@Entity('channel')
export class MiChannel {
@PrimaryColumn(id())
public id: string;
@@ -31,13 +31,13 @@ export class Channel {
nullable: true,
comment: 'The owner ID.',
})
public userId: User['id'] | null;
public userId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,
@@ -56,13 +56,13 @@ export class Channel {
nullable: true,
comment: 'The ID of banner Channel.',
})
public bannerId: DriveFile['id'] | null;
public bannerId: MiDriveFile['id'] | null;
@ManyToOne(type => DriveFile, {
@ManyToOne(type => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()
public banner: DriveFile | null;
public banner: MiDriveFile | null;
@Column('varchar', {
array: true, length: 128, default: '{}',

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Channel } from './Channel.js';
import { MiUser } from './User.js';
import { MiChannel } from './Channel.js';
@Entity()
@Entity('channel_favorite')
@Index(['userId', 'channelId'], { unique: true })
export class ChannelFavorite {
export class MiChannelFavorite {
@PrimaryColumn(id())
public id: string;
@@ -24,23 +24,23 @@ export class ChannelFavorite {
@Column({
...id(),
})
public channelId: Channel['id'];
public channelId: MiChannel['id'];
@ManyToOne(type => Channel, {
@ManyToOne(type => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()
public channel: Channel | null;
public channel: MiChannel | null;
@Index()
@Column({
...id(),
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
}

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Channel } from './Channel.js';
import { MiUser } from './User.js';
import { MiChannel } from './Channel.js';
@Entity()
@Entity('channel_following')
@Index(['followerId', 'followeeId'], { unique: true })
export class ChannelFollowing {
export class MiChannelFollowing {
@PrimaryColumn(id())
public id: string;
@@ -25,24 +25,24 @@ export class ChannelFollowing {
...id(),
comment: 'The followee channel ID.',
})
public followeeId: Channel['id'];
public followeeId: MiChannel['id'];
@ManyToOne(type => Channel, {
@ManyToOne(type => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()
public followee: Channel | null;
public followee: MiChannel | null;
@Index()
@Column({
...id(),
comment: 'The follower user ID.',
})
public followerId: User['id'];
public followerId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public follower: User | null;
public follower: MiUser | null;
}

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class Clip {
@Entity('clip')
export class MiClip {
@PrimaryColumn(id())
public id: string;
@@ -28,13 +28,13 @@ export class Clip {
...id(),
comment: 'The owner ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Clip } from './Clip.js';
import { MiUser } from './User.js';
import { MiClip } from './Clip.js';
@Entity()
@Entity('clip_favorite')
@Index(['userId', 'clipId'], { unique: true })
export class ClipFavorite {
export class MiClipFavorite {
@PrimaryColumn(id())
public id: string;
@@ -19,20 +19,20 @@ export class ClipFavorite {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public clipId: Clip['id'];
public clipId: MiClip['id'];
@ManyToOne(type => Clip, {
@ManyToOne(type => MiClip, {
onDelete: 'CASCADE',
})
@JoinColumn()
public clip: Clip | null;
public clip: MiClip | null;
}

View File

@@ -5,12 +5,12 @@
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { id } from '../id.js';
import { Note } from './Note.js';
import { Clip } from './Clip.js';
import { MiNote } from './Note.js';
import { MiClip } from './Clip.js';
@Entity()
@Entity('clip_note')
@Index(['noteId', 'clipId'], { unique: true })
export class ClipNote {
export class MiClipNote {
@PrimaryColumn(id())
public id: string;
@@ -19,24 +19,24 @@ export class ClipNote {
...id(),
comment: 'The note ID.',
})
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
@Index()
@Column({
...id(),
comment: 'The clip ID.',
})
public clipId: Clip['id'];
public clipId: MiClip['id'];
@ManyToOne(type => Clip, {
@ManyToOne(type => MiClip, {
onDelete: 'CASCADE',
})
@JoinColumn()
public clip: Clip | null;
public clip: MiClip | null;
}

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { DriveFolder } from './DriveFolder.js';
import { MiUser } from './User.js';
import { MiDriveFolder } from './DriveFolder.js';
@Entity()
@Entity('drive_file')
@Index(['userId', 'folderId', 'id'])
export class DriveFile {
export class MiDriveFile {
@PrimaryColumn(id())
public id: string;
@@ -26,13 +26,13 @@ export class DriveFile {
nullable: true,
comment: 'The owner ID.',
})
public userId: User['id'] | null;
public userId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column('varchar', {
@@ -146,13 +146,13 @@ export class DriveFile {
nullable: true,
comment: 'The parent folder ID. If null, it means the DriveFile is located in root.',
})
public folderId: DriveFolder['id'] | null;
public folderId: MiDriveFolder['id'] | null;
@ManyToOne(type => DriveFolder, {
@ManyToOne(type => MiDriveFolder, {
onDelete: 'SET NULL',
})
@JoinColumn()
public folder: DriveFolder | null;
public folder: MiDriveFolder | null;
@Index()
@Column('boolean', {

View File

@@ -5,10 +5,10 @@
import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class DriveFolder {
@Entity('drive_folder')
export class MiDriveFolder {
@PrimaryColumn(id())
public id: string;
@@ -30,13 +30,13 @@ export class DriveFolder {
nullable: true,
comment: 'The owner ID.',
})
public userId: User['id'] | null;
public userId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column({
@@ -44,11 +44,11 @@ export class DriveFolder {
nullable: true,
comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.',
})
public parentId: DriveFolder['id'] | null;
public parentId: MiDriveFolder['id'] | null;
@ManyToOne(type => DriveFolder, {
@ManyToOne(type => MiDriveFolder, {
onDelete: 'SET NULL',
})
@JoinColumn()
public parent: DriveFolder | null;
public parent: MiDriveFolder | null;
}

View File

@@ -6,9 +6,9 @@
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
import { id } from '../id.js';
@Entity()
@Entity('emoji')
@Index(['name', 'host'], { unique: true })
export class Emoji {
export class MiEmoji {
@PrimaryColumn(id())
public id: string;

View File

@@ -5,10 +5,10 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class Flash {
@Entity('flash')
export class MiFlash {
@PrimaryColumn(id())
public id: string;
@@ -39,13 +39,13 @@ export class Flash {
...id(),
comment: 'The ID of author.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 65536,

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Flash } from './Flash.js';
import { MiUser } from './User.js';
import { MiFlash } from './Flash.js';
@Entity()
@Entity('flash_like')
@Index(['userId', 'flashId'], { unique: true })
export class FlashLike {
export class MiFlashLike {
@PrimaryColumn(id())
public id: string;
@@ -19,20 +19,20 @@ export class FlashLike {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public flashId: Flash['id'];
public flashId: MiFlash['id'];
@ManyToOne(type => Flash, {
@ManyToOne(type => MiFlash, {
onDelete: 'CASCADE',
})
@JoinColumn()
public flash: Flash | null;
public flash: MiFlash | null;
}

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('follow_request')
@Index(['followerId', 'followeeId'], { unique: true })
export class FollowRequest {
export class MiFollowRequest {
@PrimaryColumn(id())
public id: string;
@@ -23,26 +23,26 @@ export class FollowRequest {
...id(),
comment: 'The followee user ID.',
})
public followeeId: User['id'];
public followeeId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public followee: User | null;
public followee: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The follower user ID.',
})
public followerId: User['id'];
public followerId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public follower: User | null;
public follower: MiUser | null;
@Column('varchar', {
length: 128, nullable: true,

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('following')
@Index(['followerId', 'followeeId'], { unique: true })
export class Following {
export class MiFollowing {
@PrimaryColumn(id())
public id: string;
@@ -24,26 +24,26 @@ export class Following {
...id(),
comment: 'The followee user ID.',
})
public followeeId: User['id'];
public followeeId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public followee: User | null;
public followee: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The follower user ID.',
})
public followerId: User['id'];
public followerId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public follower: User | null;
public follower: MiUser | null;
//#region Denormalized fields
@Index()

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { GalleryPost } from './GalleryPost.js';
import { MiUser } from './User.js';
import { MiGalleryPost } from './GalleryPost.js';
@Entity()
@Entity('gallery_like')
@Index(['userId', 'postId'], { unique: true })
export class GalleryLike {
export class MiGalleryLike {
@PrimaryColumn(id())
public id: string;
@@ -19,20 +19,20 @@ export class GalleryLike {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public postId: GalleryPost['id'];
public postId: MiGalleryPost['id'];
@ManyToOne(type => GalleryPost, {
@ManyToOne(type => MiGalleryPost, {
onDelete: 'CASCADE',
})
@JoinColumn()
public post: GalleryPost | null;
public post: MiGalleryPost | null;
}

View File

@@ -5,11 +5,11 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import type { DriveFile } from './DriveFile.js';
import { MiUser } from './User.js';
import type { MiDriveFile } from './DriveFile.js';
@Entity()
export class GalleryPost {
@Entity('gallery_post')
export class MiGalleryPost {
@PrimaryColumn(id())
public id: string;
@@ -40,20 +40,20 @@ export class GalleryPost {
...id(),
comment: 'The ID of author.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column({
...id(),
array: true, default: '{}',
})
public fileIds: DriveFile['id'][];
public fileIds: MiDriveFile['id'][];
@Index()
@Column('boolean', {
@@ -74,7 +74,7 @@ export class GalleryPost {
})
public tags: string[];
constructor(data: Partial<GalleryPost>) {
constructor(data: Partial<MiGalleryPost>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,10 +5,10 @@
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from '../id.js';
import type { User } from './User.js';
import type { MiUser } from './User.js';
@Entity()
export class Hashtag {
@Entity('hashtag')
export class MiHashtag {
@PrimaryColumn(id())
public id: string;
@@ -22,7 +22,7 @@ export class Hashtag {
...id(),
array: true,
})
public mentionedUserIds: User['id'][];
public mentionedUserIds: MiUser['id'][];
@Index()
@Column('integer', {
@@ -34,7 +34,7 @@ export class Hashtag {
...id(),
array: true,
})
public mentionedLocalUserIds: User['id'][];
public mentionedLocalUserIds: MiUser['id'][];
@Index()
@Column('integer', {
@@ -46,7 +46,7 @@ export class Hashtag {
...id(),
array: true,
})
public mentionedRemoteUserIds: User['id'][];
public mentionedRemoteUserIds: MiUser['id'][];
@Index()
@Column('integer', {
@@ -58,7 +58,7 @@ export class Hashtag {
...id(),
array: true,
})
public attachedUserIds: User['id'][];
public attachedUserIds: MiUser['id'][];
@Index()
@Column('integer', {
@@ -70,7 +70,7 @@ export class Hashtag {
...id(),
array: true,
})
public attachedLocalUserIds: User['id'][];
public attachedLocalUserIds: MiUser['id'][];
@Index()
@Column('integer', {
@@ -82,7 +82,7 @@ export class Hashtag {
...id(),
array: true,
})
public attachedRemoteUserIds: User['id'][];
public attachedRemoteUserIds: MiUser['id'][];
@Index()
@Column('integer', {

View File

@@ -6,8 +6,8 @@
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from '../id.js';
@Entity()
export class Instance {
@Entity('instance')
export class MiInstance {
@PrimaryColumn(id())
public id: string;

View File

@@ -5,10 +5,10 @@
import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class Meta {
@Entity('meta')
export class MiMeta {
@PrimaryColumn({
type: 'varchar',
length: 32,
@@ -139,13 +139,13 @@ export class Meta {
...id(),
nullable: true,
})
public proxyAccountId: User['id'] | null;
public proxyAccountId: MiUser['id'] | null;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()
public proxyAccount: User | null;
public proxyAccount: MiUser | null;
@Column('boolean', {
default: false,

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class ModerationLog {
@Entity('moderation_log')
export class MiModerationLog {
@PrimaryColumn(id())
public id: string;
@@ -19,13 +19,13 @@ export class ModerationLog {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,

View File

@@ -4,14 +4,14 @@
*/
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { mutedNoteReasons } from '@/types.js';
import { id } from '../id.js';
import { mutedNoteReasons } from '../../types.js';
import { Note } from './Note.js';
import { User } from './User.js';
import { MiNote } from './Note.js';
import { MiUser } from './User.js';
@Entity()
@Entity('muted_note')
@Index(['noteId', 'userId'], { unique: true })
export class MutedNote {
export class MiMutedNote {
@PrimaryColumn(id())
public id: string;
@@ -20,26 +20,26 @@ export class MutedNote {
...id(),
comment: 'The note ID.',
})
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
@Index()
@Column({
...id(),
comment: 'The user ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
/**
* ミュートされた理由。

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('muting')
@Index(['muterId', 'muteeId'], { unique: true })
export class Muting {
export class MiMuting {
@PrimaryColumn(id())
public id: string;
@@ -30,24 +30,24 @@ export class Muting {
...id(),
comment: 'The mutee user ID.',
})
public muteeId: User['id'];
public muteeId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public mutee: User | null;
public mutee: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The muter user ID.',
})
public muterId: User['id'];
public muterId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public muter: User | null;
public muter: MiUser | null;
}

View File

@@ -6,15 +6,15 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { noteVisibilities } from '../../types.js';
import { User } from './User.js';
import { Channel } from './Channel.js';
import type { DriveFile } from './DriveFile.js';
import { MiUser } from './User.js';
import { MiChannel } from './Channel.js';
import type { MiDriveFile } from './DriveFile.js';
@Entity()
@Entity('note')
@Index('IDX_NOTE_TAGS', { synchronize: false })
@Index('IDX_NOTE_MENTIONS', { synchronize: false })
@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false })
export class Note {
export class MiNote {
@PrimaryColumn(id())
public id: string;
@@ -30,13 +30,13 @@ export class Note {
nullable: true,
comment: 'The ID of reply target.',
})
public replyId: Note['id'] | null;
public replyId: MiNote['id'] | null;
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public reply: Note | null;
public reply: MiNote | null;
@Index()
@Column({
@@ -44,13 +44,13 @@ export class Note {
nullable: true,
comment: 'The ID of renote target.',
})
public renoteId: Note['id'] | null;
public renoteId: MiNote['id'] | null;
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public renote: Note | null;
public renote: MiNote | null;
@Index()
@Column('varchar', {
@@ -79,13 +79,13 @@ export class Note {
...id(),
comment: 'The ID of author.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('boolean', {
default: false,
@@ -144,7 +144,7 @@ export class Note {
...id(),
array: true, default: '{}',
})
public fileIds: DriveFile['id'][];
public fileIds: MiDriveFile['id'][];
@Index()
@Column('varchar', {
@@ -157,14 +157,14 @@ export class Note {
...id(),
array: true, default: '{}',
})
public visibleUserIds: User['id'][];
public visibleUserIds: MiUser['id'][];
@Index()
@Column({
...id(),
array: true, default: '{}',
})
public mentions: User['id'][];
public mentions: MiUser['id'][];
@Column('text', {
default: '[]',
@@ -193,13 +193,13 @@ export class Note {
nullable: true,
comment: 'The ID of source channel.',
})
public channelId: Channel['id'] | null;
public channelId: MiChannel['id'] | null;
@ManyToOne(type => Channel, {
@ManyToOne(type => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()
public channel: Channel | null;
public channel: MiChannel | null;
//#region Denormalized fields
@Index()
@@ -214,7 +214,7 @@ export class Note {
nullable: true,
comment: '[Denormalized]',
})
public replyUserId: User['id'] | null;
public replyUserId: MiUser['id'] | null;
@Column('varchar', {
length: 128, nullable: true,
@@ -227,7 +227,7 @@ export class Note {
nullable: true,
comment: '[Denormalized]',
})
public renoteUserId: User['id'] | null;
public renoteUserId: MiUser['id'] | null;
@Column('varchar', {
length: 128, nullable: true,
@@ -236,7 +236,7 @@ export class Note {
public renoteUserHost: string | null;
//#endregion
constructor(data: Partial<Note>) {
constructor(data: Partial<MiNote>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { Note } from './Note.js';
import { User } from './User.js';
import { MiNote } from './Note.js';
import { MiUser } from './User.js';
@Entity()
@Entity('note_favorite')
@Index(['userId', 'noteId'], { unique: true })
export class NoteFavorite {
export class MiNoteFavorite {
@PrimaryColumn(id())
public id: string;
@@ -21,20 +21,20 @@ export class NoteFavorite {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
}

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Note } from './Note.js';
import { MiUser } from './User.js';
import { MiNote } from './Note.js';
@Entity()
@Entity('note_reaction')
@Index(['userId', 'noteId'], { unique: true })
export class NoteReaction {
export class MiNoteReaction {
@PrimaryColumn(id())
public id: string;
@@ -22,23 +22,23 @@ export class NoteReaction {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user?: User | null;
public user?: MiUser | null;
@Index()
@Column(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note?: Note | null;
public note?: MiNote | null;
// TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため)

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('note_thread_muting')
@Index(['userId', 'threadId'], { unique: true })
export class NoteThreadMuting {
export class MiNoteThreadMuting {
@PrimaryColumn(id())
public id: string;
@@ -21,13 +21,13 @@ export class NoteThreadMuting {
@Column({
...id(),
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column('varchar', {

View File

@@ -5,35 +5,35 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Note } from './Note.js';
import type { Channel } from './Channel.js';
import { MiUser } from './User.js';
import { MiNote } from './Note.js';
import type { MiChannel } from './Channel.js';
@Entity()
@Entity('note_unread')
@Index(['userId', 'noteId'], { unique: true })
export class NoteUnread {
export class MiNoteUnread {
@PrimaryColumn(id())
public id: string;
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
/**
* メンションか否か
@@ -55,7 +55,7 @@ export class NoteUnread {
...id(),
comment: '[Denormalized]',
})
public noteUserId: User['id'];
public noteUserId: MiUser['id'];
@Index()
@Column({
@@ -63,6 +63,6 @@ export class NoteUnread {
nullable: true,
comment: '[Denormalized]',
})
public noteChannelId: Channel['id'] | null;
public noteChannelId: MiChannel['id'] | null;
//#endregion
}

View File

@@ -4,12 +4,12 @@
*/
import { notificationTypes } from '@/types.js';
import { User } from './User.js';
import { Note } from './Note.js';
import { FollowRequest } from './FollowRequest.js';
import { AccessToken } from './AccessToken.js';
import { MiUser } from './User.js';
import { MiNote } from './Note.js';
import { MiFollowRequest } from './FollowRequest.js';
import { MiAccessToken } from './AccessToken.js';
export type Notification = {
export type MiNotification = {
id: string;
// RedisのためDateではなくstring
@@ -18,7 +18,7 @@ export type Notification = {
/**
* 通知の送信者(initiator)
*/
notifierId: User['id'] | null;
notifierId: MiUser['id'] | null;
/**
* 通知の種類。
@@ -36,9 +36,9 @@ export type Notification = {
*/
type: typeof notificationTypes[number];
noteId: Note['id'] | null;
noteId: MiNote['id'] | null;
followRequestId: FollowRequest['id'] | null;
followRequestId: MiFollowRequest['id'] | null;
reaction: string | null;
@@ -66,5 +66,5 @@ export type Notification = {
/**
* アプリ通知のアプリ(のトークン)
*/
appAccessTokenId: AccessToken['id'] | null;
appAccessTokenId: MiAccessToken['id'] | null;
}

View File

@@ -5,12 +5,12 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { DriveFile } from './DriveFile.js';
import { MiUser } from './User.js';
import { MiDriveFile } from './DriveFile.js';
@Entity()
@Entity('page')
@Index(['userId', 'name'], { unique: true })
export class Page {
export class MiPage {
@PrimaryColumn(id())
public id: string;
@@ -60,25 +60,25 @@ export class Page {
...id(),
comment: 'The ID of author.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column({
...id(),
nullable: true,
})
public eyeCatchingImageId: DriveFile['id'] | null;
public eyeCatchingImageId: MiDriveFile['id'] | null;
@ManyToOne(type => DriveFile, {
@ManyToOne(type => MiDriveFile, {
onDelete: 'CASCADE',
})
@JoinColumn()
public eyeCatchingImage: DriveFile | null;
public eyeCatchingImage: MiDriveFile | null;
@Column('jsonb', {
default: [],
@@ -109,14 +109,14 @@ export class Page {
...id(),
array: true, default: '{}',
})
public visibleUserIds: User['id'][];
public visibleUserIds: MiUser['id'][];
@Column('integer', {
default: 0,
})
public likedCount: number;
constructor(data: Partial<Page>) {
constructor(data: Partial<MiPage>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Page } from './Page.js';
import { MiUser } from './User.js';
import { MiPage } from './Page.js';
@Entity()
@Entity('page_like')
@Index(['userId', 'pageId'], { unique: true })
export class PageLike {
export class MiPageLike {
@PrimaryColumn(id())
public id: string;
@@ -19,20 +19,20 @@ export class PageLike {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public pageId: Page['id'];
public pageId: MiPage['id'];
@ManyToOne(type => Page, {
@ManyToOne(type => MiPage, {
onDelete: 'CASCADE',
})
@JoinColumn()
public page: Page | null;
public page: MiPage | null;
}

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class PasswordResetRequest {
@Entity('password_reset_request')
export class MiPasswordResetRequest {
@PrimaryColumn(id())
public id: string;
@@ -25,11 +25,11 @@ export class PasswordResetRequest {
@Column({
...id(),
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
}

View File

@@ -6,19 +6,19 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { id } from '../id.js';
import { noteVisibilities } from '../../types.js';
import { Note } from './Note.js';
import type { User } from './User.js';
import { MiNote } from './Note.js';
import type { MiUser } from './User.js';
@Entity()
export class Poll {
@Entity('poll')
export class MiPoll {
@PrimaryColumn(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@OneToOne(type => Note, {
@OneToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
@Column('timestamp with time zone', {
nullable: true,
@@ -50,7 +50,7 @@ export class Poll {
...id(),
comment: '[Denormalized]',
})
public userId: User['id'];
public userId: MiUser['id'];
@Index()
@Column('varchar', {
@@ -60,7 +60,7 @@ export class Poll {
public userHost: string | null;
//#endregion
constructor(data: Partial<Poll>) {
constructor(data: Partial<MiPoll>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { Note } from './Note.js';
import { MiUser } from './User.js';
import { MiNote } from './Note.js';
@Entity()
@Entity('poll_vote')
@Index(['userId', 'noteId', 'choice'], { unique: true })
export class PollVote {
export class MiPollVote {
@PrimaryColumn(id())
public id: string;
@@ -22,23 +22,23 @@ export class PollVote {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
@Column('integer')
public choice: number;

View File

@@ -5,19 +5,19 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { id } from '../id.js';
import { Note } from './Note.js';
import type { User } from './User.js';
import { MiNote } from './Note.js';
import type { MiUser } from './User.js';
@Entity()
export class PromoNote {
@Entity('promo_note')
export class MiPromoNote {
@PrimaryColumn(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@OneToOne(type => Note, {
@OneToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
@Column('timestamp with time zone')
public expiresAt: Date;
@@ -28,6 +28,6 @@ export class PromoNote {
...id(),
comment: '[Denormalized]',
})
public userId: User['id'];
public userId: MiUser['id'];
//#endregion
}

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { Note } from './Note.js';
import { User } from './User.js';
import { MiNote } from './Note.js';
import { MiUser } from './User.js';
@Entity()
@Entity('promo_read')
@Index(['userId', 'noteId'], { unique: true })
export class PromoRead {
export class MiPromoRead {
@PrimaryColumn(id())
public id: string;
@@ -21,20 +21,20 @@ export class PromoRead {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
}

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn, OneToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class RegistrationTicket {
@Entity('registration_ticket')
export class MiRegistrationTicket {
@PrimaryColumn(id())
public id: string;
@@ -26,31 +26,31 @@ export class RegistrationTicket {
@Column('timestamp with time zone')
public createdAt: Date;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public createdBy: User | null;
public createdBy: MiUser | null;
@Index()
@Column({
...id(),
nullable: true,
})
public createdById: User['id'] | null;
public createdById: MiUser['id'] | null;
@OneToOne(type => User, {
@OneToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public usedBy: User | null;
public usedBy: MiUser | null;
@Index()
@Column({
...id(),
nullable: true,
})
public usedById: User['id'] | null;
public usedById: MiUser['id'] | null;
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
// TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい
@Entity()
export class RegistryItem {
@Entity('registry_item')
export class MiRegistryItem {
@PrimaryColumn(id())
public id: string;
@@ -28,13 +28,13 @@ export class RegistryItem {
...id(),
comment: 'The owner ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 1024,

View File

@@ -6,8 +6,8 @@
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
import { id } from '../id.js';
@Entity()
export class Relay {
@Entity('relay')
export class MiRelay {
@PrimaryColumn(id())
public id: string;

View File

@@ -5,11 +5,11 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('renote_muting')
@Index(['muterId', 'muteeId'], { unique: true })
export class RenoteMuting {
export class MiRenoteMuting {
@PrimaryColumn(id())
public id: string;
@@ -24,24 +24,24 @@ export class RenoteMuting {
...id(),
comment: 'The mutee user ID.',
})
public muteeId: User['id'];
public muteeId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public mutee: User | null;
public mutee: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The muter user ID.',
})
public muterId: User['id'];
public muterId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public muter: User | null;
public muter: MiUser | null;
}

View File

@@ -5,10 +5,10 @@
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from '../id.js';
import type { User } from './User.js';
import type { MiUser } from './User.js';
@Entity()
export class RetentionAggregation {
@Entity('retention_aggregation')
export class MiRetentionAggregation {
@PrimaryColumn(id())
public id: string;
@@ -33,7 +33,7 @@ export class RetentionAggregation {
...id(),
array: true,
})
public userIds: User['id'][];
public userIds: MiUser['id'][];
@Column('integer', {
})

View File

@@ -84,8 +84,8 @@ export type RoleCondFormulaValue =
CondFormulaValueNotesLessThanOrEq |
CondFormulaValueNotesMoreThanOrEq;
@Entity()
export class Role {
@Entity('role')
export class MiRole {
@PrimaryColumn(id())
public id: string;

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { Role } from './Role.js';
import { User } from './User.js';
import { MiRole } from './Role.js';
import { MiUser } from './User.js';
@Entity()
@Entity('role_assignment')
@Index(['userId', 'roleId'], { unique: true })
export class RoleAssignment {
export class MiRoleAssignment {
@PrimaryColumn(id())
public id: string;
@@ -24,26 +24,26 @@ export class RoleAssignment {
...id(),
comment: 'The user ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The role ID.',
})
public roleId: Role['id'];
public roleId: MiRole['id'];
@ManyToOne(type => Role, {
@ManyToOne(type => MiRole, {
onDelete: 'CASCADE',
})
@JoinColumn()
public role: Role | null;
public role: MiRole | null;
@Index()
@Column('timestamp with time zone', {

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class Signin {
@Entity('signin')
export class MiSignin {
@PrimaryColumn(id())
public id: string;
@@ -19,13 +19,13 @@ export class Signin {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class SwSubscription {
@Entity('sw_subscription')
export class MiSwSubscription {
@PrimaryColumn(id())
public id: string;
@@ -17,13 +17,13 @@ export class SwSubscription {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 512,

View File

@@ -5,8 +5,8 @@
import { PrimaryColumn, Entity, Column } from 'typeorm';
@Entity()
export class UsedUsername {
@Entity('used_username')
export class MiUsedUsername {
@PrimaryColumn('varchar', {
length: 128,
})
@@ -15,7 +15,7 @@ export class UsedUsername {
@Column('timestamp with time zone')
public createdAt: Date;
constructor(data: Partial<UsedUsername>) {
constructor(data: Partial<MiUsedUsername>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,11 +5,11 @@
import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
import { id } from '../id.js';
import { DriveFile } from './DriveFile.js';
import { MiDriveFile } from './DriveFile.js';
@Entity()
@Entity('user')
@Index(['usernameLower', 'host'], { unique: true })
export class User {
export class MiUser {
@PrimaryColumn(id())
public id: string;
@@ -103,26 +103,26 @@ export class User {
nullable: true,
comment: 'The ID of avatar DriveFile.',
})
public avatarId: DriveFile['id'] | null;
public avatarId: MiDriveFile['id'] | null;
@OneToOne(type => DriveFile, {
@OneToOne(type => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()
public avatar: DriveFile | null;
public avatar: MiDriveFile | null;
@Column({
...id(),
nullable: true,
comment: 'The ID of banner DriveFile.',
})
public bannerId: DriveFile['id'] | null;
public bannerId: MiDriveFile['id'] | null;
@OneToOne(type => DriveFile, {
@OneToOne(type => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()
public banner: DriveFile | null;
public banner: MiDriveFile | null;
@Column('varchar', {
length: 512, nullable: true,
@@ -244,7 +244,7 @@ export class User {
})
public token: string | null;
constructor(data: Partial<User>) {
constructor(data: Partial<MiUser>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {
@@ -253,24 +253,24 @@ export class User {
}
}
export type LocalUser = User & {
export type MiLocalUser = MiUser & {
host: null;
uri: null;
}
export type PartialLocalUser = Partial<User> & {
id: User['id'];
export type MiPartialLocalUser = Partial<MiUser> & {
id: MiUser['id'];
host: null;
uri: null;
}
export type RemoteUser = User & {
export type MiRemoteUser = MiUser & {
host: string;
uri: string;
}
export type PartialRemoteUser = Partial<User> & {
id: User['id'];
export type MiPartialRemoteUser = Partial<MiUser> & {
id: MiUser['id'];
host: string;
uri: string;
}

View File

@@ -5,11 +5,11 @@
import { Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm';
import { id } from '../id.js';
import type { User } from './User.js';
import type { MiUser } from './User.js';
@Entity()
@Entity('user_ip')
@Index(['userId', 'ip'], { unique: true })
export class UserIp {
export class MiUserIp {
@PrimaryGeneratedColumn()
public id: string;
@@ -19,7 +19,7 @@ export class UserIp {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@Column('varchar', {
length: 128,

View File

@@ -5,18 +5,18 @@
import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class UserKeypair {
@Entity('user_keypair')
export class MiUserKeypair {
@PrimaryColumn(id())
public userId: User['id'];
public userId: MiUser['id'];
@OneToOne(type => User, {
@OneToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 4096,
@@ -28,7 +28,7 @@ export class UserKeypair {
})
public privateKey: string;
constructor(data: Partial<UserKeypair>) {
constructor(data: Partial<MiUserKeypair>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class UserList {
@Entity('user_list')
export class MiUserList {
@PrimaryColumn(id())
public id: string;
@@ -22,7 +22,7 @@ export class UserList {
...id(),
comment: 'The owner ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@Index()
@Column('boolean', {
@@ -30,11 +30,11 @@ export class UserList {
})
public isPublic: boolean;
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { UserList } from './UserList.js';
import { MiUser } from './User.js';
import { MiUserList } from './UserList.js';
@Entity()
@Entity('user_list_favorite')
@Index(['userId', 'userListId'], { unique: true })
export class UserListFavorite {
export class MiUserListFavorite {
@PrimaryColumn(id())
public id: string;
@@ -19,20 +19,20 @@ export class UserListFavorite {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public userListId: UserList['id'];
public userListId: MiUserList['id'];
@ManyToOne(type => UserList, {
@ManyToOne(type => MiUserList, {
onDelete: 'CASCADE',
})
@JoinColumn()
public userList: UserList | null;
public userList: MiUserList | null;
}

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { UserList } from './UserList.js';
import { MiUser } from './User.js';
import { MiUserList } from './UserList.js';
@Entity()
@Entity('user_list_joining')
@Index(['userId', 'userListId'], { unique: true })
export class UserListJoining {
export class MiUserListJoining {
@PrimaryColumn(id())
public id: string;
@@ -24,24 +24,24 @@ export class UserListJoining {
...id(),
comment: 'The user ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The list ID.',
})
public userListId: UserList['id'];
public userListId: MiUserList['id'];
@ManyToOne(type => UserList, {
@ManyToOne(type => MiUserList, {
onDelete: 'CASCADE',
})
@JoinColumn()
public userList: UserList | null;
public userList: MiUserList | null;
}

View File

@@ -5,11 +5,11 @@
import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
@Entity('user_memo')
@Index(['userId', 'targetUserId'], { unique: true })
export class UserMemo {
export class MiUserMemo {
@PrimaryColumn(id())
public id: string;
@@ -18,26 +18,26 @@ export class UserMemo {
...id(),
comment: 'The ID of author.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index()
@Column({
...id(),
comment: 'The ID of target user.',
})
public targetUserId: User['id'];
public targetUserId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public targetUser: User | null;
public targetUser: MiUser | null;
@Column('varchar', {
length: 2048,

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { Note } from './Note.js';
import { User } from './User.js';
import { MiNote } from './Note.js';
import { MiUser } from './User.js';
@Entity()
@Entity('user_note_pining')
@Index(['userId', 'noteId'], { unique: true })
export class UserNotePining {
export class MiUserNotePining {
@PrimaryColumn(id())
public id: string;
@@ -21,20 +21,20 @@ export class UserNotePining {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column(id())
public noteId: Note['id'];
public noteId: MiNote['id'];
@ManyToOne(type => Note, {
@ManyToOne(type => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
public note: Note | null;
public note: MiNote | null;
}

View File

@@ -6,8 +6,8 @@
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
import { id } from '../id.js';
@Entity()
export class UserPending {
@Entity('user_pending')
export class MiUserPending {
@PrimaryColumn(id())
public id: string;

View File

@@ -6,21 +6,21 @@
import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
import { obsoleteNotificationTypes, ffVisibility, notificationTypes } from '@/types.js';
import { id } from '../id.js';
import { User } from './User.js';
import { Page } from './Page.js';
import { MiUser } from './User.js';
import { MiPage } from './Page.js';
// TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも
// ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン
@Entity()
export class UserProfile {
@Entity('user_profile')
export class MiUserProfile {
@PrimaryColumn(id())
public userId: User['id'];
public userId: MiUser['id'];
@OneToOne(type => User, {
@OneToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128, nullable: true,
@@ -191,13 +191,13 @@ export class UserProfile {
...id(),
nullable: true,
})
public pinnedPageId: Page['id'] | null;
public pinnedPageId: MiPage['id'] | null;
@OneToOne(type => Page, {
@OneToOne(type => MiPage, {
onDelete: 'SET NULL',
})
@JoinColumn()
public pinnedPage: Page | null;
public pinnedPage: MiPage | null;
@Index()
@Column('boolean', {
@@ -249,7 +249,7 @@ export class UserProfile {
public userHost: string | null;
//#endregion
constructor(data: Partial<UserProfile>) {
constructor(data: Partial<MiUserProfile>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,18 +5,18 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class UserPublickey {
@Entity('user_publickey')
export class MiUserPublickey {
@PrimaryColumn(id())
public userId: User['id'];
public userId: MiUser['id'];
@OneToOne(type => User, {
@OneToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Index({ unique: true })
@Column('varchar', {
@@ -29,7 +29,7 @@ export class UserPublickey {
})
public keyPem: string;
constructor(data: Partial<UserPublickey>) {
constructor(data: Partial<MiUserPublickey>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,10 +5,10 @@
import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
@Entity()
export class UserSecurityKey {
@Entity('user_security_key')
export class MiUserSecurityKey {
@PrimaryColumn('varchar', {
comment: 'Variable-length id given to navigator.credentials.get()',
})
@@ -16,13 +16,13 @@ export class UserSecurityKey {
@Index()
@Column(id())
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
comment: 'User-defined name for this key',
@@ -66,7 +66,7 @@ export class UserSecurityKey {
})
public transports?: string[];
constructor(data: Partial<UserSecurityKey>) {
constructor(data: Partial<MiUserSecurityKey>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {

View File

@@ -5,12 +5,12 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from '../id.js';
import { User } from './User.js';
import { MiUser } from './User.js';
export const webhookEventTypes = ['mention', 'unfollow', 'follow', 'followed', 'note', 'reply', 'renote', 'reaction'] as const;
@Entity()
export class Webhook {
@Entity('webhook')
export class MiWebhook {
@PrimaryColumn(id())
public id: string;
@@ -24,13 +24,13 @@ export class Webhook {
...id(),
comment: 'The owner ID.',
})
public userId: User['id'];
public userId: MiUser['id'];
@ManyToOne(type => User, {
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
public user: User | null;
public user: MiUser | null;
@Column('varchar', {
length: 128,