chore: format

This commit is contained in:
ThatOneCalculator 2023-05-29 09:31:02 -07:00
parent ded157a9e5
commit 655cf3dc27
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
74 changed files with 1252 additions and 1079 deletions

View File

@ -4,10 +4,5 @@
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules",
"jspm_packages",
"tmp",
"temp"
]
"exclude": ["node_modules", "jspm_packages", "tmp", "temp"]
}

View File

@ -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",
);
});

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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<string, string> | null;
@Column('varchar', {
length: 128, nullable: true,
@Column("varchar", {
length: 128,
nullable: true,
})
public requestIp: string | null;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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[];

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<string, unknown>;

View File

@ -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<string, any>;
}

View File

@ -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];
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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<string, number>;
@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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<string, any>[];
@Column('jsonb', {
@Column("jsonb", {
default: [],
})
public variables: Record<string, any>[];
@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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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";
}

View File

@ -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()

View File

@ -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<string, any>;
@Column('boolean')
@Column("boolean")
public success: boolean;
}

View File

@ -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;

View File

@ -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<UsedUsername>) {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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<string, any>;
// TODO: そのうち消す
@Column('jsonb', {
@Column("jsonb", {
default: {},
comment: 'The room data of the User.',
comment: "The room data of the User.",
})
public room: Record<string, any>;
@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<string, any>;
@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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -68,7 +68,5 @@
"url": "/my/messaging"
}
],
"categories": [
"social"
]
"categories": ["social"]
}

View File

@ -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",

View File

@ -15,11 +15,6 @@
"noImplicitReturns": true,
"esModuleInterop": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"test/**/*"
]
"include": ["src/**/*"],
"exclude": ["node_modules", "test/**/*"]
}

View File

@ -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",

View File

@ -5,5 +5,18 @@
"rules": {
"recommended": true
}
},
"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"
]
}
}