paricafe/packages/backend/src/models/entities/DriveFolder.ts
syuilo 792622aead
refactor: prefix Mi for all entities (#11719)
* wip

* wip

* wip

* wip

* Update RepositoryModule.ts

* wip

* wip

* wip

* Revert "wip"

This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
2023-08-16 17:51:28 +09:00

54 lines
1.1 KiB
TypeScript

/*
* 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 '../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;
}