2023-07-27 05:31:52 +00:00
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 05:31:52 +00:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-01-05 04:59:48 +00:00
|
|
|
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
2023-09-20 02:33:36 +00:00
|
|
|
import { id } from './util/id.js';
|
2023-08-16 08:51:28 +00:00
|
|
|
import { MiUser } from './User.js';
|
2023-01-05 04:59:48 +00:00
|
|
|
|
2024-10-05 05:37:52 +00:00
|
|
|
export const flashVisibility = ['public', 'private'] as const;
|
|
|
|
export type FlashVisibility = typeof flashVisibility[number];
|
|
|
|
|
2023-08-16 08:51:28 +00:00
|
|
|
@Entity('flash')
|
|
|
|
export class MiFlash {
|
2023-01-05 04:59:48 +00:00
|
|
|
@PrimaryColumn(id())
|
|
|
|
public id: string;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column('timestamp with time zone', {
|
|
|
|
comment: 'The updated date of the Flash.',
|
|
|
|
})
|
|
|
|
public updatedAt: Date;
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 256,
|
|
|
|
})
|
|
|
|
public title: string;
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 1024,
|
|
|
|
})
|
|
|
|
public summary: string;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column({
|
|
|
|
...id(),
|
|
|
|
comment: 'The ID of author.',
|
|
|
|
})
|
2023-08-16 08:51:28 +00:00
|
|
|
public userId: MiUser['id'];
|
2023-01-05 04:59:48 +00:00
|
|
|
|
2023-08-16 08:51:28 +00:00
|
|
|
@ManyToOne(type => MiUser, {
|
2023-01-05 04:59:48 +00:00
|
|
|
onDelete: 'CASCADE',
|
|
|
|
})
|
|
|
|
@JoinColumn()
|
2023-08-16 08:51:28 +00:00
|
|
|
public user: MiUser | null;
|
2023-01-05 04:59:48 +00:00
|
|
|
|
|
|
|
@Column('varchar', {
|
2023-03-10 05:53:56 +00:00
|
|
|
length: 65536,
|
2023-01-05 04:59:48 +00:00
|
|
|
})
|
|
|
|
public script: string;
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 256, array: true, default: '{}',
|
|
|
|
})
|
|
|
|
public permissions: string[];
|
|
|
|
|
|
|
|
@Column('integer', {
|
|
|
|
default: 0,
|
|
|
|
})
|
|
|
|
public likedCount: number;
|
2023-08-21 11:23:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* public ... 公開
|
|
|
|
* private ... プロフィールには表示しない
|
|
|
|
*/
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 512, default: 'public',
|
|
|
|
})
|
2024-10-05 05:37:52 +00:00
|
|
|
public visibility: FlashVisibility;
|
2023-01-05 04:59:48 +00:00
|
|
|
}
|