diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-05-04 21:15:57 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-04 21:15:57 +0900 |
| commit | 18e1efc7ecd3f5a6d774c16f17526d12ae46b2f5 (patch) | |
| tree | 8f2cb50644bb3679eafd29fb9e7448ed5069321c /src/models | |
| parent | メールアドレスの設定を促すように (diff) | |
| download | sharkey-18e1efc7ecd3f5a6d774c16f17526d12ae46b2f5.tar.gz sharkey-18e1efc7ecd3f5a6d774c16f17526d12ae46b2f5.tar.bz2 sharkey-18e1efc7ecd3f5a6d774c16f17526d12ae46b2f5.zip | |
Ad (#7495)
* wip
* Update ad.vue
* Update default.widgets.vue
* wip
* Create 1620019354680-ad.ts
* wip
* Update ads.vue
* wip
* Update ad.vue
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/entities/ad.ts | 53 | ||||
| -rw-r--r-- | src/models/index.ts | 2 | ||||
| -rw-r--r-- | src/models/repositories/note.ts | 11 |
3 files changed, 56 insertions, 10 deletions
diff --git a/src/models/entities/ad.ts b/src/models/entities/ad.ts new file mode 100644 index 0000000000..3279de29ea --- /dev/null +++ b/src/models/entities/ad.ts @@ -0,0 +1,53 @@ +import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; +import { id } from '../id'; + +@Entity() +export class Ad { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Ad.' + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + comment: 'The expired date of the Ad.' + }) + public expiresAt: Date; + + @Column('varchar', { + length: 32, nullable: false + }) + public place: string; + + @Column('varchar', { + length: 32, nullable: false + }) + public priority: string; + + @Column('varchar', { + length: 1024, nullable: false + }) + public url: string; + + @Column('varchar', { + length: 1024, nullable: false + }) + public imageUrl: string; + + @Column('varchar', { + length: 8192, nullable: false + }) + public memo: string; + + constructor(data: Partial<Ad>) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/src/models/index.ts b/src/models/index.ts index 6ce453ef33..9f8bd104e9 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -60,6 +60,7 @@ import { MutedNote } from './entities/muted-note'; import { ChannelFollowing } from './entities/channel-following'; import { ChannelNotePining } from './entities/channel-note-pining'; import { RegistryItem } from './entities/registry-item'; +import { Ad } from './entities/ad'; import { PasswordResetRequest } from './entities/password-reset-request'; export const Announcements = getRepository(Announcement); @@ -123,4 +124,5 @@ export const Channels = getCustomRepository(ChannelRepository); export const ChannelFollowings = getRepository(ChannelFollowing); export const ChannelNotePinings = getRepository(ChannelNotePining); export const RegistryItems = getRepository(RegistryItem); +export const Ads = getRepository(Ad); export const PasswordResetRequests = getRepository(PasswordResetRequest); diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts index cdf4841918..7b1df73024 100644 --- a/src/models/repositories/note.ts +++ b/src/models/repositories/note.ts @@ -200,8 +200,6 @@ export class NoteRepository extends Repository<Note> { mentions: note.mentions.length > 0 ? note.mentions : undefined, uri: note.uri || undefined, url: note.url || undefined, - _featuredId_: (note as any)._featuredId_ || undefined, - _prId_: (note as any)._prId_ || undefined, ...(opts.detail ? { reply: note.replyId ? this.pack(note.reply || note.replyId, me, { @@ -448,14 +446,7 @@ export const packedNoteSchema = { optional: false as const, nullable: true as const, description: 'The human readable url of a note. it will be null when the note is local.', }, - _featuredId_: { - type: 'string' as const, - optional: false as const, nullable: true as const, - }, - _prId_: { - type: 'string' as const, - optional: false as const, nullable: true as const, - }, + myReaction: { type: 'object' as const, optional: true as const, nullable: true as const, |