enhance(backend): DBのコラム設定としてcreatedAtの値を入れるように/お知らせ機能API修正

This commit is contained in:
まっちゃとーにゅ
2023-11-20 06:04:59 +09:00
parent 455c7eb653
commit 2883f28b87
71 changed files with 730 additions and 219 deletions

View File

@@ -13,7 +13,8 @@ export class MiAbuseReportResolver {
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of AbuseReportResolver',
comment: 'The created date of the AbuseReportResolver.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;

View File

@@ -12,6 +12,13 @@ export class MiAbuseUserReport {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the AbuseUserReport.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public targetUserId: MiUser['id'];

View File

@@ -13,6 +13,13 @@ export class MiAccessToken {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the AccessToken.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Column('timestamp with time zone', {
nullable: true,
})

View File

@@ -11,6 +11,13 @@ export class MiAd {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Ad.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The expired date of the Ad.',

View File

@@ -12,6 +12,13 @@ export class MiAnnouncement {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Announcement.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Column('timestamp with time zone', {
comment: 'The updated date of the Announcement.',
nullable: true,

View File

@@ -14,6 +14,13 @@ export class MiAnnouncementRead {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the AnnouncementRead.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,6 +13,13 @@ export class MiAntenna {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Antenna.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone')
public lastUsedAt: Date;

View File

@@ -12,6 +12,13 @@ export class MiApp {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the App.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -13,6 +13,13 @@ export class MiAuthSession {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the AuthSession.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('varchar', {
length: 128,

View File

@@ -11,6 +11,13 @@ export class MiAvatarDecoration {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the AvatarDecoration.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Column('timestamp with time zone', {
nullable: true,
})

View File

@@ -13,6 +13,13 @@ export class MiBlocking {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Blocking.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -13,6 +13,13 @@ export class MiChannel {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Channel.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -14,6 +14,13 @@ export class MiChannelFavorite {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the ChannelFavorite.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiChannelFollowing {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the ChannelFollowing.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -12,6 +12,13 @@ export class MiClip {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Clip.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -14,6 +14,13 @@ export class MiClipFavorite {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the ClipFavorite.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,6 +14,13 @@ export class MiDriveFile {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the DriveFile.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -12,6 +12,13 @@ export class MiDriveFolder {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the DriveFolder.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Column('varchar', {
length: 128,
comment: 'The name of the DriveFolder.',

View File

@@ -12,6 +12,13 @@ export class MiFlash {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Flash.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The updated date of the Flash.',

View File

@@ -14,6 +14,13 @@ export class MiFlashLike {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the FlashLike.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,6 +13,13 @@ export class MiFollowRequest {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the FollowRequest.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiFollowing {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Following.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiGalleryLike {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the GalleryLike.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,6 +13,13 @@ export class MiGalleryPost {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the GalleryPost.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The updated date of the GalleryPost.',

View File

@@ -12,6 +12,13 @@ export class MiModerationLog {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the ModerationLog.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,6 +13,13 @@ export class MiMuting {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Muting.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -18,6 +18,13 @@ export class MiNote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Note.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiNoteFavorite {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the NoteFavorite.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,6 +14,13 @@ export class MiNoteReaction {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the NoteReaction.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,6 +13,13 @@ export class MiNoteThreadMuting {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the NoteThreadMuting.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiPage {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Page.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The updated date of the Page.',

View File

@@ -14,6 +14,13 @@ export class MiPageLike {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the PageLike.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -12,6 +12,13 @@ export class MiPasswordResetRequest {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the PasswordResetRequest.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index({ unique: true })
@Column('varchar', {
length: 256,

View File

@@ -14,6 +14,13 @@ export class MiPollVote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the PollVote.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,6 +14,13 @@ export class MiPromoRead {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the PromoRead.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -12,6 +12,13 @@ export class MiRegistrationTicket {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the RegistrationTicket.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index({ unique: true })
@Column('varchar', {
length: 64,

View File

@@ -13,6 +13,13 @@ export class MiRegistryItem {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the RegistryItem.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Column('timestamp with time zone', {
comment: 'The updated date of the RegistryItem.',
})

View File

@@ -13,6 +13,13 @@ export class MiRenoteMuting {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the RenoteMuting.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,7 +14,8 @@ export class MiRetentionAggregation {
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Note.',
comment: 'The created date of the GalleryPost.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;

View File

@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Entity, Column, PrimaryColumn } from 'typeorm';
import { Entity, Column, PrimaryColumn, Index } from 'typeorm';
import { id } from './util/id.js';
type CondFormulaValueAnd = {
@@ -89,6 +89,13 @@ export class MiRole {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Role.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Column('timestamp with time zone', {
comment: 'The updated date of the Role.',
})

View File

@@ -14,6 +14,13 @@ export class MiRoleAssignment {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the RoleAssignment.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -12,6 +12,13 @@ export class MiSignin {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Signin.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -12,6 +12,13 @@ export class MiSwSubscription {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the SwSubscriptipnpon.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { PrimaryColumn, Entity, Column } from 'typeorm';
import { PrimaryColumn, Entity, Column, Index } from 'typeorm';
@Entity('used_username')
export class MiUsedUsername {
@@ -12,7 +12,11 @@ export class MiUsedUsername {
})
public username: string;
@Column('timestamp with time zone')
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UsedUsername.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
constructor(data: Partial<MiUsedUsername>) {

View File

@@ -13,6 +13,13 @@ export class MiUser {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the User.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -13,7 +13,10 @@ export class MiUserIp {
@PrimaryGeneratedColumn()
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UserIp.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;

View File

@@ -12,6 +12,13 @@ export class MiUserList {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UserList.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiUserListFavorite {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UserListFavorite.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,6 +14,13 @@ export class MiUserListMembership {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UserListMembership.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,6 +14,13 @@ export class MiUserNotePining {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UserNotePining.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -11,6 +11,13 @@ export class MiUserPending {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the UserPending.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index({ unique: true })
@Column('varchar', {
length: 128,

View File

@@ -14,6 +14,13 @@ export class MiWebhook {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Webhook.',
default: () => 'CURRENT_TIMESTAMP',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -58,6 +58,10 @@ export const packedAnnouncementSchema = {
type: 'number',
optional: false, nullable: false,
},
silence: {
type: 'boolean',
optional: false, nullable: false,
},
isRead: {
type: 'boolean',
optional: true, nullable: false,