c2370a1be6
* chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
55 lines
1.1 KiB
TypeScript
55 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 { User } from './User.js';
|
|
|
|
@Entity()
|
|
export class DriveFolder {
|
|
@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: User['id'] | null;
|
|
|
|
@ManyToOne(type => User, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
@JoinColumn()
|
|
public user: User | null;
|
|
|
|
@Index()
|
|
@Column({
|
|
...id(),
|
|
nullable: true,
|
|
comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.',
|
|
})
|
|
public parentId: DriveFolder['id'] | null;
|
|
|
|
@ManyToOne(type => DriveFolder, {
|
|
onDelete: 'SET NULL',
|
|
})
|
|
@JoinColumn()
|
|
public parent: DriveFolder | null;
|
|
}
|