diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-08-13 20:12:29 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-13 20:12:29 +0900 |
| commit | 948785649540e08c1610b1dcce6b37e99b5e8039 (patch) | |
| tree | f5e57a0ecca79c8fb244b4c6af53be8e4b7a53fd /packages/backend/src/models | |
| parent | fix(frontend/MkUrlPreview): allow fullscreen from tweets (#11712) (diff) | |
| download | misskey-948785649540e08c1610b1dcce6b37e99b5e8039.tar.gz misskey-948785649540e08c1610b1dcce6b37e99b5e8039.tar.bz2 misskey-948785649540e08c1610b1dcce6b37e99b5e8039.zip | |
feat: refine announcement (#11497)
* wip
* Update read-announcement.ts
* wip
* wip
* wip
* Update index.d.ts
* wip
* Create 1691649257651-refine-announcement.js
* wip
* wip
* wip
* wip
* wip
* wip
* Update announcements.vue
* wip
* wip
* Update announcements.vue
* wip
* Update announcements.vue
* wip
* Update misskey-js.api.md
* Update users.ts
* Create MkAnnouncementDialog.stories.impl.ts
* wip
* wip
* Create AnnouncementService.ts
Diffstat (limited to 'packages/backend/src/models')
| -rw-r--r-- | packages/backend/src/models/entities/Announcement.ts | 49 | ||||
| -rw-r--r-- | packages/backend/src/models/json-schema/announcement.ts | 58 |
2 files changed, 106 insertions, 1 deletions
diff --git a/packages/backend/src/models/entities/Announcement.ts b/packages/backend/src/models/entities/Announcement.ts index 99cdf89330..18c26faab0 100644 --- a/packages/backend/src/models/entities/Announcement.ts +++ b/packages/backend/src/models/entities/Announcement.ts @@ -3,8 +3,9 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; +import { Entity, Index, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; import { id } from '../id.js'; +import { User } from './User.js'; @Entity() export class Announcement { @@ -38,6 +39,52 @@ export class Announcement { }) public imageUrl: string | null; + // info, warning, error, success + @Column('varchar', { + length: 256, nullable: false, + default: 'info', + }) + public icon: string; + + // normal ... お知らせページ掲載 + // banner ... お知らせページ掲載 + バナー表示 + // dialog ... お知らせページ掲載 + ダイアログ表示 + @Column('varchar', { + length: 256, nullable: false, + default: 'normal', + }) + public display: string; + + @Column('boolean', { + default: false, + }) + public needConfirmationToRead: boolean; + + @Index() + @Column('boolean', { + default: true, + }) + public isActive: boolean; + + @Index() + @Column('boolean', { + default: false, + }) + public forExistingUsers: boolean; + + @Index() + @Column({ + ...id(), + nullable: true, + }) + public userId: User['id'] | null; + + @ManyToOne(type => User, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: User | null; + constructor(data: Partial<Announcement>) { if (data == null) return; diff --git a/packages/backend/src/models/json-schema/announcement.ts b/packages/backend/src/models/json-schema/announcement.ts new file mode 100644 index 0000000000..c7e24c7f29 --- /dev/null +++ b/packages/backend/src/models/json-schema/announcement.ts @@ -0,0 +1,58 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export const packedAnnouncementSchema = { + type: 'object', + properties: { + id: { + type: 'string', + optional: false, nullable: false, + format: 'id', + example: 'xxxxxxxxxx', + }, + createdAt: { + type: 'string', + optional: false, nullable: false, + format: 'date-time', + }, + updatedAt: { + type: 'string', + optional: false, nullable: true, + format: 'date-time', + }, + text: { + type: 'string', + optional: false, nullable: false, + }, + title: { + type: 'string', + optional: false, nullable: false, + }, + imageUrl: { + type: 'string', + optional: false, nullable: true, + }, + icon: { + type: 'string', + optional: false, nullable: false, + }, + display: { + type: 'string', + optional: false, nullable: false, + }, + forYou: { + type: 'boolean', + optional: false, nullable: false, + }, + needConfirmationToRead: { + type: 'boolean', + optional: false, nullable: false, + }, + isRead: { + type: 'boolean', + optional: true, nullable: false, + }, + }, +} as const; |