diff options
Diffstat (limited to 'packages/backend/src/models/DriveFolder.ts')
| -rw-r--r-- | packages/backend/src/models/DriveFolder.ts | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/packages/backend/src/models/DriveFolder.ts b/packages/backend/src/models/DriveFolder.ts new file mode 100644 index 0000000000..3e049136bd --- /dev/null +++ b/packages/backend/src/models/DriveFolder.ts @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('drive_folder') +export class MiDriveFolder { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the DriveFolder.', + }) + public createdAt: Date; + + @Column('varchar', { + length: 128, + comment: 'The name of the DriveFolder.', + }) + public name: string; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The owner ID.', + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.', + }) + public parentId: MiDriveFolder['id'] | null; + + @ManyToOne(type => MiDriveFolder, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public parent: MiDriveFolder | null; +} |