summaryrefslogtreecommitdiff
path: root/src/models/entities
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-04-29 09:11:57 +0900
committerGitHub <noreply@github.com>2019-04-29 09:11:57 +0900
commit05b8111c1906c1285c9ddde758eda45b83792244 (patch)
treeda5d58c4ae18436f739eaee9e1801c6c48056be5 /src/models/entities
parentUpdate define.ts (diff)
downloadmisskey-05b8111c1906c1285c9ddde758eda45b83792244.tar.gz
misskey-05b8111c1906c1285c9ddde758eda45b83792244.tar.bz2
misskey-05b8111c1906c1285c9ddde758eda45b83792244.zip
Pages (#4811)
* wip * wip * wip * Update page-editor.vue * wip * wip * wip * wip * wip * wip * wip * Update page-editor.variable.core.vue * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update aiscript.ts * wip * Update package.json * wip * wip * wip * wip * wip * Update page.vue * wip * wip * wip * wip * more info * wip fn * wip * wip * wip
Diffstat (limited to 'src/models/entities')
-rw-r--r--src/models/entities/page.ts105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/models/entities/page.ts b/src/models/entities/page.ts
new file mode 100644
index 0000000000..f57ca8c7c3
--- /dev/null
+++ b/src/models/entities/page.ts
@@ -0,0 +1,105 @@
+import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
+import { User } from './user';
+import { id } from '../id';
+import { DriveFile } from './drive-file';
+
+@Entity()
+@Index(['userId', 'name'], { unique: true })
+export class Page {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Index()
+ @Column('timestamp with time zone', {
+ comment: 'The created date of the Page.'
+ })
+ public createdAt: Date;
+
+ @Index()
+ @Column('timestamp with time zone', {
+ comment: 'The updated date of the Page.'
+ })
+ public updatedAt: Date;
+
+ @Column('varchar', {
+ length: 256,
+ })
+ public title: string;
+
+ @Index()
+ @Column('varchar', {
+ length: 256,
+ })
+ public name: string;
+
+ @Column('varchar', {
+ length: 256, nullable: true
+ })
+ public summary: string | null;
+
+ @Column('boolean')
+ public alignCenter: boolean;
+
+ @Column('varchar', {
+ length: 32,
+ })
+ public font: string;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The ID of author.'
+ })
+ public userId: User['id'];
+
+ @ManyToOne(type => User, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public user: User | null;
+
+ @Column({
+ ...id(),
+ nullable: true,
+ })
+ public eyeCatchingImageId: DriveFile['id'] | null;
+
+ @ManyToOne(type => DriveFile, {
+ onDelete: 'CASCADE'
+ })
+ @JoinColumn()
+ public eyeCatchingImage: DriveFile | null;
+
+ @Column('jsonb', {
+ default: []
+ })
+ public content: Record<string, any>[];
+
+ @Column('jsonb', {
+ default: []
+ })
+ public variables: Record<string, any>[];
+
+ /**
+ * public ... 公開
+ * followers ... フォロワーのみ
+ * specified ... visibleUserIds で指定したユーザーのみ
+ */
+ @Column('enum', { enum: ['public', 'followers', 'specified'] })
+ public visibility: 'public' | 'followers' | 'specified';
+
+ @Index()
+ @Column({
+ ...id(),
+ array: true, default: '{}'
+ })
+ public visibleUserIds: User['id'][];
+
+ constructor(data: Partial<Page>) {
+ if (data == null) return;
+
+ for (const [k, v] of Object.entries(data)) {
+ (this as any)[k] = v;
+ }
+ }
+}