From aaa2041d38a8d9e34361341663609ecdc5e52db5 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 29 May 2023 09:31:02 -0700 Subject: [PATCH] chore: format --- packages/backend/jsconfig.json | 7 +- .../native-utils/__test__/index.spec.mjs | 10 +- .../src/models/entities/abuse-user-report.ts | 38 +-- .../src/models/entities/access-token.ts | 35 +-- packages/backend/src/models/entities/ad.ts | 38 +-- .../src/models/entities/announcement-read.ts | 14 +- .../src/models/entities/announcement.ts | 23 +- .../src/models/entities/antenna-note.ts | 16 +- .../backend/src/models/entities/antenna.ts | 52 ++-- packages/backend/src/models/entities/app.ts | 36 +-- .../models/entities/attestation-challenge.ts | 16 +- .../src/models/entities/auth-session.ts | 14 +- .../backend/src/models/entities/blocking.ts | 18 +- .../src/models/entities/channel-following.ts | 18 +- .../models/entities/channel-note-pining.ts | 14 +- .../backend/src/models/entities/channel.ts | 37 +-- .../backend/src/models/entities/clip-note.ts | 14 +- packages/backend/src/models/entities/clip.ts | 23 +- .../backend/src/models/entities/drive-file.ts | 132 +++++---- .../src/models/entities/drive-folder.ts | 21 +- packages/backend/src/models/entities/emoji.ts | 53 ++-- .../src/models/entities/follow-request.ts | 67 ++--- .../backend/src/models/entities/following.ts | 60 +++-- .../src/models/entities/gallery-like.ts | 12 +- .../src/models/entities/gallery-post.ts | 36 +-- .../backend/src/models/entities/hashtag.ts | 14 +- .../backend/src/models/entities/instance.ts | 83 +++--- .../src/models/entities/messaging-message.ts | 47 ++-- packages/backend/src/models/entities/meta.ts | 255 ++++++++++-------- .../src/models/entities/moderation-log.ts | 12 +- .../backend/src/models/entities/muted-note.ts | 18 +- .../backend/src/models/entities/muting.ts | 20 +- .../backend/src/models/entities/note-edit.ts | 20 +- .../src/models/entities/note-favorite.ts | 14 +- .../src/models/entities/note-reaction.ts | 16 +- .../src/models/entities/note-thread-muting.ts | 11 +- .../src/models/entities/note-unread.ts | 18 +- .../src/models/entities/note-watching.ts | 20 +- packages/backend/src/models/entities/note.ts | 143 +++++----- .../src/models/entities/notification.ts | 62 +++-- .../backend/src/models/entities/page-like.ts | 12 +- packages/backend/src/models/entities/page.ts | 52 ++-- .../models/entities/password-reset-request.ts | 8 +- .../backend/src/models/entities/poll-vote.ts | 16 +- packages/backend/src/models/entities/poll.ts | 29 +- .../backend/src/models/entities/promo-note.ts | 8 +- .../backend/src/models/entities/promo-read.ts | 14 +- .../models/entities/registration-tickets.ts | 4 +- .../src/models/entities/registry-item.ts | 36 +-- packages/backend/src/models/entities/relay.ts | 9 +- .../src/models/entities/renote-muting.ts | 4 +- .../backend/src/models/entities/signin.ts | 14 +- .../src/models/entities/sw-subscription.ts | 14 +- .../src/models/entities/used-username.ts | 4 +- .../models/entities/user-group-invitation.ts | 18 +- .../src/models/entities/user-group-joining.ts | 18 +- .../backend/src/models/entities/user-group.ts | 14 +- .../backend/src/models/entities/user-ip.ts | 7 +- .../src/models/entities/user-keypair.ts | 8 +- .../src/models/entities/user-list-joining.ts | 18 +- .../backend/src/models/entities/user-list.ts | 14 +- .../src/models/entities/user-note-pining.ts | 14 +- .../src/models/entities/user-pending.ts | 10 +- .../src/models/entities/user-profile.ts | 144 +++++----- .../src/models/entities/user-publickey.ts | 8 +- .../src/models/entities/user-security-key.ts | 20 +- packages/backend/src/models/entities/user.ts | 183 +++++++------ .../backend/src/models/entities/webhook.ts | 30 ++- packages/backend/src/server/web/manifest.json | 8 +- packages/calckey-js/package.json | 4 +- packages/calckey-js/tsconfig.json | 9 +- packages/client/src/widgets/server-info.vue | 2 +- packages/sw/package.json | 4 +- rome.json | 17 +- 74 files changed, 1252 insertions(+), 1079 deletions(-) diff --git a/packages/backend/jsconfig.json b/packages/backend/jsconfig.json index 1230aadd1..f3f4f9c77 100644 --- a/packages/backend/jsconfig.json +++ b/packages/backend/jsconfig.json @@ -4,10 +4,5 @@ "module": "commonjs", "allowSyntheticDefaultImports": true }, - "exclude": [ - "node_modules", - "jspm_packages", - "tmp", - "temp" - ] + "exclude": ["node_modules", "jspm_packages", "tmp", "temp"] } diff --git a/packages/backend/native-utils/__test__/index.spec.mjs b/packages/backend/native-utils/__test__/index.spec.mjs index 7d68d6ac3..1788dbb06 100644 --- a/packages/backend/native-utils/__test__/index.spec.mjs +++ b/packages/backend/native-utils/__test__/index.spec.mjs @@ -4,6 +4,12 @@ import { convertId, IdConvertType } from "../built/index.js"; test("convert to mastodon id", (t) => { t.is(convertId("9gf61ehcxv", IdConvertType.MastodonId), "960365976481219"); - t.is(convertId("9fbr9z0wbrjqyd3u", IdConvertType.MastodonId), "3954607381600562394"); - t.is(convertId("9fbs680oyviiqrol9md73p8g", IdConvertType.MastodonId), "3494513243013053824") + t.is( + convertId("9fbr9z0wbrjqyd3u", IdConvertType.MastodonId), + "3954607381600562394", + ); + t.is( + convertId("9fbs680oyviiqrol9md73p8g", IdConvertType.MastodonId), + "3494513243013053824", + ); }); diff --git a/packages/backend/src/models/entities/abuse-user-report.ts b/packages/backend/src/models/entities/abuse-user-report.ts index 655fdd3ca..be183548d 100644 --- a/packages/backend/src/models/entities/abuse-user-report.ts +++ b/packages/backend/src/models/entities/abuse-user-report.ts @@ -15,8 +15,8 @@ export class AbuseUserReport { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the AbuseUserReport.', + @Column("timestamp with time zone", { + comment: "The created date of the AbuseUserReport.", }) public createdAt: Date; @@ -24,8 +24,8 @@ export class AbuseUserReport { @Column(id()) public targetUserId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public targetUser: User | null; @@ -34,8 +34,8 @@ export class AbuseUserReport { @Column(id()) public reporterId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public reporter: User | null; @@ -46,40 +46,42 @@ export class AbuseUserReport { }) public assigneeId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'SET NULL', + @ManyToOne((type) => User, { + onDelete: "SET NULL", }) @JoinColumn() public assignee: User | null; @Index() - @Column('boolean', { + @Column("boolean", { default: false, }) public resolved: boolean; - @Column('boolean', { - default: false + @Column("boolean", { + default: false, }) public forwarded: boolean; - @Column('varchar', { + @Column("varchar", { length: 2048, }) public comment: string; //#region Denormalized fields @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public targetUserHost: string | null; @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public reporterHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/access-token.ts b/packages/backend/src/models/entities/access-token.ts index 83d7bbda8..8b950b171 100644 --- a/packages/backend/src/models/entities/access-token.ts +++ b/packages/backend/src/models/entities/access-token.ts @@ -15,31 +15,31 @@ export class AccessToken { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the AccessToken.', + @Column("timestamp with time zone", { + comment: "The created date of the AccessToken.", }) public createdAt: Date; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public lastUsedAt: Date | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 128, }) public token: string; @Index() - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public session: string | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 128, }) public hash: string; @@ -48,8 +48,8 @@ export class AccessToken { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -60,37 +60,38 @@ export class AccessToken { }) public appId: App["id"] | null; - @ManyToOne(type => App, { - onDelete: 'CASCADE', + @ManyToOne((type) => App, { + onDelete: "CASCADE", }) @JoinColumn() public app: App | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public name: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public description: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public iconUrl: string | null; - @Column('varchar', { - length: 64, array: true, - default: '{}', + @Column("varchar", { + length: 64, + array: true, + default: "{}", }) public permission: string[]; - @Column('boolean', { + @Column("boolean", { default: false, }) public fetched: boolean; diff --git a/packages/backend/src/models/entities/ad.ts b/packages/backend/src/models/entities/ad.ts index fa4297365..80d54ddd5 100644 --- a/packages/backend/src/models/entities/ad.ts +++ b/packages/backend/src/models/entities/ad.ts @@ -7,45 +7,51 @@ export class Ad { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Ad.', + @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.', + @Column("timestamp with time zone", { + comment: "The expired date of the Ad.", }) public expiresAt: Date; - @Column('varchar', { - length: 32, nullable: false, + @Column("varchar", { + length: 32, + nullable: false, }) public place: string; // 今は使われていないが将来的に活用される可能性はある - @Column('varchar', { - length: 32, nullable: false, + @Column("varchar", { + length: 32, + nullable: false, }) public priority: string; - @Column('integer', { - default: 1, nullable: false, + @Column("integer", { + default: 1, + nullable: false, }) public ratio: number; - @Column('varchar', { - length: 1024, nullable: false, + @Column("varchar", { + length: 1024, + nullable: false, }) public url: string; - @Column('varchar', { - length: 1024, nullable: false, + @Column("varchar", { + length: 1024, + nullable: false, }) public imageUrl: string; - @Column('varchar', { - length: 8192, nullable: false, + @Column("varchar", { + length: 8192, + nullable: false, }) public memo: string; diff --git a/packages/backend/src/models/entities/announcement-read.ts b/packages/backend/src/models/entities/announcement-read.ts index 87d0f0e9e..79af9e48e 100644 --- a/packages/backend/src/models/entities/announcement-read.ts +++ b/packages/backend/src/models/entities/announcement-read.ts @@ -11,13 +11,13 @@ import { Announcement } from "./announcement.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'announcementId'], { unique: true }) +@Index(["userId", "announcementId"], { unique: true }) export class AnnouncementRead { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the AnnouncementRead.', + @Column("timestamp with time zone", { + comment: "The created date of the AnnouncementRead.", }) public createdAt: Date; @@ -25,8 +25,8 @@ export class AnnouncementRead { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -35,8 +35,8 @@ export class AnnouncementRead { @Column(id()) public announcementId: Announcement["id"]; - @ManyToOne(type => Announcement, { - onDelete: 'CASCADE', + @ManyToOne((type) => Announcement, { + onDelete: "CASCADE", }) @JoinColumn() public announcement: Announcement | null; diff --git a/packages/backend/src/models/entities/announcement.ts b/packages/backend/src/models/entities/announcement.ts index 9d45af014..1939604b9 100644 --- a/packages/backend/src/models/entities/announcement.ts +++ b/packages/backend/src/models/entities/announcement.ts @@ -7,29 +7,32 @@ export class Announcement { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Announcement.', + @Column("timestamp with time zone", { + comment: "The created date of the Announcement.", }) public createdAt: Date; - @Column('timestamp with time zone', { - comment: 'The updated date of the Announcement.', + @Column("timestamp with time zone", { + comment: "The updated date of the Announcement.", nullable: true, }) public updatedAt: Date | null; - @Column('varchar', { - length: 8192, nullable: false, + @Column("varchar", { + length: 8192, + nullable: false, }) public text: string; - @Column('varchar', { - length: 256, nullable: false, + @Column("varchar", { + length: 256, + nullable: false, }) public title: string; - @Column('varchar', { - length: 1024, nullable: true, + @Column("varchar", { + length: 1024, + nullable: true, }) public imageUrl: string | null; diff --git a/packages/backend/src/models/entities/antenna-note.ts b/packages/backend/src/models/entities/antenna-note.ts index c47c796bb..fe982c19e 100644 --- a/packages/backend/src/models/entities/antenna-note.ts +++ b/packages/backend/src/models/entities/antenna-note.ts @@ -11,7 +11,7 @@ import { Antenna } from "./antenna.js"; import { id } from "../id.js"; @Entity() -@Index(['noteId', 'antennaId'], { unique: true }) +@Index(["noteId", "antennaId"], { unique: true }) export class AntennaNote { @PrimaryColumn(id()) public id: string; @@ -19,12 +19,12 @@ export class AntennaNote { @Index() @Column({ ...id(), - comment: 'The note ID.', + comment: "The note ID.", }) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; @@ -32,18 +32,18 @@ export class AntennaNote { @Index() @Column({ ...id(), - comment: 'The antenna ID.', + comment: "The antenna ID.", }) public antennaId: Antenna["id"]; - @ManyToOne(type => Antenna, { - onDelete: 'CASCADE', + @ManyToOne((type) => Antenna, { + onDelete: "CASCADE", }) @JoinColumn() public antenna: Antenna | null; @Index() - @Column('boolean', { + @Column("boolean", { default: false, }) public read: boolean; diff --git a/packages/backend/src/models/entities/antenna.ts b/packages/backend/src/models/entities/antenna.ts index c653b2a05..633dcc1d2 100644 --- a/packages/backend/src/models/entities/antenna.ts +++ b/packages/backend/src/models/entities/antenna.ts @@ -16,31 +16,33 @@ export class Antenna { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the Antenna.', + @Column("timestamp with time zone", { + comment: "The created date of the Antenna.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the Antenna.', + comment: "The name of the Antenna.", }) public name: string; - @Column('enum', { enum: ['home', 'all', 'users', 'list', 'group', 'instances'] }) + @Column("enum", { + enum: ["home", "all", "users", "list", "group", "instances"], + }) public src: "home" | "all" | "users" | "list" | "group" | "instances"; @Column({ @@ -49,8 +51,8 @@ export class Antenna { }) public userListId: UserList["id"] | null; - @ManyToOne(type => UserList, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserList, { + onDelete: "CASCADE", }) @JoinColumn() public userList: UserList | null; @@ -61,51 +63,53 @@ export class Antenna { }) public userGroupJoiningId: UserGroupJoining["id"] | null; - @ManyToOne(type => UserGroupJoining, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserGroupJoining, { + onDelete: "CASCADE", }) @JoinColumn() public userGroupJoining: UserGroupJoining | null; - @Column('varchar', { - length: 1024, array: true, - default: '{}', + @Column("varchar", { + length: 1024, + array: true, + default: "{}", }) public users: string[]; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public instances: string[]; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public keywords: string[][]; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public excludeKeywords: string[][]; - @Column('boolean', { + @Column("boolean", { default: false, }) public caseSensitive: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public withReplies: boolean; - @Column('boolean') + @Column("boolean") public withFile: boolean; - @Column('varchar', { - length: 2048, nullable: true, + @Column("varchar", { + length: 2048, + nullable: true, }) public expression: string | null; - @Column('boolean') + @Column("boolean") public notify: boolean; } diff --git a/packages/backend/src/models/entities/app.ts b/packages/backend/src/models/entities/app.ts index bb33eede4..a41e35aa9 100644 --- a/packages/backend/src/models/entities/app.ts +++ b/packages/backend/src/models/entities/app.ts @@ -8,8 +8,8 @@ export class App { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the App.', + @Column("timestamp with time zone", { + comment: "The created date of the App.", }) public createdAt: Date; @@ -17,44 +17,46 @@ export class App { @Column({ ...id(), nullable: true, - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'SET NULL', + @ManyToOne((type) => User, { + onDelete: "SET NULL", nullable: true, }) public user: User | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 64, - comment: 'The secret key of the App.', + comment: "The secret key of the App.", }) public secret: string; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the App.', + comment: "The name of the App.", }) public name: string; - @Column('varchar', { + @Column("varchar", { length: 512, - comment: 'The description of the App.', + comment: "The description of the App.", }) public description: string; - @Column('varchar', { - length: 64, array: true, - comment: 'The permission of the App.', + @Column("varchar", { + length: 64, + array: true, + comment: "The permission of the App.", }) public permission: string[]; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The callbackUrl of the App.', + @Column("varchar", { + length: 512, + nullable: true, + comment: "The callbackUrl of the App.", }) public callbackUrl: string | null; } diff --git a/packages/backend/src/models/entities/attestation-challenge.ts b/packages/backend/src/models/entities/attestation-challenge.ts index 7a87d42be..6a3a9c8ed 100644 --- a/packages/backend/src/models/entities/attestation-challenge.ts +++ b/packages/backend/src/models/entities/attestation-challenge.ts @@ -18,27 +18,27 @@ export class AttestationChallenge { @PrimaryColumn(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 64, - comment: 'Hex-encoded sha256 hash of the challenge.', + comment: "Hex-encoded sha256 hash of the challenge.", }) public challenge: string; - @Column('timestamp with time zone', { - comment: 'The date challenge was created for expiry purposes.', + @Column("timestamp with time zone", { + comment: "The date challenge was created for expiry purposes.", }) public createdAt: Date; - @Column('boolean', { + @Column("boolean", { comment: - 'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.', + "Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.", default: false, }) public registrationChallenge: boolean; diff --git a/packages/backend/src/models/entities/auth-session.ts b/packages/backend/src/models/entities/auth-session.ts index b762f8462..b31dca56c 100644 --- a/packages/backend/src/models/entities/auth-session.ts +++ b/packages/backend/src/models/entities/auth-session.ts @@ -15,13 +15,13 @@ export class AuthSession { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the AuthSession.', + @Column("timestamp with time zone", { + comment: "The created date of the AuthSession.", }) public createdAt: Date; @Index() - @Column('varchar', { + @Column("varchar", { length: 128, }) public token: string; @@ -32,8 +32,8 @@ export class AuthSession { }) public userId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", nullable: true, }) @JoinColumn() @@ -42,8 +42,8 @@ export class AuthSession { @Column(id()) public appId: App["id"]; - @ManyToOne(type => App, { - onDelete: 'CASCADE', + @ManyToOne((type) => App, { + onDelete: "CASCADE", }) @JoinColumn() public app: App | null; diff --git a/packages/backend/src/models/entities/blocking.ts b/packages/backend/src/models/entities/blocking.ts index 3a44a4d65..55f677a98 100644 --- a/packages/backend/src/models/entities/blocking.ts +++ b/packages/backend/src/models/entities/blocking.ts @@ -10,26 +10,26 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['blockerId', 'blockeeId'], { unique: true }) +@Index(["blockerId", "blockeeId"], { unique: true }) export class Blocking { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Blocking.', + @Column("timestamp with time zone", { + comment: "The created date of the Blocking.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The blockee user ID.', + comment: "The blockee user ID.", }) public blockeeId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public blockee: User | null; @@ -37,12 +37,12 @@ export class Blocking { @Index() @Column({ ...id(), - comment: 'The blocker user ID.', + comment: "The blocker user ID.", }) public blockerId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public blocker: User | null; diff --git a/packages/backend/src/models/entities/channel-following.ts b/packages/backend/src/models/entities/channel-following.ts index 04ec193e1..ee329fa50 100644 --- a/packages/backend/src/models/entities/channel-following.ts +++ b/packages/backend/src/models/entities/channel-following.ts @@ -11,26 +11,26 @@ import { id } from "../id.js"; import { Channel } from "./channel.js"; @Entity() -@Index(['followerId', 'followeeId'], { unique: true }) +@Index(["followerId", "followeeId"], { unique: true }) export class ChannelFollowing { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the ChannelFollowing.', + @Column("timestamp with time zone", { + comment: "The created date of the ChannelFollowing.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The followee channel ID.', + comment: "The followee channel ID.", }) public followeeId: Channel["id"]; - @ManyToOne(type => Channel, { - onDelete: 'CASCADE', + @ManyToOne((type) => Channel, { + onDelete: "CASCADE", }) @JoinColumn() public followee: Channel | null; @@ -38,12 +38,12 @@ export class ChannelFollowing { @Index() @Column({ ...id(), - comment: 'The follower user ID.', + comment: "The follower user ID.", }) public followerId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public follower: User | null; diff --git a/packages/backend/src/models/entities/channel-note-pining.ts b/packages/backend/src/models/entities/channel-note-pining.ts index bd13f4ca3..67d1d48cc 100644 --- a/packages/backend/src/models/entities/channel-note-pining.ts +++ b/packages/backend/src/models/entities/channel-note-pining.ts @@ -11,13 +11,13 @@ import { Channel } from "./channel.js"; import { id } from "../id.js"; @Entity() -@Index(['channelId', 'noteId'], { unique: true }) +@Index(["channelId", "noteId"], { unique: true }) export class ChannelNotePining { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the ChannelNotePining.', + @Column("timestamp with time zone", { + comment: "The created date of the ChannelNotePining.", }) public createdAt: Date; @@ -25,8 +25,8 @@ export class ChannelNotePining { @Column(id()) public channelId: Channel["id"]; - @ManyToOne(type => Channel, { - onDelete: 'CASCADE', + @ManyToOne((type) => Channel, { + onDelete: "CASCADE", }) @JoinColumn() public channel: Channel | null; @@ -34,8 +34,8 @@ export class ChannelNotePining { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/channel.ts b/packages/backend/src/models/entities/channel.ts index 7f9851dbf..ea22fed50 100644 --- a/packages/backend/src/models/entities/channel.ts +++ b/packages/backend/src/models/entities/channel.ts @@ -16,13 +16,13 @@ export class Channel { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Channel.', + @Column("timestamp with time zone", { + comment: "The created date of the Channel.", }) public createdAt: Date; @Index() - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public lastNotedAt: Date | null; @@ -31,52 +31,53 @@ export class Channel { @Column({ ...id(), nullable: true, - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'SET NULL', + @ManyToOne((type) => User, { + onDelete: "SET NULL", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the Channel.', + comment: "The name of the Channel.", }) public name: string; - @Column('varchar', { - length: 2048, nullable: true, - comment: 'The description of the Channel.', + @Column("varchar", { + length: 2048, + nullable: true, + comment: "The description of the Channel.", }) public description: string | null; @Column({ ...id(), nullable: true, - comment: 'The ID of banner Channel.', + comment: "The ID of banner Channel.", }) public bannerId: DriveFile["id"] | null; - @ManyToOne(type => DriveFile, { - onDelete: 'SET NULL', + @ManyToOne((type) => DriveFile, { + onDelete: "SET NULL", }) @JoinColumn() public banner: DriveFile | null; @Index() - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of notes.', + comment: "The count of notes.", }) public notesCount: number; @Index() - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of users.', + comment: "The count of users.", }) public usersCount: number; } diff --git a/packages/backend/src/models/entities/clip-note.ts b/packages/backend/src/models/entities/clip-note.ts index bc51daaf4..1697474a8 100644 --- a/packages/backend/src/models/entities/clip-note.ts +++ b/packages/backend/src/models/entities/clip-note.ts @@ -11,7 +11,7 @@ import { Clip } from "./clip.js"; import { id } from "../id.js"; @Entity() -@Index(['noteId', 'clipId'], { unique: true }) +@Index(["noteId", "clipId"], { unique: true }) export class ClipNote { @PrimaryColumn(id()) public id: string; @@ -19,12 +19,12 @@ export class ClipNote { @Index() @Column({ ...id(), - comment: 'The note ID.', + comment: "The note ID.", }) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; @@ -32,12 +32,12 @@ export class ClipNote { @Index() @Column({ ...id(), - comment: 'The clip ID.', + comment: "The clip ID.", }) public clipId: Clip["id"]; - @ManyToOne(type => Clip, { - onDelete: 'CASCADE', + @ManyToOne((type) => Clip, { + onDelete: "CASCADE", }) @JoinColumn() public clip: Clip | null; diff --git a/packages/backend/src/models/entities/clip.ts b/packages/backend/src/models/entities/clip.ts index 10591cbee..9554703a4 100644 --- a/packages/backend/src/models/entities/clip.ts +++ b/packages/backend/src/models/entities/clip.ts @@ -14,38 +14,39 @@ export class Clip { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the Clip.', + @Column("timestamp with time zone", { + comment: "The created date of the Clip.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the Clip.', + comment: "The name of the Clip.", }) public name: string; - @Column('boolean', { + @Column("boolean", { default: false, }) public isPublic: boolean; - @Column('varchar', { - length: 2048, nullable: true, - comment: 'The description of the Clip.', + @Column("varchar", { + length: 2048, + nullable: true, + comment: "The description of the Clip.", }) public description: string | null; } diff --git a/packages/backend/src/models/entities/drive-file.ts b/packages/backend/src/models/entities/drive-file.ts index 32e19bc6e..d8b54fa19 100644 --- a/packages/backend/src/models/entities/drive-file.ts +++ b/packages/backend/src/models/entities/drive-file.ts @@ -12,14 +12,14 @@ import { DriveFolder } from "./drive-folder.js"; import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; @Entity() -@Index(['userId', 'folderId', 'id']) +@Index(["userId", "folderId", "id"]) export class DriveFile { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the DriveFile.', + @Column("timestamp with time zone", { + comment: "The created date of the DriveFile.", }) public createdAt: Date; @@ -27,64 +27,67 @@ export class DriveFile { @Column({ ...id(), nullable: true, - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'SET NULL', + @ManyToOne((type) => User, { + onDelete: "SET NULL", }) @JoinColumn() public user: User | null; @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: 'The host of owner. It will be null if the user in local.', + @Column("varchar", { + length: 128, + nullable: true, + comment: "The host of owner. It will be null if the user in local.", }) public userHost: string | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 32, - comment: 'The MD5 hash of the DriveFile.', + comment: "The MD5 hash of the DriveFile.", }) public md5: string; - @Column('varchar', { + @Column("varchar", { length: 256, - comment: 'The file name of the DriveFile.', + comment: "The file name of the DriveFile.", }) public name: string; @Index() - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The content type (MIME) of the DriveFile.', + comment: "The content type (MIME) of the DriveFile.", }) public type: string; - @Column('integer', { - comment: 'The file size (bytes) of the DriveFile.', + @Column("integer", { + comment: "The file size (bytes) of the DriveFile.", }) public size: number; - @Column('varchar', { + @Column("varchar", { length: DB_MAX_IMAGE_COMMENT_LENGTH, nullable: true, - comment: 'The comment of the DriveFile.', + comment: "The comment of the DriveFile.", }) public comment: string | null; - @Column('varchar', { - length: 128, nullable: true, - comment: 'The BlurHash string.', + @Column("varchar", { + length: 128, + nullable: true, + comment: "The BlurHash string.", }) public blurhash: string | null; - @Column('jsonb', { + @Column("jsonb", { default: {}, - comment: 'The any properties of the DriveFile. For example, it includes image width/height.', + comment: + "The any properties of the DriveFile. For example, it includes image width/height.", }) public properties: { width?: number; @@ -93,59 +96,68 @@ export class DriveFile { avgColor?: string; }; - @Column('boolean') + @Column("boolean") public storedInternal: boolean; - @Column('varchar', { + @Column("varchar", { length: 512, - comment: 'The URL of the DriveFile.', + comment: "The URL of the DriveFile.", }) public url: string; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URL of the thumbnail of the DriveFile.', + @Column("varchar", { + length: 512, + nullable: true, + comment: "The URL of the thumbnail of the DriveFile.", }) public thumbnailUrl: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URL of the webpublic of the DriveFile.', + @Column("varchar", { + length: 512, + nullable: true, + comment: "The URL of the webpublic of the DriveFile.", }) public webpublicUrl: string | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public webpublicType: string | null; @Index({ unique: true }) - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public accessKey: string | null; @Index({ unique: true }) - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public thumbnailAccessKey: string | null; @Index({ unique: true }) - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public webpublicAccessKey: string | null; @Index() - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The URI of the DriveFile. it will be null when the DriveFile is local.", }) public uri: string | null; - @Column('varchar', { - length: 512, nullable: true, + @Column("varchar", { + length: 512, + nullable: true, }) public src: string | null; @@ -153,32 +165,33 @@ export class DriveFile { @Column({ ...id(), nullable: true, - comment: 'The parent folder ID. If null, it means the DriveFile is located in root.', + comment: + "The parent folder ID. If null, it means the DriveFile is located in root.", }) public folderId: DriveFolder["id"] | null; - @ManyToOne(type => DriveFolder, { - onDelete: 'SET NULL', + @ManyToOne((type) => DriveFolder, { + onDelete: "SET NULL", }) @JoinColumn() public folder: DriveFolder | null; @Index() - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the DriveFile is NSFW.', + comment: "Whether the DriveFile is NSFW.", }) public isSensitive: boolean; @Index() - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the DriveFile is NSFW. (predict)', + comment: "Whether the DriveFile is NSFW. (predict)", }) public maybeSensitive: boolean; @Index() - @Column('boolean', { + @Column("boolean", { default: false, }) public maybePorn: boolean; @@ -187,20 +200,21 @@ export class DriveFile { * 外部の(信頼されていない)URLへの直リンクか否か */ @Index() - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the DriveFile is direct link to remote server.', + comment: "Whether the DriveFile is direct link to remote server.", }) public isLink: boolean; - @Column('jsonb', { + @Column("jsonb", { default: {}, nullable: true, }) public requestHeaders: Record | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public requestIp: string | null; } diff --git a/packages/backend/src/models/entities/drive-folder.ts b/packages/backend/src/models/entities/drive-folder.ts index 77031ce4e..0bb2c7a3d 100644 --- a/packages/backend/src/models/entities/drive-folder.ts +++ b/packages/backend/src/models/entities/drive-folder.ts @@ -15,14 +15,14 @@ export class DriveFolder { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the DriveFolder.', + @Column("timestamp with time zone", { + comment: "The created date of the DriveFolder.", }) public createdAt: Date; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the DriveFolder.', + comment: "The name of the DriveFolder.", }) public name: string; @@ -30,12 +30,12 @@ export class DriveFolder { @Column({ ...id(), nullable: true, - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -44,12 +44,13 @@ export class DriveFolder { @Column({ ...id(), nullable: true, - comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.', + comment: + "The parent folder ID. If null, it means the DriveFolder is located in root.", }) public parentId: DriveFolder["id"] | null; - @ManyToOne(type => DriveFolder, { - onDelete: 'SET NULL', + @ManyToOne((type) => DriveFolder, { + onDelete: "SET NULL", }) @JoinColumn() public parent: DriveFolder | null; diff --git a/packages/backend/src/models/entities/emoji.ts b/packages/backend/src/models/entities/emoji.ts index 773265d91..727ba2f10 100644 --- a/packages/backend/src/models/entities/emoji.ts +++ b/packages/backend/src/models/entities/emoji.ts @@ -2,73 +2,82 @@ import { PrimaryColumn, Entity, Index, Column } from "typeorm"; import { id } from "../id.js"; @Entity() -@Index(['name', 'host'], { unique: true }) +@Index(["name", "host"], { unique: true }) export class Emoji { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public updatedAt: Date | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 128, }) public name: string; @Index() - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public host: string | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public category: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, }) public originalUrl: string; - @Column('varchar', { + @Column("varchar", { length: 512, - default: '', + default: "", }) public publicUrl: string; - @Column('varchar', { - length: 512, nullable: true, + @Column("varchar", { + length: 512, + nullable: true, }) public uri: string | null; // publicUrlの方のtypeが入る // (mime) - @Column('varchar', { - length: 64, nullable: true, + @Column("varchar", { + length: 64, + nullable: true, }) public type: string | null; - @Column('varchar', { - array: true, length: 128, default: '{}', + @Column("varchar", { + array: true, + length: 128, + default: "{}", }) public aliases: string[]; - @Column('varchar', { - length: 1024, nullable: true, + @Column("varchar", { + length: 1024, + nullable: true, }) public license: string | null; - @Column('integer', { - nullable: true, comment: 'Image width', + @Column("integer", { + nullable: true, + comment: "Image width", }) public width: number | null; - @Column('integer', { - nullable: true, comment: "Image height", + @Column("integer", { + nullable: true, + comment: "Image height", }) public height: number | null; } diff --git a/packages/backend/src/models/entities/follow-request.ts b/packages/backend/src/models/entities/follow-request.ts index 658fed5a5..281eab917 100644 --- a/packages/backend/src/models/entities/follow-request.ts +++ b/packages/backend/src/models/entities/follow-request.ts @@ -10,25 +10,25 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['followerId', 'followeeId'], { unique: true }) +@Index(["followerId", "followeeId"], { unique: true }) export class FollowRequest { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the FollowRequest.', + @Column("timestamp with time zone", { + comment: "The created date of the FollowRequest.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The followee user ID.', + comment: "The followee user ID.", }) public followeeId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public followee: User | null; @@ -36,56 +36,63 @@ export class FollowRequest { @Index() @Column({ ...id(), - comment: 'The follower user ID.', + comment: "The follower user ID.", }) public followerId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public follower: User | null; - @Column('varchar', { - length: 128, nullable: true, - comment: 'id of Follow Activity.', + @Column("varchar", { + length: 128, + nullable: true, + comment: "id of Follow Activity.", }) public requestId: string | null; //#region Denormalized fields - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public followerHost: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followerInbox: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followerSharedInbox: string | null; - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public followeeHost: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followeeInbox: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followeeSharedInbox: string | null; //#endregion diff --git a/packages/backend/src/models/entities/following.ts b/packages/backend/src/models/entities/following.ts index 11f633fcd..fafcf8885 100644 --- a/packages/backend/src/models/entities/following.ts +++ b/packages/backend/src/models/entities/following.ts @@ -10,26 +10,26 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['followerId', 'followeeId'], { unique: true }) +@Index(["followerId", "followeeId"], { unique: true }) export class Following { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Following.', + @Column("timestamp with time zone", { + comment: "The created date of the Following.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The followee user ID.', + comment: "The followee user ID.", }) public followeeId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public followee: User | null; @@ -37,52 +37,58 @@ export class Following { @Index() @Column({ ...id(), - comment: 'The follower user ID.', + comment: "The follower user ID.", }) public followerId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public follower: User | null; //#region Denormalized fields @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public followerHost: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followerInbox: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followerSharedInbox: string | null; @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public followeeHost: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followeeInbox: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 512, + nullable: true, + comment: "[Denormalized]", }) public followeeSharedInbox: string | null; //#endregion diff --git a/packages/backend/src/models/entities/gallery-like.ts b/packages/backend/src/models/entities/gallery-like.ts index e74e3c3ce..259feb8bb 100644 --- a/packages/backend/src/models/entities/gallery-like.ts +++ b/packages/backend/src/models/entities/gallery-like.ts @@ -11,20 +11,20 @@ import { id } from "../id.js"; import { GalleryPost } from "./gallery-post.js"; @Entity() -@Index(['userId', 'postId'], { unique: true }) +@Index(["userId", "postId"], { unique: true }) export class GalleryLike { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; @Index() @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -32,8 +32,8 @@ export class GalleryLike { @Column(id()) public postId: GalleryPost["id"]; - @ManyToOne(type => GalleryPost, { - onDelete: 'CASCADE', + @ManyToOne((type) => GalleryPost, { + onDelete: "CASCADE", }) @JoinColumn() public post: GalleryPost | null; diff --git a/packages/backend/src/models/entities/gallery-post.ts b/packages/backend/src/models/entities/gallery-post.ts index a79bb8835..938348659 100644 --- a/packages/backend/src/models/entities/gallery-post.ts +++ b/packages/backend/src/models/entities/gallery-post.ts @@ -16,36 +16,37 @@ export class GalleryPost { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the GalleryPost.', + @Column("timestamp with time zone", { + comment: "The created date of the GalleryPost.", }) public createdAt: Date; @Index() - @Column('timestamp with time zone', { - comment: 'The updated date of the GalleryPost.', + @Column("timestamp with time zone", { + comment: "The updated date of the GalleryPost.", }) public updatedAt: Date; - @Column('varchar', { + @Column("varchar", { length: 256, }) public title: string; - @Column('varchar', { - length: 2048, nullable: true, + @Column("varchar", { + length: 2048, + nullable: true, }) public description: string | null; @Index() @Column({ ...id(), - comment: 'The ID of author.', + comment: "The ID of author.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -53,26 +54,29 @@ export class GalleryPost { @Index() @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public fileIds: DriveFile["id"][]; @Index() - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the post is sensitive.', + comment: "Whether the post is sensitive.", }) public isSensitive: boolean; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public likedCount: number; @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', + @Column("varchar", { + length: 128, + array: true, + default: "{}", }) public tags: string[]; diff --git a/packages/backend/src/models/entities/hashtag.ts b/packages/backend/src/models/entities/hashtag.ts index 06fa004be..7b3df1cc2 100644 --- a/packages/backend/src/models/entities/hashtag.ts +++ b/packages/backend/src/models/entities/hashtag.ts @@ -8,7 +8,7 @@ export class Hashtag { public id: string; @Index({ unique: true }) - @Column('varchar', { + @Column("varchar", { length: 128, }) public name: string; @@ -20,7 +20,7 @@ export class Hashtag { public mentionedUserIds: User["id"][]; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public mentionedUsersCount: number; @@ -32,7 +32,7 @@ export class Hashtag { public mentionedLocalUserIds: User["id"][]; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public mentionedLocalUsersCount: number; @@ -44,7 +44,7 @@ export class Hashtag { public mentionedRemoteUserIds: User["id"][]; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public mentionedRemoteUsersCount: number; @@ -56,7 +56,7 @@ export class Hashtag { public attachedUserIds: User["id"][]; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public attachedUsersCount: number; @@ -68,7 +68,7 @@ export class Hashtag { public attachedLocalUserIds: User["id"][]; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public attachedLocalUsersCount: number; @@ -80,7 +80,7 @@ export class Hashtag { public attachedRemoteUserIds: User["id"][]; @Index() - @Column('integer', { + @Column("integer", { default: 0, }) public attachedRemoteUsersCount: number; diff --git a/packages/backend/src/models/entities/instance.ts b/packages/backend/src/models/entities/instance.ts index 2b118455d..7e0b08583 100644 --- a/packages/backend/src/models/entities/instance.ts +++ b/packages/backend/src/models/entities/instance.ts @@ -10,8 +10,8 @@ export class Instance { * このインスタンスを捕捉した日時 */ @Index() - @Column('timestamp with time zone', { - comment: 'The caught date of the Instance.', + @Column("timestamp with time zone", { + comment: "The caught date of the Instance.", }) public caughtAt: Date; @@ -19,34 +19,34 @@ export class Instance { * ホスト */ @Index({ unique: true }) - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The host of the Instance.', + comment: "The host of the Instance.", }) public host: string; /** * インスタンスのユーザー数 */ - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of the users of the Instance.', + comment: "The count of the users of the Instance.", }) public usersCount: number; /** * インスタンスの投稿数 */ - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of the notes of the Instance.', + comment: "The count of the notes of the Instance.", }) public notesCount: number; /** * このインスタンスのユーザーからフォローされている、自インスタンスのユーザーの数 */ - @Column('integer', { + @Column("integer", { default: 0, }) public followingCount: number; @@ -54,7 +54,7 @@ export class Instance { /** * このインスタンスのユーザーをフォローしている、自インスタンスのユーザーの数 */ - @Column('integer', { + @Column("integer", { default: 0, }) public followersCount: number; @@ -62,7 +62,7 @@ export class Instance { /** * 直近のリクエスト送信日時 */ - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public latestRequestSentAt: Date | null; @@ -70,7 +70,7 @@ export class Instance { /** * 直近のリクエスト送信時のHTTPステータスコード */ - @Column('integer', { + @Column("integer", { nullable: true, }) public latestStatus: number | null; @@ -78,7 +78,7 @@ export class Instance { /** * 直近のリクエスト受信日時 */ - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public latestRequestReceivedAt: Date | null; @@ -86,13 +86,13 @@ export class Instance { /** * このインスタンスと最後にやり取りした日時 */ - @Column('timestamp with time zone') + @Column("timestamp with time zone") public lastCommunicatedAt: Date; /** * このインスタンスと不通かどうか */ - @Column('boolean', { + @Column("boolean", { default: false, }) public isNotResponding: boolean; @@ -101,63 +101,72 @@ export class Instance { * このインスタンスへの配信を停止するか */ @Index() - @Column('boolean', { + @Column("boolean", { default: false, }) public isSuspended: boolean; - @Column('varchar', { - length: 64, nullable: true, - comment: 'The software of the Instance.', + @Column("varchar", { + length: 64, + nullable: true, + comment: "The software of the Instance.", }) public softwareName: string | null; - @Column('varchar', { - length: 64, nullable: true, + @Column("varchar", { + length: 64, + nullable: true, }) public softwareVersion: string | null; - @Column('boolean', { + @Column("boolean", { nullable: true, }) public openRegistrations: boolean | null; - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public name: string | null; - @Column('varchar', { - length: 4096, nullable: true, + @Column("varchar", { + length: 4096, + nullable: true, }) public description: string | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public maintainerName: string | null; - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public maintainerEmail: string | null; - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public iconUrl: string | null; - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public faviconUrl: string | null; - @Column('varchar', { - length: 64, nullable: true, + @Column("varchar", { + length: 64, + nullable: true, }) public themeColor: string | null; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public infoUpdatedAt: Date | null; diff --git a/packages/backend/src/models/entities/messaging-message.ts b/packages/backend/src/models/entities/messaging-message.ts index 9cf197fa3..d1da00eae 100644 --- a/packages/backend/src/models/entities/messaging-message.ts +++ b/packages/backend/src/models/entities/messaging-message.ts @@ -17,68 +17,73 @@ export class MessagingMessage { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the MessagingMessage.', + @Column("timestamp with time zone", { + comment: "The created date of the MessagingMessage.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The sender user ID.', + comment: "The sender user ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @Index() @Column({ - ...id(), nullable: true, - comment: 'The recipient user ID.', + ...id(), + nullable: true, + comment: "The recipient user ID.", }) public recipientId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public recipient: User | null; @Index() @Column({ - ...id(), nullable: true, - comment: 'The recipient group ID.', + ...id(), + nullable: true, + comment: "The recipient group ID.", }) public groupId: UserGroup["id"] | null; - @ManyToOne(type => UserGroup, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserGroup, { + onDelete: "CASCADE", }) @JoinColumn() public group: UserGroup | null; - @Column('varchar', { - length: 4096, nullable: true, + @Column("varchar", { + length: 4096, + nullable: true, }) public text: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public isRead: boolean; - @Column('varchar', { - length: 512, nullable: true, + @Column("varchar", { + length: 512, + nullable: true, }) public uri: string | null; @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public reads: User["id"][]; @@ -88,8 +93,8 @@ export class MessagingMessage { }) public fileId: DriveFile["id"] | null; - @ManyToOne(type => DriveFile, { - onDelete: 'CASCADE', + @ManyToOne((type) => DriveFile, { + onDelete: "CASCADE", }) @JoinColumn() public file: DriveFile | null; diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index 3a3c50d4a..433ad0db5 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -6,119 +6,144 @@ import type { Clip } from "./clip.js"; @Entity() export class Meta { @PrimaryColumn({ - type: 'varchar', + type: "varchar", length: 32, }) public id: string; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public name: string | null; - @Column('varchar', { - length: 1024, nullable: true, + @Column("varchar", { + length: 1024, + nullable: true, }) public description: string | null; /** * メンテナの名前 */ - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public maintainerName: string | null; /** * メンテナの連絡先 */ - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public maintainerEmail: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public disableRegistration: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public disableLocalTimeline: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public disableRecommendedTimeline: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public disableGlobalTimeline: boolean; - @Column('varchar', { - length: 256, default: '⭐', + @Column("varchar", { + length: 256, + default: "⭐", }) public defaultReaction: string; - @Column('varchar', { - length: 64, array: true, default: '{}', + @Column("varchar", { + length: 64, + array: true, + default: "{}", }) public langs: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public pinnedUsers: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public recommendedInstances: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public customMOTD: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public customSplashIcons: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public hiddenTags: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public blockedHosts: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public silencedHosts: string[]; - @Column('boolean', { + @Column("boolean", { default: false, }) public secureMode: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public privateMode: boolean; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public allowedHosts: string[]; - @Column('varchar', { - length: 512, array: true, default: '{/featured,/channels,/explore,/pages,/about-calckey}', + @Column("varchar", { + length: 512, + array: true, + default: "{/featured,/channels,/explore,/pages,/about-calckey}", }) public pinnedPages: string[]; @@ -128,51 +153,51 @@ export class Meta { }) public pinnedClipId: Clip["id"] | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public themeColor: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, - default: '/assets/ai.png', + default: "/assets/ai.png", }) public mascotImageUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public bannerUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public backgroundImageUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public logoImageUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, - default: 'https://xn--931a.moe/aiart/yubitun.png', + default: "https://xn--931a.moe/aiart/yubitun.png", }) public errorImageUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public iconUrl: string | null; - @Column('boolean', { + @Column("boolean", { default: true, }) public cacheRemoteFiles: boolean; @@ -183,60 +208,60 @@ export class Meta { }) public proxyAccountId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'SET NULL', + @ManyToOne((type) => User, { + onDelete: "SET NULL", }) @JoinColumn() public proxyAccount: User | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public emailRequiredForSignup: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableHcaptcha: boolean; - @Column('varchar', { + @Column("varchar", { length: 64, nullable: true, }) public hcaptchaSiteKey: string | null; - @Column('varchar', { + @Column("varchar", { length: 64, nullable: true, }) public hcaptchaSecretKey: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableRecaptcha: boolean; - @Column('varchar', { + @Column("varchar", { length: 64, nullable: true, }) public recaptchaSiteKey: string | null; - @Column('varchar', { + @Column("varchar", { length: 64, nullable: true, }) public recaptchaSecretKey: string | null; - @Column('enum', { - enum: ['none', 'all', 'local', 'remote'], - default: 'none', + @Column("enum", { + enum: ["none", "all", "local", "remote"], + default: "none", }) public sensitiveMediaDetection: "none" | "all" | "local" | "remote"; - @Column('enum', { - enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'], - default: 'medium', + @Column("enum", { + enum: ["medium", "low", "high", "veryLow", "veryHigh"], + default: "medium", }) public sensitiveMediaDetectionSensitivity: | "medium" @@ -245,279 +270,279 @@ export class Meta { | "veryLow" | "veryHigh"; - @Column('boolean', { + @Column("boolean", { default: false, }) public setSensitiveFlagAutomatically: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableSensitiveMediaDetectionForVideos: boolean; - @Column('integer', { + @Column("integer", { default: 1024, - comment: 'Drive capacity of a local user (MB)', + comment: "Drive capacity of a local user (MB)", }) public localDriveCapacityMb: number; - @Column('integer', { + @Column("integer", { default: 32, - comment: 'Drive capacity of a remote user (MB)', + comment: "Drive capacity of a remote user (MB)", }) public remoteDriveCapacityMb: number; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public summalyProxy: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableEmail: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public email: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public smtpSecure: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public smtpHost: string | null; - @Column('integer', { + @Column("integer", { nullable: true, }) public smtpPort: number | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public smtpUser: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public smtpPass: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableServiceWorker: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public swPublicKey: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public swPrivateKey: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableTwitterIntegration: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public twitterConsumerKey: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public twitterConsumerSecret: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableGithubIntegration: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public githubClientId: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public githubClientSecret: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableDiscordIntegration: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public discordClientId: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public discordClientSecret: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public deeplAuthKey: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public deeplIsPro: boolean; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public libreTranslateApiUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 128, nullable: true, }) public libreTranslateApiKey: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public ToSUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, - default: 'https://codeberg.org/calckey/calckey', + default: "https://codeberg.org/calckey/calckey", nullable: false, }) public repositoryUrl: string; - @Column('varchar', { + @Column("varchar", { length: 512, - default: 'https://codeberg.org/calckey/calckey/issues/new', + default: "https://codeberg.org/calckey/calckey/issues/new", nullable: true, }) public feedbackUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 8192, nullable: true, }) public defaultLightTheme: string | null; - @Column('varchar', { + @Column("varchar", { length: 8192, nullable: true, }) public defaultDarkTheme: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public useObjectStorage: boolean; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStorageBucket: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStoragePrefix: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStorageBaseUrl: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStorageEndpoint: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStorageRegion: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStorageAccessKey: string | null; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, }) public objectStorageSecretKey: string | null; - @Column('integer', { + @Column("integer", { nullable: true, }) public objectStoragePort: number | null; - @Column('boolean', { + @Column("boolean", { default: true, }) public objectStorageUseSSL: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public objectStorageUseProxy: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public objectStorageSetPublicRead: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public objectStorageS3ForcePathStyle: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public enableIpLogging: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public enableActiveEmailValidation: boolean; - @Column('jsonb', { + @Column("jsonb", { default: {}, }) public experimentalFeatures: Record; diff --git a/packages/backend/src/models/entities/moderation-log.ts b/packages/backend/src/models/entities/moderation-log.ts index cc745e0d2..26bf1cdfa 100644 --- a/packages/backend/src/models/entities/moderation-log.ts +++ b/packages/backend/src/models/entities/moderation-log.ts @@ -14,8 +14,8 @@ export class ModerationLog { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the ModerationLog.', + @Column("timestamp with time zone", { + comment: "The created date of the ModerationLog.", }) public createdAt: Date; @@ -23,17 +23,17 @@ export class ModerationLog { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, }) public type: string; - @Column('jsonb') + @Column("jsonb") public info: Record; } diff --git a/packages/backend/src/models/entities/muted-note.ts b/packages/backend/src/models/entities/muted-note.ts index 11a6ae95d..0ee245aea 100644 --- a/packages/backend/src/models/entities/muted-note.ts +++ b/packages/backend/src/models/entities/muted-note.ts @@ -12,7 +12,7 @@ import { id } from "../id.js"; import { mutedNoteReasons } from "../../types.js"; @Entity() -@Index(['noteId', 'userId'], { unique: true }) +@Index(["noteId", "userId"], { unique: true }) export class MutedNote { @PrimaryColumn(id()) public id: string; @@ -20,12 +20,12 @@ export class MutedNote { @Index() @Column({ ...id(), - comment: 'The note ID.', + comment: "The note ID.", }) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; @@ -33,12 +33,12 @@ export class MutedNote { @Index() @Column({ ...id(), - comment: 'The user ID.', + comment: "The user ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -47,9 +47,9 @@ export class MutedNote { * ミュートされた理由。 */ @Index() - @Column('enum', { + @Column("enum", { enum: mutedNoteReasons, - comment: 'The reason of the MutedNote.', + comment: "The reason of the MutedNote.", }) public reason: typeof mutedNoteReasons[number]; } diff --git a/packages/backend/src/models/entities/muting.ts b/packages/backend/src/models/entities/muting.ts index 561bcfb95..603619b46 100644 --- a/packages/backend/src/models/entities/muting.ts +++ b/packages/backend/src/models/entities/muting.ts @@ -10,19 +10,19 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['muterId', 'muteeId'], { unique: true }) +@Index(["muterId", "muteeId"], { unique: true }) export class Muting { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Muting.', + @Column("timestamp with time zone", { + comment: "The created date of the Muting.", }) public createdAt: Date; @Index() - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public expiresAt: Date | null; @@ -30,12 +30,12 @@ export class Muting { @Index() @Column({ ...id(), - comment: 'The mutee user ID.', + comment: "The mutee user ID.", }) public muteeId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public mutee: User | null; @@ -43,12 +43,12 @@ export class Muting { @Index() @Column({ ...id(), - comment: 'The muter user ID.', + comment: "The muter user ID.", }) public muterId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public muter: User | null; diff --git a/packages/backend/src/models/entities/note-edit.ts b/packages/backend/src/models/entities/note-edit.ts index a65375efb..8761e2b15 100644 --- a/packages/backend/src/models/entities/note-edit.ts +++ b/packages/backend/src/models/entities/note-edit.ts @@ -18,34 +18,36 @@ export class NoteEdit { @Index() @Column({ ...id(), - comment: 'The ID of note.', + comment: "The ID of note.", }) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; - @Column('text', { + @Column("text", { nullable: true, }) public text: string | null; - @Column('varchar', { - length: 512, nullable: true, + @Column("varchar", { + length: 512, + nullable: true, }) public cw: string | null; @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public fileIds: DriveFile["id"][]; - @Column('timestamp with time zone', { - comment: 'The updated date of the Note.', + @Column("timestamp with time zone", { + comment: "The updated date of the Note.", }) public updatedAt: Date; } diff --git a/packages/backend/src/models/entities/note-favorite.ts b/packages/backend/src/models/entities/note-favorite.ts index ab12d8b1b..19641ecf4 100644 --- a/packages/backend/src/models/entities/note-favorite.ts +++ b/packages/backend/src/models/entities/note-favorite.ts @@ -11,13 +11,13 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'noteId'], { unique: true }) +@Index(["userId", "noteId"], { unique: true }) export class NoteFavorite { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the NoteFavorite.', + @Column("timestamp with time zone", { + comment: "The created date of the NoteFavorite.", }) public createdAt: Date; @@ -25,8 +25,8 @@ export class NoteFavorite { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -34,8 +34,8 @@ export class NoteFavorite { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/note-reaction.ts b/packages/backend/src/models/entities/note-reaction.ts index 0e51c33b1..5e2a8d3e8 100644 --- a/packages/backend/src/models/entities/note-reaction.ts +++ b/packages/backend/src/models/entities/note-reaction.ts @@ -11,14 +11,14 @@ import { Note } from "./note.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'noteId'], { unique: true }) +@Index(["userId", "noteId"], { unique: true }) export class NoteReaction { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the NoteReaction.', + @Column("timestamp with time zone", { + comment: "The created date of the NoteReaction.", }) public createdAt: Date; @@ -26,8 +26,8 @@ export class NoteReaction { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user?: User | null; @@ -36,15 +36,15 @@ export class NoteReaction { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note?: Note | null; // TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため) - @Column('varchar', { + @Column("varchar", { length: 260, }) public reaction: string; diff --git a/packages/backend/src/models/entities/note-thread-muting.ts b/packages/backend/src/models/entities/note-thread-muting.ts index 2985b195f..704b32850 100644 --- a/packages/backend/src/models/entities/note-thread-muting.ts +++ b/packages/backend/src/models/entities/note-thread-muting.ts @@ -11,13 +11,12 @@ import { Note } from "./note.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'threadId'], { unique: true }) +@Index(["userId", "threadId"], { unique: true }) export class NoteThreadMuting { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - }) + @Column("timestamp with time zone", {}) public createdAt: Date; @Index() @@ -26,14 +25,14 @@ export class NoteThreadMuting { }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @Index() - @Column('varchar', { + @Column("varchar", { length: 256, }) public threadId: string; diff --git a/packages/backend/src/models/entities/note-unread.ts b/packages/backend/src/models/entities/note-unread.ts index d5bba7221..95695cbc8 100644 --- a/packages/backend/src/models/entities/note-unread.ts +++ b/packages/backend/src/models/entities/note-unread.ts @@ -12,7 +12,7 @@ import { id } from "../id.js"; import type { Channel } from "./channel.js"; @Entity() -@Index(['userId', 'noteId'], { unique: true }) +@Index(["userId", "noteId"], { unique: true }) export class NoteUnread { @PrimaryColumn(id()) public id: string; @@ -21,8 +21,8 @@ export class NoteUnread { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -31,8 +31,8 @@ export class NoteUnread { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; @@ -41,21 +41,21 @@ export class NoteUnread { * メンションか否か */ @Index() - @Column('boolean') + @Column("boolean") public isMentioned: boolean; /** * ダイレクト投稿か否か */ @Index() - @Column('boolean') + @Column("boolean") public isSpecified: boolean; //#region Denormalized fields @Index() @Column({ ...id(), - comment: '[Denormalized]', + comment: "[Denormalized]", }) public noteUserId: User["id"]; @@ -63,7 +63,7 @@ export class NoteUnread { @Column({ ...id(), nullable: true, - comment: '[Denormalized]', + comment: "[Denormalized]", }) public noteChannelId: Channel["id"] | null; //#endregion diff --git a/packages/backend/src/models/entities/note-watching.ts b/packages/backend/src/models/entities/note-watching.ts index 7ac3e8e29..724b084af 100644 --- a/packages/backend/src/models/entities/note-watching.ts +++ b/packages/backend/src/models/entities/note-watching.ts @@ -11,26 +11,26 @@ import { Note } from "./note.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'noteId'], { unique: true }) +@Index(["userId", "noteId"], { unique: true }) export class NoteWatching { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the NoteWatching.', + @Column("timestamp with time zone", { + comment: "The created date of the NoteWatching.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The watcher ID.', + comment: "The watcher ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -38,12 +38,12 @@ export class NoteWatching { @Index() @Column({ ...id(), - comment: 'The target Note ID.', + comment: "The target Note ID.", }) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; @@ -52,7 +52,7 @@ export class NoteWatching { @Index() @Column({ ...id(), - comment: '[Denormalized]', + comment: "[Denormalized]", }) public noteUserId: Note["userId"]; //#endregion diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index f4e76c1db..edcfdb635 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -13,16 +13,16 @@ import { noteVisibilities } from "../../types.js"; import { Channel } from "./channel.js"; @Entity() -@Index('IDX_NOTE_TAGS', { synchronize: false }) -@Index('IDX_NOTE_MENTIONS', { synchronize: false }) -@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false }) +@Index("IDX_NOTE_TAGS", { synchronize: false }) +@Index("IDX_NOTE_MENTIONS", { synchronize: false }) +@Index("IDX_NOTE_VISIBLE_USER_IDS", { synchronize: false }) export class Note { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Note.', + @Column("timestamp with time zone", { + comment: "The created date of the Note.", }) public createdAt: Date; @@ -30,12 +30,12 @@ export class Note { @Column({ ...id(), nullable: true, - comment: 'The ID of reply target.', + comment: "The ID of reply target.", }) public replyId: Note["id"] | null; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public reply: Note | null; @@ -44,66 +44,69 @@ export class Note { @Column({ ...id(), nullable: true, - comment: 'The ID of renote target.', + comment: "The ID of renote target.", }) public renoteId: Note["id"] | null; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public renote: Note | null; @Index() - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public threadId: string | null; - @Column('text', { + @Column("text", { nullable: true, }) public text: string | null; - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public name: string | null; - @Column('varchar', { - length: 512, nullable: true, + @Column("varchar", { + length: 512, + nullable: true, }) public cw: string | null; @Index() @Column({ ...id(), - comment: 'The ID of author.', + comment: "The ID of author.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public localOnly: boolean; - @Column('smallint', { + @Column("smallint", { default: 0, }) public renoteCount: number; - @Column('smallint', { + @Column("smallint", { default: 0, }) public repliesCount: number; - @Column('jsonb', { + @Column("jsonb", { default: {}, }) public reactions: Record; @@ -115,71 +118,84 @@ export class Note { * followers ... フォロワーのみ * specified ... visibleUserIds で指定したユーザーのみ */ - @Column('enum', { enum: noteVisibilities }) + @Column("enum", { enum: noteVisibilities }) public visibility: typeof noteVisibilities[number]; @Index({ unique: true }) - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of a note. it will be null when the note is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: "The URI of a note. it will be null when the note is local.", }) public uri: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The human readable url of a note. it will be null when the note is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The human readable url of a note. it will be null when the note is local.", }) public url: string | null; - @Column('integer', { - default: 0, select: false, + @Column("integer", { + default: 0, + select: false, }) public score: number; @Index() @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public fileIds: DriveFile["id"][]; @Index() - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public attachedFileTypes: string[]; @Index() @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public visibleUserIds: User["id"][]; @Index() @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public mentions: User["id"][]; - @Column('text', { - default: '[]', + @Column("text", { + default: "[]", }) public mentionedRemoteUsers: string; - @Column('varchar', { - length: 128, array: true, default: '{}', + @Column("varchar", { + length: 128, + array: true, + default: "{}", }) public emojis: string[]; @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', + @Column("varchar", { + length: 128, + array: true, + default: "{}", }) public tags: string[]; - @Column('boolean', { + @Column("boolean", { default: false, }) public hasPoll: boolean; @@ -188,53 +204,56 @@ export class Note { @Column({ ...id(), nullable: true, - comment: 'The ID of source channel.', + comment: "The ID of source channel.", }) public channelId: Channel["id"] | null; - @ManyToOne(type => Channel, { - onDelete: 'CASCADE', + @ManyToOne((type) => Channel, { + onDelete: "CASCADE", }) @JoinColumn() public channel: Channel | null; //#region Denormalized fields @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public userHost: string | null; @Column({ ...id(), nullable: true, - comment: '[Denormalized]', + comment: "[Denormalized]", }) public replyUserId: User["id"] | null; - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public replyUserHost: string | null; @Column({ ...id(), nullable: true, - comment: '[Denormalized]', + comment: "[Denormalized]", }) public renoteUserId: User["id"] | null; - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public renoteUserHost: string | null; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, - comment: 'The updated date of the Note.', + comment: "The updated date of the Note.", }) public updatedAt: Date; //#endregion diff --git a/packages/backend/src/models/entities/notification.ts b/packages/backend/src/models/entities/notification.ts index 2c55e988f..da23f7d3e 100644 --- a/packages/backend/src/models/entities/notification.ts +++ b/packages/backend/src/models/entities/notification.ts @@ -20,8 +20,8 @@ export class Notification { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Notification.', + @Column("timestamp with time zone", { + comment: "The created date of the Notification.", }) public createdAt: Date; @@ -31,12 +31,12 @@ export class Notification { @Index() @Column({ ...id(), - comment: 'The ID of recipient user of the Notification.', + comment: "The ID of recipient user of the Notification.", }) public notifieeId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public notifiee: User | null; @@ -48,12 +48,12 @@ export class Notification { @Column({ ...id(), nullable: true, - comment: 'The ID of sender user of the Notification.', + comment: "The ID of sender user of the Notification.", }) public notifierId: User["id"] | null; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public notifier: User | null; @@ -74,9 +74,9 @@ export class Notification { * app - App notifications. */ @Index() - @Column('enum', { + @Column("enum", { enum: notificationTypes, - comment: 'The type of the Notification.', + comment: "The type of the Notification.", }) public type: typeof notificationTypes[number]; @@ -84,9 +84,9 @@ export class Notification { * Whether the notification was read. */ @Index() - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the notification was read.', + comment: "Whether the notification was read.", }) public isRead: boolean; @@ -96,8 +96,8 @@ export class Notification { }) public noteId: Note["id"] | null; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; @@ -108,8 +108,8 @@ export class Notification { }) public followRequestId: FollowRequest["id"] | null; - @ManyToOne(type => FollowRequest, { - onDelete: 'CASCADE', + @ManyToOne((type) => FollowRequest, { + onDelete: "CASCADE", }) @JoinColumn() public followRequest: FollowRequest | null; @@ -120,18 +120,19 @@ export class Notification { }) public userGroupInvitationId: UserGroupInvitation["id"] | null; - @ManyToOne(type => UserGroupInvitation, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserGroupInvitation, { + onDelete: "CASCADE", }) @JoinColumn() public userGroupInvitation: UserGroupInvitation | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public reaction: string | null; - @Column('integer', { + @Column("integer", { nullable: true, }) public choice: number | null; @@ -139,8 +140,9 @@ export class Notification { /** * App notification body */ - @Column('varchar', { - length: 2048, nullable: true, + @Column("varchar", { + length: 2048, + nullable: true, }) public customBody: string | null; @@ -148,8 +150,9 @@ export class Notification { * App notification header * (If omitted, it is expected to be displayed with the app name) */ - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public customHeader: string | null; @@ -157,8 +160,9 @@ export class Notification { * App notification icon (URL) * (If omitted, it is expected to be displayed as an app icon) */ - @Column('varchar', { - length: 1024, nullable: true, + @Column("varchar", { + length: 1024, + nullable: true, }) public customIcon: string | null; @@ -172,8 +176,8 @@ export class Notification { }) public appAccessTokenId: AccessToken["id"] | null; - @ManyToOne(type => AccessToken, { - onDelete: 'CASCADE', + @ManyToOne((type) => AccessToken, { + onDelete: "CASCADE", }) @JoinColumn() public appAccessToken: AccessToken | null; diff --git a/packages/backend/src/models/entities/page-like.ts b/packages/backend/src/models/entities/page-like.ts index 75f4dc49b..6304e0b24 100644 --- a/packages/backend/src/models/entities/page-like.ts +++ b/packages/backend/src/models/entities/page-like.ts @@ -11,20 +11,20 @@ import { id } from "../id.js"; import { Page } from "./page.js"; @Entity() -@Index(['userId', 'pageId'], { unique: true }) +@Index(["userId", "pageId"], { unique: true }) export class PageLike { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; @Index() @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -32,8 +32,8 @@ export class PageLike { @Column(id()) public pageId: Page["id"]; - @ManyToOne(type => Page, { - onDelete: 'CASCADE', + @ManyToOne((type) => Page, { + onDelete: "CASCADE", }) @JoinColumn() public page: Page | null; diff --git a/packages/backend/src/models/entities/page.ts b/packages/backend/src/models/entities/page.ts index 5fe9f5208..d0733c8ce 100644 --- a/packages/backend/src/models/entities/page.ts +++ b/packages/backend/src/models/entities/page.ts @@ -11,51 +11,52 @@ import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; @Entity() -@Index(['userId', 'name'], { unique: true }) +@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.', + @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.', + @Column("timestamp with time zone", { + comment: "The updated date of the Page.", }) public updatedAt: Date; - @Column('varchar', { + @Column("varchar", { length: 256, }) public title: string; @Index() - @Column('varchar', { + @Column("varchar", { length: 256, }) public name: string; - @Column('varchar', { - length: 256, nullable: true, + @Column("varchar", { + length: 256, + nullable: true, }) public summary: string | null; - @Column('boolean') + @Column("boolean") public alignCenter: boolean; - @Column('boolean') + @Column("boolean") public isPublic: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public hideTitleWhenPinned: boolean; - @Column('varchar', { + @Column("varchar", { length: 32, }) public font: string; @@ -63,12 +64,12 @@ export class Page { @Index() @Column({ ...id(), - comment: 'The ID of author.', + comment: "The ID of author.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -79,25 +80,25 @@ export class Page { }) public eyeCatchingImageId: DriveFile["id"] | null; - @ManyToOne(type => DriveFile, { - onDelete: 'CASCADE', + @ManyToOne((type) => DriveFile, { + onDelete: "CASCADE", }) @JoinColumn() public eyeCatchingImage: DriveFile | null; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public content: Record[]; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public variables: Record[]; - @Column('varchar', { + @Column("varchar", { length: 16384, - default: '', + default: "", }) public script: string; @@ -106,17 +107,18 @@ export class Page { * followers ... フォロワーのみ * specified ... visibleUserIds で指定したユーザーのみ */ - @Column('enum', { enum: ['public', 'followers', 'specified'] }) + @Column("enum", { enum: ["public", "followers", "specified"] }) public visibility: "public" | "followers" | "specified"; @Index() @Column({ ...id(), - array: true, default: '{}', + array: true, + default: "{}", }) public visibleUserIds: User["id"][]; - @Column('integer', { + @Column("integer", { default: 0, }) public likedCount: number; diff --git a/packages/backend/src/models/entities/password-reset-request.ts b/packages/backend/src/models/entities/password-reset-request.ts index 4c681d4f7..ab0bccbbe 100644 --- a/packages/backend/src/models/entities/password-reset-request.ts +++ b/packages/backend/src/models/entities/password-reset-request.ts @@ -14,11 +14,11 @@ export class PasswordResetRequest { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; @Index({ unique: true }) - @Column('varchar', { + @Column("varchar", { length: 256, }) public token: string; @@ -29,8 +29,8 @@ export class PasswordResetRequest { }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; diff --git a/packages/backend/src/models/entities/poll-vote.ts b/packages/backend/src/models/entities/poll-vote.ts index 0649951cf..d59a720c3 100644 --- a/packages/backend/src/models/entities/poll-vote.ts +++ b/packages/backend/src/models/entities/poll-vote.ts @@ -11,14 +11,14 @@ import { Note } from "./note.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'noteId', 'choice'], { unique: true }) +@Index(["userId", "noteId", "choice"], { unique: true }) export class PollVote { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the PollVote.', + @Column("timestamp with time zone", { + comment: "The created date of the PollVote.", }) public createdAt: Date; @@ -26,8 +26,8 @@ export class PollVote { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -36,12 +36,12 @@ export class PollVote { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; - @Column('integer') + @Column("integer") public choice: number; } diff --git a/packages/backend/src/models/entities/poll.ts b/packages/backend/src/models/entities/poll.ts index 28a70b3c7..405cca222 100644 --- a/packages/backend/src/models/entities/poll.ts +++ b/packages/backend/src/models/entities/poll.ts @@ -16,48 +16,51 @@ export class Poll { @PrimaryColumn(id()) public noteId: Note["id"]; - @OneToOne(type => Note, { - onDelete: 'CASCADE', + @OneToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public expiresAt: Date | null; - @Column('boolean') + @Column("boolean") public multiple: boolean; - @Column('varchar', { - length: 256, array: true, default: '{}', + @Column("varchar", { + length: 256, + array: true, + default: "{}", }) public choices: string[]; - @Column('integer', { + @Column("integer", { array: true, }) public votes: number[]; //#region Denormalized fields - @Column('enum', { + @Column("enum", { enum: noteVisibilities, - comment: '[Denormalized]', + comment: "[Denormalized]", }) public noteVisibility: typeof noteVisibilities[number]; @Index() @Column({ ...id(), - comment: '[Denormalized]', + comment: "[Denormalized]", }) public userId: User["id"]; @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public userHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/promo-note.ts b/packages/backend/src/models/entities/promo-note.ts index 4daacd246..caa64927e 100644 --- a/packages/backend/src/models/entities/promo-note.ts +++ b/packages/backend/src/models/entities/promo-note.ts @@ -15,20 +15,20 @@ export class PromoNote { @PrimaryColumn(id()) public noteId: Note["id"]; - @OneToOne(type => Note, { - onDelete: 'CASCADE', + @OneToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public expiresAt: Date; //#region Denormalized fields @Index() @Column({ ...id(), - comment: '[Denormalized]', + comment: "[Denormalized]", }) public userId: User["id"]; //#endregion diff --git a/packages/backend/src/models/entities/promo-read.ts b/packages/backend/src/models/entities/promo-read.ts index 5938bfde9..b31877dc3 100644 --- a/packages/backend/src/models/entities/promo-read.ts +++ b/packages/backend/src/models/entities/promo-read.ts @@ -11,13 +11,13 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'noteId'], { unique: true }) +@Index(["userId", "noteId"], { unique: true }) export class PromoRead { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the PromoRead.', + @Column("timestamp with time zone", { + comment: "The created date of the PromoRead.", }) public createdAt: Date; @@ -25,8 +25,8 @@ export class PromoRead { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -34,8 +34,8 @@ export class PromoRead { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/registration-tickets.ts b/packages/backend/src/models/entities/registration-tickets.ts index af785fbc0..549f05d07 100644 --- a/packages/backend/src/models/entities/registration-tickets.ts +++ b/packages/backend/src/models/entities/registration-tickets.ts @@ -6,11 +6,11 @@ export class RegistrationTicket { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; @Index({ unique: true }) - @Column('varchar', { + @Column("varchar", { length: 64, }) public code: string; diff --git a/packages/backend/src/models/entities/registry-item.ts b/packages/backend/src/models/entities/registry-item.ts index 655573883..d044222e6 100644 --- a/packages/backend/src/models/entities/registry-item.ts +++ b/packages/backend/src/models/entities/registry-item.ts @@ -15,51 +15,55 @@ export class RegistryItem { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the RegistryItem.', + @Column("timestamp with time zone", { + comment: "The created date of the RegistryItem.", }) public createdAt: Date; - @Column('timestamp with time zone', { - comment: 'The updated date of the RegistryItem.', + @Column("timestamp with time zone", { + comment: "The updated date of the RegistryItem.", }) public updatedAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 1024, - comment: 'The key of the RegistryItem.', + comment: "The key of the RegistryItem.", }) public key: string; - @Column('jsonb', { - default: {}, nullable: true, - comment: 'The value of the RegistryItem.', + @Column("jsonb", { + default: {}, + nullable: true, + comment: "The value of the RegistryItem.", }) public value: any | null; @Index() - @Column('varchar', { - length: 1024, array: true, default: '{}', + @Column("varchar", { + length: 1024, + array: true, + default: "{}", }) public scope: string[]; // サードパーティアプリに開放するときのためのカラム @Index() - @Column('varchar', { - length: 512, nullable: true, + @Column("varchar", { + length: 512, + nullable: true, }) public domain: string | null; } diff --git a/packages/backend/src/models/entities/relay.ts b/packages/backend/src/models/entities/relay.ts index 82c0779ff..c7509dcf4 100644 --- a/packages/backend/src/models/entities/relay.ts +++ b/packages/backend/src/models/entities/relay.ts @@ -7,13 +7,14 @@ export class Relay { public id: string; @Index({ unique: true }) - @Column('varchar', { - length: 512, nullable: false, + @Column("varchar", { + length: 512, + nullable: false, }) public inbox: string; - @Column('enum', { - enum: ['requesting', 'accepted', 'rejected'], + @Column("enum", { + enum: ["requesting", "accepted", "rejected"], }) public status: "requesting" | "accepted" | "rejected"; } diff --git a/packages/backend/src/models/entities/renote-muting.ts b/packages/backend/src/models/entities/renote-muting.ts index 64ec7f583..e8856492f 100644 --- a/packages/backend/src/models/entities/renote-muting.ts +++ b/packages/backend/src/models/entities/renote-muting.ts @@ -28,7 +28,7 @@ export class RenoteMuting { }) public muteeId: User["id"]; - @ManyToOne(type => User, { + @ManyToOne((type) => User, { onDelete: "CASCADE", }) @JoinColumn() @@ -41,7 +41,7 @@ export class RenoteMuting { }) public muterId: User["id"]; - @ManyToOne(type => User, { + @ManyToOne((type) => User, { onDelete: "CASCADE", }) @JoinColumn() diff --git a/packages/backend/src/models/entities/signin.ts b/packages/backend/src/models/entities/signin.ts index 785991823..517e71c8f 100644 --- a/packages/backend/src/models/entities/signin.ts +++ b/packages/backend/src/models/entities/signin.ts @@ -14,8 +14,8 @@ export class Signin { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the Signin.', + @Column("timestamp with time zone", { + comment: "The created date of the Signin.", }) public createdAt: Date; @@ -23,20 +23,20 @@ export class Signin { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, }) public ip: string; - @Column('jsonb') + @Column("jsonb") public headers: Record; - @Column('boolean') + @Column("boolean") public success: boolean; } diff --git a/packages/backend/src/models/entities/sw-subscription.ts b/packages/backend/src/models/entities/sw-subscription.ts index 8f18688ea..f7823fbaa 100644 --- a/packages/backend/src/models/entities/sw-subscription.ts +++ b/packages/backend/src/models/entities/sw-subscription.ts @@ -14,35 +14,35 @@ export class SwSubscription { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; @Index() @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 512, }) public endpoint: string; - @Column('varchar', { + @Column("varchar", { length: 256, }) public auth: string; - @Column('varchar', { + @Column("varchar", { length: 128, }) public publickey: string; - @Column('boolean', { + @Column("boolean", { default: false, }) public sendReadMessage: boolean; diff --git a/packages/backend/src/models/entities/used-username.ts b/packages/backend/src/models/entities/used-username.ts index a069205a5..d00a25991 100644 --- a/packages/backend/src/models/entities/used-username.ts +++ b/packages/backend/src/models/entities/used-username.ts @@ -2,12 +2,12 @@ import { PrimaryColumn, Entity, Column } from "typeorm"; @Entity() export class UsedUsername { - @PrimaryColumn('varchar', { + @PrimaryColumn("varchar", { length: 128, }) public username: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; constructor(data: Partial) { diff --git a/packages/backend/src/models/entities/user-group-invitation.ts b/packages/backend/src/models/entities/user-group-invitation.ts index 8037b30e1..fa2655ab6 100644 --- a/packages/backend/src/models/entities/user-group-invitation.ts +++ b/packages/backend/src/models/entities/user-group-invitation.ts @@ -11,25 +11,25 @@ import { UserGroup } from "./user-group.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'userGroupId'], { unique: true }) +@Index(["userId", "userGroupId"], { unique: true }) export class UserGroupInvitation { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the UserGroupInvitation.', + @Column("timestamp with time zone", { + comment: "The created date of the UserGroupInvitation.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The user ID.', + comment: "The user ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -37,12 +37,12 @@ export class UserGroupInvitation { @Index() @Column({ ...id(), - comment: 'The group ID.', + comment: "The group ID.", }) public userGroupId: UserGroup["id"]; - @ManyToOne(type => UserGroup, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserGroup, { + onDelete: "CASCADE", }) @JoinColumn() public userGroup: UserGroup | null; diff --git a/packages/backend/src/models/entities/user-group-joining.ts b/packages/backend/src/models/entities/user-group-joining.ts index 6d503b274..78f820d0e 100644 --- a/packages/backend/src/models/entities/user-group-joining.ts +++ b/packages/backend/src/models/entities/user-group-joining.ts @@ -11,25 +11,25 @@ import { UserGroup } from "./user-group.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'userGroupId'], { unique: true }) +@Index(["userId", "userGroupId"], { unique: true }) export class UserGroupJoining { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the UserGroupJoining.', + @Column("timestamp with time zone", { + comment: "The created date of the UserGroupJoining.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The user ID.', + comment: "The user ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -37,12 +37,12 @@ export class UserGroupJoining { @Index() @Column({ ...id(), - comment: 'The group ID.', + comment: "The group ID.", }) public userGroupId: UserGroup["id"]; - @ManyToOne(type => UserGroup, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserGroup, { + onDelete: "CASCADE", }) @JoinColumn() public userGroup: UserGroup | null; diff --git a/packages/backend/src/models/entities/user-group.ts b/packages/backend/src/models/entities/user-group.ts index 38e5af334..23876ec8b 100644 --- a/packages/backend/src/models/entities/user-group.ts +++ b/packages/backend/src/models/entities/user-group.ts @@ -15,12 +15,12 @@ export class UserGroup { public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the UserGroup.', + @Column("timestamp with time zone", { + comment: "The created date of the UserGroup.", }) public createdAt: Date; - @Column('varchar', { + @Column("varchar", { length: 256, }) public name: string; @@ -28,17 +28,17 @@ export class UserGroup { @Index() @Column({ ...id(), - comment: 'The ID of owner.', + comment: "The ID of owner.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public isPrivate: boolean; diff --git a/packages/backend/src/models/entities/user-ip.ts b/packages/backend/src/models/entities/user-ip.ts index 6b88d5221..c30e56b66 100644 --- a/packages/backend/src/models/entities/user-ip.ts +++ b/packages/backend/src/models/entities/user-ip.ts @@ -12,20 +12,19 @@ import { Note } from "./note.js"; import type { User } from "./user.js"; @Entity() -@Index(['userId', 'ip'], { unique: true }) +@Index(["userId", "ip"], { unique: true }) export class UserIp { @PrimaryGeneratedColumn() public id: string; - @Column('timestamp with time zone', { - }) + @Column("timestamp with time zone", {}) public createdAt: Date; @Index() @Column(id()) public userId: User["id"]; - @Column('varchar', { + @Column("varchar", { length: 128, }) public ip: string; diff --git a/packages/backend/src/models/entities/user-keypair.ts b/packages/backend/src/models/entities/user-keypair.ts index 212e742b9..f98384f53 100644 --- a/packages/backend/src/models/entities/user-keypair.ts +++ b/packages/backend/src/models/entities/user-keypair.ts @@ -7,18 +7,18 @@ export class UserKeypair { @PrimaryColumn(id()) public userId: User["id"]; - @OneToOne(type => User, { - onDelete: 'CASCADE', + @OneToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 4096, }) public publicKey: string; - @Column('varchar', { + @Column("varchar", { length: 4096, }) public privateKey: string; diff --git a/packages/backend/src/models/entities/user-list-joining.ts b/packages/backend/src/models/entities/user-list-joining.ts index e52fa7b39..4caa71ad3 100644 --- a/packages/backend/src/models/entities/user-list-joining.ts +++ b/packages/backend/src/models/entities/user-list-joining.ts @@ -11,25 +11,25 @@ import { UserList } from "./user-list.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'userListId'], { unique: true }) +@Index(["userId", "userListId"], { unique: true }) export class UserListJoining { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the UserListJoining.', + @Column("timestamp with time zone", { + comment: "The created date of the UserListJoining.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The user ID.', + comment: "The user ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -37,12 +37,12 @@ export class UserListJoining { @Index() @Column({ ...id(), - comment: 'The list ID.', + comment: "The list ID.", }) public userListId: UserList["id"]; - @ManyToOne(type => UserList, { - onDelete: 'CASCADE', + @ManyToOne((type) => UserList, { + onDelete: "CASCADE", }) @JoinColumn() public userList: UserList | null; diff --git a/packages/backend/src/models/entities/user-list.ts b/packages/backend/src/models/entities/user-list.ts index 7c4345230..3c95d44d6 100644 --- a/packages/backend/src/models/entities/user-list.ts +++ b/packages/backend/src/models/entities/user-list.ts @@ -14,27 +14,27 @@ export class UserList { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the UserList.', + @Column("timestamp with time zone", { + comment: "The created date of the UserList.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the UserList.', + comment: "The name of the UserList.", }) public name: string; } diff --git a/packages/backend/src/models/entities/user-note-pining.ts b/packages/backend/src/models/entities/user-note-pining.ts index dc6d61f7e..c30fe1e02 100644 --- a/packages/backend/src/models/entities/user-note-pining.ts +++ b/packages/backend/src/models/entities/user-note-pining.ts @@ -11,13 +11,13 @@ import { User } from "./user.js"; import { id } from "../id.js"; @Entity() -@Index(['userId', 'noteId'], { unique: true }) +@Index(["userId", "noteId"], { unique: true }) export class UserNotePining { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the UserNotePinings.', + @Column("timestamp with time zone", { + comment: "The created date of the UserNotePinings.", }) public createdAt: Date; @@ -25,8 +25,8 @@ export class UserNotePining { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @@ -34,8 +34,8 @@ export class UserNotePining { @Column(id()) public noteId: Note["id"]; - @ManyToOne(type => Note, { - onDelete: 'CASCADE', + @ManyToOne((type) => Note, { + onDelete: "CASCADE", }) @JoinColumn() public note: Note | null; diff --git a/packages/backend/src/models/entities/user-pending.ts b/packages/backend/src/models/entities/user-pending.ts index cac85d1c0..18ae5ad99 100644 --- a/packages/backend/src/models/entities/user-pending.ts +++ b/packages/backend/src/models/entities/user-pending.ts @@ -6,26 +6,26 @@ export class UserPending { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone') + @Column("timestamp with time zone") public createdAt: Date; @Index({ unique: true }) - @Column('varchar', { + @Column("varchar", { length: 128, }) public code: string; - @Column('varchar', { + @Column("varchar", { length: 128, }) public username: string; - @Column('varchar', { + @Column("varchar", { length: 128, }) public email: string; - @Column('varchar', { + @Column("varchar", { length: 128, }) public password: string; diff --git a/packages/backend/src/models/entities/user-profile.ts b/packages/backend/src/models/entities/user-profile.ts index a5eca6f48..119eecdc7 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -18,31 +18,34 @@ export class UserProfile { @PrimaryColumn(id()) public userId: User["id"]; - @OneToOne(type => User, { - onDelete: 'CASCADE', + @OneToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { - length: 128, nullable: true, - comment: 'The location of the User.', + @Column("varchar", { + length: 128, + nullable: true, + comment: "The location of the User.", }) public location: string | null; - @Column('char', { - length: 10, nullable: true, - comment: 'The birthday (YYYY-MM-DD) of the User.', + @Column("char", { + length: 10, + nullable: true, + comment: "The birthday (YYYY-MM-DD) of the User.", }) public birthday: string | null; - @Column('varchar', { - length: 2048, nullable: true, - comment: 'The description (bio) of the User.', + @Column("varchar", { + length: 2048, + nullable: true, + comment: "The description (bio) of the User.", }) public description: string | null; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public fields: { @@ -50,136 +53,145 @@ export class UserProfile { value: string; }[]; - @Column('varchar', { - length: 32, nullable: true, + @Column("varchar", { + length: 32, + nullable: true, }) public lang: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'Remote URL of the user.', + @Column("varchar", { + length: 512, + nullable: true, + comment: "Remote URL of the user.", }) public url: string | null; - @Column('varchar', { - length: 128, nullable: true, - comment: 'The email address of the User.', + @Column("varchar", { + length: 128, + nullable: true, + comment: "The email address of the User.", }) public email: string | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public emailVerifyCode: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public emailVerified: boolean; - @Column('jsonb', { - default: ['follow', 'receiveFollowRequest', 'groupInvited'], + @Column("jsonb", { + default: ["follow", "receiveFollowRequest", "groupInvited"], }) public emailNotificationTypes: string[]; - @Column('boolean', { + @Column("boolean", { default: false, }) public publicReactions: boolean; - @Column('enum', { + @Column("enum", { enum: ffVisibility, - default: 'public', + default: "public", }) public ffVisibility: typeof ffVisibility[number]; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public twoFactorTempSecret: string | null; - @Column('varchar', { - length: 128, nullable: true, + @Column("varchar", { + length: 128, + nullable: true, }) public twoFactorSecret: string | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public twoFactorEnabled: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public securityKeysAvailable: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public usePasswordLessLogin: boolean; - @Column('varchar', { - length: 128, nullable: true, - comment: 'The password hash of the User. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 128, + nullable: true, + comment: + "The password hash of the User. It will be null if the origin of the user is local.", }) public password: string | null; - @Column('varchar', { - length: 8192, default: '', + @Column("varchar", { + length: 8192, + default: "", }) public moderationNote: string | null; // TODO: そのうち消す - @Column('jsonb', { + @Column("jsonb", { default: {}, - comment: 'The client-specific data of the User.', + comment: "The client-specific data of the User.", }) public clientData: Record; // TODO: そのうち消す - @Column('jsonb', { + @Column("jsonb", { default: {}, - comment: 'The room data of the User.', + comment: "The room data of the User.", }) public room: Record; - @Column('boolean', { + @Column("boolean", { default: false, }) public autoAcceptFollowed: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether reject index by crawler.', + comment: "Whether reject index by crawler.", }) public noCrawle: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public preventAiLearning: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public alwaysMarkNsfw: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public autoSensitive: boolean; - @Column('boolean', { + @Column("boolean", { default: false, }) public carefulBot: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public injectFeaturedNote: boolean; - @Column('boolean', { + @Column("boolean", { default: true, }) public receiveAnnouncementEmail: boolean; @@ -190,35 +202,36 @@ export class UserProfile { }) public pinnedPageId: Page["id"] | null; - @OneToOne(type => Page, { - onDelete: 'SET NULL', + @OneToOne((type) => Page, { + onDelete: "SET NULL", }) @JoinColumn() public pinnedPage: Page | null; - @Column('jsonb', { + @Column("jsonb", { default: {}, }) public integrations: Record; @Index() - @Column('boolean', { - default: false, select: false, + @Column("boolean", { + default: false, + select: false, }) public enableWordMute: boolean; - @Column('jsonb', { + @Column("jsonb", { default: [], }) public mutedWords: string[][]; - @Column('jsonb', { + @Column("jsonb", { default: [], - comment: 'List of instances muted by the user.', + comment: "List of instances muted by the user.", }) public mutedInstances: string[]; - @Column('enum', { + @Column("enum", { enum: notificationTypes, array: true, default: [], @@ -227,9 +240,10 @@ export class UserProfile { //#region Denormalized fields @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', + @Column("varchar", { + length: 128, + nullable: true, + comment: "[Denormalized]", }) public userHost: string | null; //#endregion diff --git a/packages/backend/src/models/entities/user-publickey.ts b/packages/backend/src/models/entities/user-publickey.ts index d1a9239d1..83a86b8a3 100644 --- a/packages/backend/src/models/entities/user-publickey.ts +++ b/packages/backend/src/models/entities/user-publickey.ts @@ -14,19 +14,19 @@ export class UserPublickey { @PrimaryColumn(id()) public userId: User["id"]; - @OneToOne(type => User, { - onDelete: 'CASCADE', + @OneToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @Index({ unique: true }) - @Column('varchar', { + @Column("varchar", { length: 256, }) public keyId: string; - @Column('varchar', { + @Column("varchar", { length: 4096, }) public keyPem: string; diff --git a/packages/backend/src/models/entities/user-security-key.ts b/packages/backend/src/models/entities/user-security-key.ts index 3b9d925d9..511cab4ae 100644 --- a/packages/backend/src/models/entities/user-security-key.ts +++ b/packages/backend/src/models/entities/user-security-key.ts @@ -11,8 +11,8 @@ import { id } from "../id.js"; @Entity() export class UserSecurityKey { - @PrimaryColumn('varchar', { - comment: 'Variable-length id given to navigator.credentials.get()', + @PrimaryColumn("varchar", { + comment: "Variable-length id given to navigator.credentials.get()", }) public id: string; @@ -20,27 +20,27 @@ export class UserSecurityKey { @Column(id()) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; @Index() - @Column('varchar', { + @Column("varchar", { comment: - 'Variable-length public key used to verify attestations (hex-encoded).', + "Variable-length public key used to verify attestations (hex-encoded).", }) public publicKey: string; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { comment: - 'The date of the last time the UserSecurityKey was successfully validated.', + "The date of the last time the UserSecurityKey was successfully validated.", }) public lastUsed: Date; - @Column('varchar', { - comment: 'User-defined name for this key', + @Column("varchar", { + comment: "User-defined name for this key", length: 30, }) public name: string; diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts index c23f4f28d..53dc7e60b 100644 --- a/packages/backend/src/models/entities/user.ts +++ b/packages/backend/src/models/entities/user.ts @@ -10,99 +10,101 @@ import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; @Entity() -@Index(['usernameLower', 'host'], { unique: true }) +@Index(["usernameLower", "host"], { unique: true }) export class User { @PrimaryColumn(id()) public id: string; @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the User.', + @Column("timestamp with time zone", { + comment: "The created date of the User.", }) public createdAt: Date; @Index() - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, - comment: 'The updated date of the User.', + comment: "The updated date of the User.", }) public updatedAt: Date | null; - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public lastFetchedAt: Date | null; @Index() - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public lastActiveDate: Date | null; - @Column('boolean', { + @Column("boolean", { default: false, }) public hideOnlineStatus: boolean; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The username of the User.', + comment: "The username of the User.", }) public username: string; @Index() - @Column('varchar', { - length: 128, select: false, - comment: 'The username (lowercased) of the User.', + @Column("varchar", { + length: 128, + select: false, + comment: "The username (lowercased) of the User.", }) public usernameLower: string; - @Column('varchar', { - length: 128, nullable: true, - comment: 'The name of the User.', + @Column("varchar", { + length: 128, + nullable: true, + comment: "The name of the User.", }) public name: string | null; - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of followers.', + comment: "The count of followers.", }) public followersCount: number; - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of following.', + comment: "The count of following.", }) public followingCount: number; - @Column('varchar', { + @Column("varchar", { length: 512, nullable: true, - comment: 'The URI of the new account of the User', + comment: "The URI of the new account of the User", }) public movedToUri: string | null; - @Column('simple-array', { + @Column("simple-array", { nullable: true, - comment: 'URIs the user is known as too', + comment: "URIs the user is known as too", }) public alsoKnownAs: string[] | null; - @Column('integer', { + @Column("integer", { default: 0, - comment: 'The count of notes.', + comment: "The count of notes.", }) public notesCount: number; @Column({ ...id(), nullable: true, - comment: 'The ID of avatar DriveFile.', + comment: "The ID of avatar DriveFile.", }) public avatarId: DriveFile["id"] | null; - @OneToOne(type => DriveFile, { - onDelete: 'SET NULL', + @OneToOne((type) => DriveFile, { + onDelete: "SET NULL", }) @JoinColumn() public avatar: DriveFile | null; @@ -110,143 +112,162 @@ export class User { @Column({ ...id(), nullable: true, - comment: 'The ID of banner DriveFile.', + comment: "The ID of banner DriveFile.", }) public bannerId: DriveFile["id"] | null; - @OneToOne(type => DriveFile, { - onDelete: 'SET NULL', + @OneToOne((type) => DriveFile, { + onDelete: "SET NULL", }) @JoinColumn() public banner: DriveFile | null; @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', + @Column("varchar", { + length: 128, + array: true, + default: "{}", }) public tags: string[]; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is suspended.', + comment: "Whether the User is suspended.", }) public isSuspended: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is silenced.', + comment: "Whether the User is silenced.", }) public isSilenced: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is locked.', + comment: "Whether the User is locked.", }) public isLocked: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is a bot.', + comment: "Whether the User is a bot.", }) public isBot: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is a cat.', + comment: "Whether the User is a cat.", }) public isCat: boolean; - @Column('boolean', { + @Column("boolean", { default: true, - comment: 'Whether to speak as a cat if isCat.', + comment: "Whether to speak as a cat if isCat.", }) public speakAsCat: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is the admin.', + comment: "Whether the User is the admin.", }) public isAdmin: boolean; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is a moderator.', + comment: "Whether the User is a moderator.", }) public isModerator: boolean; @Index() - @Column('boolean', { + @Column("boolean", { default: true, - comment: 'Whether the User is explorable.', + comment: "Whether the User is explorable.", }) public isExplorable: boolean; // アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether the User is deleted.', + comment: "Whether the User is deleted.", }) public isDeleted: boolean; - @Column('varchar', { - length: 128, array: true, default: '{}', + @Column("varchar", { + length: 128, + array: true, + default: "{}", }) public emojis: string[]; @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: 'The host of the User. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 128, + nullable: true, + comment: + "The host of the User. It will be null if the origin of the user is local.", }) public host: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The inbox URL of the User. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The inbox URL of the User. It will be null if the origin of the user is local.", }) public inbox: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The sharedInbox URL of the User. It will be null if the origin of the user is local.", }) public sharedInbox: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The featured URL of the User. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The featured URL of the User. It will be null if the origin of the user is local.", }) public featured: string | null; @Index() - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of the User. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The URI of the User. It will be null if the origin of the user is local.", }) public uri: string | null; - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.', + @Column("varchar", { + length: 512, + nullable: true, + comment: + "The URI of the user Follower Collection. It will be null if the origin of the user is local.", }) public followersUri: string | null; - @Column('boolean', { + @Column("boolean", { default: false, - comment: 'Whether to show users replying to other users in the timeline.', + comment: "Whether to show users replying to other users in the timeline.", }) public showTimelineReplies: boolean; @Index({ unique: true }) - @Column('char', { - length: 16, nullable: true, unique: true, - comment: 'The native access token of the User. It will be null if the origin of the user is local.', + @Column("char", { + length: 16, + nullable: true, + unique: true, + comment: + "The native access token of the User. It will be null if the origin of the user is local.", }) public token: string | null; - @Column('integer', { + @Column("integer", { nullable: true, - comment: 'Overrides user drive capacity limit', + comment: "Overrides user drive capacity limit", }) public driveCapacityOverrideMb: number | null; diff --git a/packages/backend/src/models/entities/webhook.ts b/packages/backend/src/models/entities/webhook.ts index 5db51c3a3..47fd79966 100644 --- a/packages/backend/src/models/entities/webhook.ts +++ b/packages/backend/src/models/entities/webhook.ts @@ -25,48 +25,50 @@ export class Webhook { @PrimaryColumn(id()) public id: string; - @Column('timestamp with time zone', { - comment: 'The created date of the Antenna.', + @Column("timestamp with time zone", { + comment: "The created date of the Antenna.", }) public createdAt: Date; @Index() @Column({ ...id(), - comment: 'The owner ID.', + comment: "The owner ID.", }) public userId: User["id"]; - @ManyToOne(type => User, { - onDelete: 'CASCADE', + @ManyToOne((type) => User, { + onDelete: "CASCADE", }) @JoinColumn() public user: User | null; - @Column('varchar', { + @Column("varchar", { length: 128, - comment: 'The name of the Antenna.', + comment: "The name of the Antenna.", }) public name: string; @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', + @Column("varchar", { + length: 128, + array: true, + default: "{}", }) public on: typeof webhookEventTypes[number][]; - @Column('varchar', { + @Column("varchar", { length: 1024, }) public url: string; - @Column('varchar', { + @Column("varchar", { length: 1024, }) public secret: string; @Index() - @Column('boolean', { + @Column("boolean", { default: true, }) public active: boolean; @@ -74,7 +76,7 @@ export class Webhook { /** * 直近のリクエスト送信日時 */ - @Column('timestamp with time zone', { + @Column("timestamp with time zone", { nullable: true, }) public latestSentAt: Date | null; @@ -82,7 +84,7 @@ export class Webhook { /** * 直近のリクエスト送信時のHTTPステータスコード */ - @Column('integer', { + @Column("integer", { nullable: true, }) public latestStatus: number | null; diff --git a/packages/backend/src/server/web/manifest.json b/packages/backend/src/server/web/manifest.json index 1e662fb20..647a5d437 100644 --- a/packages/backend/src/server/web/manifest.json +++ b/packages/backend/src/server/web/manifest.json @@ -41,7 +41,7 @@ "url": "url" } }, - "screenshots" : [ + "screenshots": [ { "src": "/static-assets/screenshots/1.webp", "sizes": "1195x579", @@ -57,7 +57,7 @@ "label": "Posts" } ], - "shortcuts" : [ + "shortcuts": [ { "name": "Notifications", "short_name": "Notifs", @@ -68,7 +68,5 @@ "url": "/my/messaging" } ], - "categories": [ - "social" - ] + "categories": ["social"] } diff --git a/packages/calckey-js/package.json b/packages/calckey-js/package.json index 598dd1cdb..6f724fc21 100644 --- a/packages/calckey-js/package.json +++ b/packages/calckey-js/package.json @@ -34,9 +34,7 @@ "tsd": "^0.19.1", "typescript": "4.5.4" }, - "files": [ - "built" - ], + "files": ["built"], "dependencies": { "autobind-decorator": "^2.4.0", "eventemitter3": "^4.0.7", diff --git a/packages/calckey-js/tsconfig.json b/packages/calckey-js/tsconfig.json index a03a24262..642bcc45b 100644 --- a/packages/calckey-js/tsconfig.json +++ b/packages/calckey-js/tsconfig.json @@ -15,11 +15,6 @@ "noImplicitReturns": true, "esModuleInterop": true }, - "include": [ - "src/**/*" - ], - "exclude": [ - "node_modules", - "test/**/*" - ] + "include": ["src/**/*"], + "exclude": ["node_modules", "test/**/*"] } diff --git a/packages/client/src/widgets/server-info.vue b/packages/client/src/widgets/server-info.vue index 32cd35883..d24dd8a98 100644 --- a/packages/client/src/widgets/server-info.vue +++ b/packages/client/src/widgets/server-info.vue @@ -48,7 +48,7 @@ const widgetPropsDef = {}; type WidgetProps = GetFormResultType; - const props = defineProps<{ widget?: Widget }>(); +const props = defineProps<{ widget?: Widget }>(); const emit = defineEmits<{ (ev: "updateProps", props: WidgetProps) }>(); const { widgetProps, configure } = useWidgetPropsManager( diff --git a/packages/sw/package.json b/packages/sw/package.json index 112005ba7..0d0ac52df 100644 --- a/packages/sw/package.json +++ b/packages/sw/package.json @@ -6,9 +6,7 @@ "watch": "pnpm swc src -d built -D -w", "lint": "pnpm rome check \"src/**/*.ts\"" }, - "dependencies": { - - }, + "dependencies": {}, "devDependencies": { "@swc/cli": "^0.1.62", "@swc/core": "^1.3.50", diff --git a/rome.json b/rome.json index 6b74808ed..7a51b60e6 100644 --- a/rome.json +++ b/rome.json @@ -5,5 +5,18 @@ "rules": { "recommended": true } - } -} \ No newline at end of file + }, + "formatter": { + "ignore": [ + "packages/calckey-js/api-extractor.json", + "packages/*/tsconfig.json", + "packages/*/package-lock.json", + "packages/backend/src/server/web/manifest.ts", + "packages/backend/built/", + "packages/backend/nsfw-model/", + "packages/client/src/emojilist.json", + "*.md", + "*/.yml" + ] + } +}