Merge branch 'develop' of https://firefish.dev/firefish/firefish into refactor/types
This commit is contained in:
commit
8e28f0e97c
71 changed files with 808 additions and 588 deletions
|
@ -27,3 +27,6 @@
|
||||||
By submitting this issue, you agree to follow our [Contribution Guidelines](https://firefish.dev/firefish/firefish/-/blob/develop/CONTRIBUTING.md)
|
By submitting this issue, you agree to follow our [Contribution Guidelines](https://firefish.dev/firefish/firefish/-/blob/develop/CONTRIBUTING.md)
|
||||||
- [ ] I agree to follow this project's Contribution Guidelines
|
- [ ] I agree to follow this project's Contribution Guidelines
|
||||||
- [ ] I have searched the issue tracker for similar issues, and this is not a duplicate.
|
- [ ] I have searched the issue tracker for similar issues, and this is not a duplicate.
|
||||||
|
|
||||||
|
**Can you fix this bug?** (optional)
|
||||||
|
- [ ] Yes. I will fix this bug and open a merge request if the change is agreed upon.
|
||||||
|
|
|
@ -15,3 +15,6 @@
|
||||||
By submitting this issue, you agree to follow our [Contribution Guidelines](https://firefish.dev/firefish/firefish/-/blob/develop/CONTRIBUTING.md)
|
By submitting this issue, you agree to follow our [Contribution Guidelines](https://firefish.dev/firefish/firefish/-/blob/develop/CONTRIBUTING.md)
|
||||||
- [ ] I agree to follow this project's Contribution Guidelines
|
- [ ] I agree to follow this project's Contribution Guidelines
|
||||||
- [ ] I have searched the issue tracker for similar requests, and this is not a duplicate.
|
- [ ] I have searched the issue tracker for similar requests, and this is not a duplicate.
|
||||||
|
|
||||||
|
**Can you implement this feature?** (optional)
|
||||||
|
- [ ] Yes. I will implement this feature and open a merge request if the change is agreed upon.
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
**Contribution Guidelines**
|
**Contribution Guidelines**
|
||||||
By submitting this merge request, you agree to follow our [Contribution Guidelines](https://firefish.dev/firefish/firefish/-/blob/develop/CONTRIBUTING.md)
|
By submitting this merge request, you agree to follow our [Contribution Guidelines](https://firefish.dev/firefish/firefish/-/blob/develop/CONTRIBUTING.md)
|
||||||
|
- [ ] This change is reviewed in an issue / This is a minor bug fix
|
||||||
- [ ] I agree to follow this project's Contribution Guidelines
|
- [ ] I agree to follow this project's Contribution Guidelines
|
||||||
- [ ] I have made sure to test this pull request
|
- [ ] I have made sure to test this pull request
|
||||||
- [ ] I have made sure to run `pnpm run format` before submitting this pull request
|
- [ ] I have made sure to run `pnpm run format` before submitting this pull request
|
||||||
|
@ -12,4 +13,4 @@ If this merge request makes changes to the Firefish API, please update `docs/api
|
||||||
- [ ] I updated the document / This merge request doesn't include API changes
|
- [ ] I updated the document / This merge request doesn't include API changes
|
||||||
|
|
||||||
<!-- Uncomment if your merge request has multiple authors -->
|
<!-- Uncomment if your merge request has multiple authors -->
|
||||||
<!-- Co-authored-by: Name <email@email.com> -->
|
<!-- Co-authored-by: Name <email@example.com> -->
|
||||||
|
|
2
COPYING
2
COPYING
|
@ -1,6 +1,7 @@
|
||||||
Unless specified otherwise, the entirety of this repository is subject to the following:
|
Unless specified otherwise, the entirety of this repository is subject to the following:
|
||||||
Copyright © 2014-2023 syuilo and contributors
|
Copyright © 2014-2023 syuilo and contributors
|
||||||
Copyright © 2022-2023 Kainoa Kanter and contributors
|
Copyright © 2022-2023 Kainoa Kanter and contributors
|
||||||
|
Copyright © 2024 Firefish contributors
|
||||||
|
|
||||||
And is distributed under The GNU Affero General Public License Version 3, you should have received a copy of the license file as LICENSE.
|
And is distributed under The GNU Affero General Public License Version 3, you should have received a copy of the license file as LICENSE.
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ These specific configuration directories:
|
||||||
|
|
||||||
and their contents are
|
and their contents are
|
||||||
Copyright © 2022-2023 Kainoa Kanter and contributors
|
Copyright © 2022-2023 Kainoa Kanter and contributors
|
||||||
|
Copyright © 2024 Firefish contributors
|
||||||
|
|
||||||
And are distributed under The Apache License, Version 2.0, you should have received a copy of the license file as LICENSE in each specified directory.
|
And are distributed under The Apache License, Version 2.0, you should have received a copy of the license file as LICENSE in each specified directory.
|
||||||
|
|
||||||
|
|
|
@ -876,7 +876,7 @@ fromDrive: Des del Disc
|
||||||
uploadFromUrl: Puja des d'una adreça URL
|
uploadFromUrl: Puja des d'una adreça URL
|
||||||
uploadFromUrlDescription: Adreça URL del fitxer que vols pujar
|
uploadFromUrlDescription: Adreça URL del fitxer que vols pujar
|
||||||
uploadFromUrlRequested: Pujada demanada
|
uploadFromUrlRequested: Pujada demanada
|
||||||
noMoreHistory: No hi ha res més a l'historial
|
noMoreHistory: No hi ha més historial
|
||||||
tos: Condicions d'ús
|
tos: Condicions d'ús
|
||||||
start: Comença
|
start: Comença
|
||||||
startMessaging: Comença una conversa
|
startMessaging: Comença una conversa
|
||||||
|
@ -2293,5 +2293,5 @@ markLocalFilesNsfwByDefaultDescription: Independentment d'aquest ajust, els usua
|
||||||
afectats.
|
afectats.
|
||||||
autocorrectNoteLanguage: Mostra un avís si l'idioma de la publicació no coincideix
|
autocorrectNoteLanguage: Mostra un avís si l'idioma de la publicació no coincideix
|
||||||
amb el resultat de l'idioma detectat automàticament
|
amb el resultat de l'idioma detectat automàticament
|
||||||
noteEditHistory: Historial d'edició de la publicació
|
noteEditHistory: Historial d'edicions
|
||||||
media: Multimèdia
|
media: Multimèdia
|
||||||
|
|
|
@ -2272,3 +2272,4 @@ markLocalFilesNsfwByDefault: Tandai semua berkas lokal baru sensitif secara bawa
|
||||||
markLocalFilesNsfwByDefaultDescription: Terlepas dari pengaturan ini, pengguna dapat
|
markLocalFilesNsfwByDefaultDescription: Terlepas dari pengaturan ini, pengguna dapat
|
||||||
menghapus sendiri tanda NSFW. Berkas yang ada tidak berpengaruh.
|
menghapus sendiri tanda NSFW. Berkas yang ada tidak berpengaruh.
|
||||||
noteEditHistory: Riwayat penyuntingan kiriman
|
noteEditHistory: Riwayat penyuntingan kiriman
|
||||||
|
media: Media
|
||||||
|
|
|
@ -2060,3 +2060,4 @@ showNoAltTextWarning: 当您尝试发布没有描述的帖子附件时显示警
|
||||||
autocorrectNoteLanguage: 当帖子语言不符合自动检测的结果的时候显示警告
|
autocorrectNoteLanguage: 当帖子语言不符合自动检测的结果的时候显示警告
|
||||||
incorrectLanguageWarning: "看上去您帖子使用的语言是{detected},但您选择的语言是{current}。\n要改为以{detected}发帖吗?"
|
incorrectLanguageWarning: "看上去您帖子使用的语言是{detected},但您选择的语言是{current}。\n要改为以{detected}发帖吗?"
|
||||||
noteEditHistory: "帖子编辑历史"
|
noteEditHistory: "帖子编辑历史"
|
||||||
|
media: 媒体
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -24,34 +25,16 @@ export class AbuseUserReport {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public targetUserId: User["id"];
|
public targetUserId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public targetUser: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public reporterId: User["id"];
|
public reporterId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public reporter: User | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public assigneeId: User["id"] | null;
|
public assigneeId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public assignee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("boolean", {
|
@Column("boolean", {
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -85,4 +68,25 @@ export class AbuseUserReport {
|
||||||
})
|
})
|
||||||
public reporterHost: string | null;
|
public reporterHost: string | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public targetUser: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public reporter: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public assignee: Relation<User | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { App } from "./app.js";
|
import { App } from "./app.js";
|
||||||
|
@ -48,24 +49,12 @@ export class AccessToken {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public appId: App["id"] | null;
|
public appId: App["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => App, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public app: App | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -95,4 +84,18 @@ export class AccessToken {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
public fetched: boolean;
|
public fetched: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => App, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public app: Relation<App>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { Announcement } from "./announcement.js";
|
import { Announcement } from "./announcement.js";
|
||||||
|
@ -25,19 +26,21 @@ export class AnnouncementRead {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public announcementId: Announcement["id"];
|
public announcementId: Announcement["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Announcement, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public announcement: Announcement | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Announcement, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public announcement: Relation<Announcement>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -28,12 +29,6 @@ export class Antenna {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
comment: "The name of the Antenna.",
|
comment: "The name of the Antenna.",
|
||||||
|
@ -51,24 +46,12 @@ export class Antenna {
|
||||||
})
|
})
|
||||||
public userListId: UserList["id"] | null;
|
public userListId: UserList["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => UserList, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public userList: UserList | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public userGroupJoiningId: UserGroupJoining["id"] | null;
|
public userGroupJoiningId: UserGroupJoining["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => UserGroupJoining, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public userGroupJoining: UserGroupJoining | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 1024,
|
length: 1024,
|
||||||
array: true,
|
array: true,
|
||||||
|
@ -112,4 +95,27 @@ export class Antenna {
|
||||||
|
|
||||||
@Column("boolean")
|
@Column("boolean")
|
||||||
public notify: boolean;
|
public notify: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserList, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public userList: Relation<UserList | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserGroupJoining, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public userGroupJoining: Relation<UserGroupJoining | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { Entity, PrimaryColumn, Column, Index, ManyToOne } from "typeorm";
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryColumn,
|
||||||
|
Column,
|
||||||
|
Index,
|
||||||
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
|
||||||
|
@ -21,12 +28,6 @@ export class App {
|
||||||
})
|
})
|
||||||
public userId: User["id"] | null;
|
public userId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 64,
|
length: 64,
|
||||||
|
@ -59,4 +60,12 @@ export class App {
|
||||||
comment: "The callbackUrl of the App.",
|
comment: "The callbackUrl of the App.",
|
||||||
})
|
})
|
||||||
public callbackUrl: string | null;
|
public callbackUrl: string | null;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
public user: Relation<User | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
Index,
|
Index,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -18,12 +19,6 @@ export class AttestationChallenge {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 64,
|
length: 64,
|
||||||
|
@ -43,6 +38,14 @@ export class AttestationChallenge {
|
||||||
})
|
})
|
||||||
public registrationChallenge: boolean;
|
public registrationChallenge: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<AttestationChallenge>) {
|
constructor(data: Partial<AttestationChallenge>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { App } from "./app.js";
|
import { App } from "./app.js";
|
||||||
|
@ -32,19 +33,20 @@ export class AuthSession {
|
||||||
})
|
})
|
||||||
public userId: User["id"] | null;
|
public userId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public appId: App["id"];
|
public appId: App["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => App, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public app: App | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => App, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public app: App;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -28,12 +29,6 @@ export class Blocking {
|
||||||
})
|
})
|
||||||
public blockeeId: User["id"];
|
public blockeeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public blockee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,9 +36,17 @@ export class Blocking {
|
||||||
})
|
})
|
||||||
public blockerId: User["id"];
|
public blockerId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public blocker: User | null;
|
public blockee: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public blocker: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -29,12 +30,6 @@ export class ChannelFollowing {
|
||||||
})
|
})
|
||||||
public followeeId: Channel["id"];
|
public followeeId: Channel["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Channel, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public followee: Channel | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -42,9 +37,17 @@ export class ChannelFollowing {
|
||||||
})
|
})
|
||||||
public followerId: User["id"];
|
public followerId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => Channel, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public follower: User | null;
|
public followee: Relation<Channel>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public follower: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { Channel } from "./channel.js";
|
import { Channel } from "./channel.js";
|
||||||
|
@ -25,18 +26,20 @@ export class ChannelNotePining {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public channelId: Channel["id"];
|
public channelId: Channel["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Channel, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public channel: Channel | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => Channel, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public note: Note | null;
|
public channel: Relation<Channel>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -35,12 +36,6 @@ export class Channel {
|
||||||
})
|
})
|
||||||
public userId: User["id"] | null;
|
public userId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
comment: "The name of the Channel.",
|
comment: "The name of the Channel.",
|
||||||
|
@ -61,12 +56,6 @@ export class Channel {
|
||||||
})
|
})
|
||||||
public bannerId: DriveFile["id"] | null;
|
public bannerId: DriveFile["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => DriveFile, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public banner: DriveFile | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("integer", {
|
@Column("integer", {
|
||||||
default: 0,
|
default: 0,
|
||||||
|
@ -80,4 +69,18 @@ export class Channel {
|
||||||
comment: "The count of users.",
|
comment: "The count of users.",
|
||||||
})
|
})
|
||||||
public usersCount: number;
|
public usersCount: number;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => DriveFile, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public banner: Relation<DriveFile>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { Clip } from "./clip.js";
|
import { Clip } from "./clip.js";
|
||||||
|
@ -23,12 +24,6 @@ export class ClipNote {
|
||||||
})
|
})
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -36,9 +31,17 @@ export class ClipNote {
|
||||||
})
|
})
|
||||||
public clipId: Clip["id"];
|
public clipId: Clip["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Clip, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public clip: Clip | null;
|
public note: Relation<Note>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Clip, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public clip: Relation<Clip>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -26,12 +27,6 @@ export class Clip {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
comment: "The name of the Clip.",
|
comment: "The name of the Clip.",
|
||||||
|
@ -49,4 +44,12 @@ export class Clip {
|
||||||
comment: "The description of the Clip.",
|
comment: "The description of the Clip.",
|
||||||
})
|
})
|
||||||
public description: string | null;
|
public description: string | null;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,12 +214,14 @@ export class DriveFile {
|
||||||
|
|
||||||
@ManyToOne(() => User, {
|
@ManyToOne(() => User, {
|
||||||
onDelete: "SET NULL",
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public user: User | null;
|
public user: User | null;
|
||||||
|
|
||||||
@ManyToOne(() => DriveFolder, {
|
@ManyToOne(() => DriveFolder, {
|
||||||
onDelete: "SET NULL",
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public folder: DriveFolder | null;
|
public folder: DriveFolder | null;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
Index,
|
Index,
|
||||||
Column,
|
Column,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -34,12 +35,6 @@ export class DriveFolder {
|
||||||
})
|
})
|
||||||
public userId: User["id"] | null;
|
public userId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -49,9 +44,19 @@ export class DriveFolder {
|
||||||
})
|
})
|
||||||
public parentId: DriveFolder["id"] | null;
|
public parentId: DriveFolder["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => DriveFolder, {
|
//#region Relations
|
||||||
onDelete: "SET NULL",
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public parent: DriveFolder | null;
|
public user: Relation<User | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => DriveFolder, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public parent: Relation<DriveFolder | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -27,12 +28,6 @@ export class FollowRequest {
|
||||||
})
|
})
|
||||||
public followeeId: User["id"];
|
public followeeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public followee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -40,12 +35,6 @@ export class FollowRequest {
|
||||||
})
|
})
|
||||||
public followerId: User["id"];
|
public followerId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public follower: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -96,4 +85,18 @@ export class FollowRequest {
|
||||||
})
|
})
|
||||||
public followeeSharedInbox: string | null;
|
public followeeSharedInbox: string | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public followee: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public follower: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -28,12 +29,6 @@ export class Following {
|
||||||
})
|
})
|
||||||
public followeeId: User["id"];
|
public followeeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public followee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,12 +36,6 @@ export class Following {
|
||||||
})
|
})
|
||||||
public followerId: User["id"];
|
public followerId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public follower: User | null;
|
|
||||||
|
|
||||||
//#region Denormalized fields
|
//#region Denormalized fields
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
|
@ -92,4 +81,18 @@ export class Following {
|
||||||
})
|
})
|
||||||
public followeeSharedInbox: string | null;
|
public followeeSharedInbox: string | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public followee: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public follower: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -23,18 +24,20 @@ export class GalleryLike {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public postId: GalleryPost["id"];
|
public postId: GalleryPost["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => GalleryPost, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public post: GalleryPost | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => GalleryPost, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public post: Relation<GalleryPost>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -45,12 +46,6 @@ export class GalleryPost {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -80,6 +75,14 @@ export class GalleryPost {
|
||||||
})
|
})
|
||||||
public tags: string[];
|
public tags: string[];
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne((type) => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<GalleryPost>) {
|
constructor(data: Partial<GalleryPost>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { DriveFile } from "./drive-file.js";
|
import { DriveFile } from "./drive-file.js";
|
||||||
|
@ -29,12 +30,6 @@ export class MessagingMessage {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -43,12 +38,6 @@ export class MessagingMessage {
|
||||||
})
|
})
|
||||||
public recipientId: User["id"] | null;
|
public recipientId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public recipient: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -57,12 +46,6 @@ export class MessagingMessage {
|
||||||
})
|
})
|
||||||
public groupId: UserGroup["id"] | null;
|
public groupId: UserGroup["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => UserGroup, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public group: UserGroup | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 4096,
|
length: 4096,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -93,9 +76,31 @@ export class MessagingMessage {
|
||||||
})
|
})
|
||||||
public fileId: DriveFile["id"] | null;
|
public fileId: DriveFile["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => DriveFile, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public file: DriveFile | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public recipient: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserGroup, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public group: Relation<UserGroup | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => DriveFile, {
|
||||||
|
onDelete: "CASCADE", // TODO: change this to SET NULL
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public file: Relation<DriveFile | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from "typeorm";
|
import {
|
||||||
|
Entity,
|
||||||
|
Column,
|
||||||
|
PrimaryColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
type Relation,
|
||||||
|
} from "typeorm";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import type { Clip } from "./clip.js";
|
import type { Clip } from "./clip.js";
|
||||||
|
@ -218,12 +225,6 @@ export class Meta {
|
||||||
})
|
})
|
||||||
public proxyAccountId: User["id"] | null;
|
public proxyAccountId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public proxyAccount: User | null;
|
|
||||||
|
|
||||||
@Column("boolean", {
|
@Column("boolean", {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
|
@ -500,4 +501,13 @@ export class Meta {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public donationLink: string | null;
|
public donationLink: string | null;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public proxyAccount: Relation<User | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -23,12 +24,6 @@ export class ModerationLog {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
})
|
})
|
||||||
|
@ -36,4 +31,12 @@ export class ModerationLog {
|
||||||
|
|
||||||
@Column("jsonb")
|
@Column("jsonb")
|
||||||
public info: Record<string, any>;
|
public info: Record<string, any>;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
|
@ -24,12 +25,6 @@ export class MutedNote {
|
||||||
})
|
})
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -37,12 +32,6 @@ export class MutedNote {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ミュートされた理由。
|
* ミュートされた理由。
|
||||||
*/
|
*/
|
||||||
|
@ -52,4 +41,18 @@ export class MutedNote {
|
||||||
comment: "The reason of the MutedNote.",
|
comment: "The reason of the MutedNote.",
|
||||||
})
|
})
|
||||||
public reason: (typeof mutedNoteReasons)[number];
|
public reason: (typeof mutedNoteReasons)[number];
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -34,12 +35,6 @@ export class Muting {
|
||||||
})
|
})
|
||||||
public muteeId: User["id"];
|
public muteeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public mutee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -47,9 +42,17 @@ export class Muting {
|
||||||
})
|
})
|
||||||
public muterId: User["id"];
|
public muterId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public muter: User | null;
|
public mutee: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public muter: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { DriveFile } from "./drive-file.js";
|
import type { DriveFile } from "./drive-file.js";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class NoteEdit {
|
export class NoteEdit {
|
||||||
|
@ -22,12 +22,6 @@ export class NoteEdit {
|
||||||
})
|
})
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
@Column("text", {
|
@Column("text", {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
|
@ -57,4 +51,12 @@ export class NoteEdit {
|
||||||
default: "{}",
|
default: "{}",
|
||||||
})
|
})
|
||||||
public emojis: string[];
|
public emojis: string[];
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Note;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
|
@ -25,18 +26,20 @@ export class NoteFavorite {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public note: Note | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
|
@ -26,26 +27,28 @@ export class NoteReaction {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user?: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note?: Note | null;
|
|
||||||
|
|
||||||
// TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため)
|
// TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため)
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 260,
|
length: 260,
|
||||||
})
|
})
|
||||||
public reaction: string;
|
public reaction: string;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -24,15 +25,17 @@ export class NoteThreadMuting {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 256,
|
length: 256,
|
||||||
})
|
})
|
||||||
public threadId: string;
|
public threadId: string;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
|
@ -21,22 +22,10 @@ export class NoteUnread {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* メンションか否か
|
* メンションか否か
|
||||||
*/
|
*/
|
||||||
|
@ -67,4 +56,18 @@ export class NoteUnread {
|
||||||
})
|
})
|
||||||
public noteChannelId: Channel["id"] | null;
|
public noteChannelId: Channel["id"] | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
|
@ -29,12 +30,6 @@ export class NoteWatching {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -42,12 +37,6 @@ export class NoteWatching {
|
||||||
})
|
})
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
//#region Denormalized fields
|
//#region Denormalized fields
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
|
@ -56,4 +45,18 @@ export class NoteWatching {
|
||||||
})
|
})
|
||||||
public noteUserId: Note["userId"];
|
public noteUserId: Note["userId"];
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,55 +206,6 @@ export class Note {
|
||||||
})
|
})
|
||||||
public channelId: Channel["id"] | null;
|
public channelId: Channel["id"] | null;
|
||||||
|
|
||||||
//#region Relations
|
|
||||||
@OneToMany(
|
|
||||||
() => NoteFile,
|
|
||||||
(noteFile: NoteFile) => noteFile.note,
|
|
||||||
)
|
|
||||||
public noteFiles: Relation<NoteFile[]>;
|
|
||||||
|
|
||||||
@ManyToMany(
|
|
||||||
() => DriveFile,
|
|
||||||
(file: DriveFile) => file.notes,
|
|
||||||
)
|
|
||||||
@JoinTable({
|
|
||||||
name: "note_file",
|
|
||||||
joinColumn: {
|
|
||||||
name: "noteId",
|
|
||||||
referencedColumnName: "id",
|
|
||||||
},
|
|
||||||
inverseJoinColumn: {
|
|
||||||
name: "fileId",
|
|
||||||
referencedColumnName: "id",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
public files: Relation<DriveFile[]>;
|
|
||||||
|
|
||||||
@ManyToOne(() => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public reply: Note | null;
|
|
||||||
|
|
||||||
@ManyToOne(() => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public renote: Note | null;
|
|
||||||
|
|
||||||
@ManyToOne(() => Channel, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public channel: Channel | null;
|
|
||||||
|
|
||||||
@ManyToOne(() => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
//#endregion Relations
|
|
||||||
|
|
||||||
//#region Denormalized fields
|
//#region Denormalized fields
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
|
@ -299,6 +250,59 @@ export class Note {
|
||||||
public updatedAt: Date | null;
|
public updatedAt: Date | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToMany(
|
||||||
|
() => NoteFile,
|
||||||
|
(noteFile: NoteFile) => noteFile.note,
|
||||||
|
)
|
||||||
|
public noteFiles: Relation<NoteFile[]>;
|
||||||
|
|
||||||
|
@ManyToMany(
|
||||||
|
() => DriveFile,
|
||||||
|
(file: DriveFile) => file.notes,
|
||||||
|
)
|
||||||
|
@JoinTable({
|
||||||
|
name: "note_file",
|
||||||
|
joinColumn: {
|
||||||
|
name: "noteId",
|
||||||
|
referencedColumnName: "id",
|
||||||
|
},
|
||||||
|
inverseJoinColumn: {
|
||||||
|
name: "fileId",
|
||||||
|
referencedColumnName: "id",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
public files: Relation<DriveFile[]>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public reply: Relation<Note | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public renote: Relation<Note | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Channel, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public channel: Relation<Channel | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User | null>;
|
||||||
|
//#endregion Relations
|
||||||
|
|
||||||
constructor(data: Partial<Note>) {
|
constructor(data: Partial<Note>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
Column,
|
Column,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -35,12 +36,6 @@ export class Notification {
|
||||||
})
|
})
|
||||||
public notifieeId: User["id"];
|
public notifieeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public notifiee: User | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification sender (initiator)
|
* Notification sender (initiator)
|
||||||
*/
|
*/
|
||||||
|
@ -52,12 +47,6 @@ export class Notification {
|
||||||
})
|
})
|
||||||
public notifierId: User["id"] | null;
|
public notifierId: User["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public notifier: User | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification types:
|
* Notification types:
|
||||||
* follow - Follow request
|
* follow - Follow request
|
||||||
|
@ -96,36 +85,18 @@ export class Notification {
|
||||||
})
|
})
|
||||||
public noteId: Note["id"] | null;
|
public noteId: Note["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public followRequestId: FollowRequest["id"] | null;
|
public followRequestId: FollowRequest["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => FollowRequest, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public followRequest: FollowRequest | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public userGroupInvitationId: UserGroupInvitation["id"] | null;
|
public userGroupInvitationId: UserGroupInvitation["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => UserGroupInvitation, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public userGroupInvitation: UserGroupInvitation | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -176,9 +147,46 @@ export class Notification {
|
||||||
})
|
})
|
||||||
public appAccessTokenId: AccessToken["id"] | null;
|
public appAccessTokenId: AccessToken["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => AccessToken, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public appAccessToken: AccessToken | null;
|
public notifiee: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public notifier: Relation<User | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => FollowRequest, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public followRequest: Relation<FollowRequest | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserGroupInvitation, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public userGroupInvitation: Relation<UserGroupInvitation | null>;
|
||||||
|
|
||||||
|
@ManyToOne(() => AccessToken, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public appAccessToken: Relation<AccessToken | null>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -23,18 +24,20 @@ export class PageLike {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public pageId: Page["id"];
|
public pageId: Page["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Page, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public page: Page | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Page, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public page: Relation<Page>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -68,24 +69,12 @@ export class Page {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public eyeCatchingImageId: DriveFile["id"] | null;
|
public eyeCatchingImageId: DriveFile["id"] | null;
|
||||||
|
|
||||||
@ManyToOne((type) => DriveFile, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public eyeCatchingImage: DriveFile | null;
|
|
||||||
|
|
||||||
@Column("jsonb", {
|
@Column("jsonb", {
|
||||||
default: [],
|
default: [],
|
||||||
})
|
})
|
||||||
|
@ -123,6 +112,20 @@ export class Page {
|
||||||
})
|
})
|
||||||
public likedCount: number;
|
public likedCount: number;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => DriveFile, {
|
||||||
|
onDelete: "CASCADE", // TODO: this should be SET NULL
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public eyeCatchingImage: Relation<DriveFile | null>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<Page>) {
|
constructor(data: Partial<Page>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
|
@ -29,9 +30,11 @@ export class PasswordResetRequest {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public user: User | null;
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
|
@ -26,22 +27,24 @@ export class PollVote {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
@Column("integer")
|
||||||
|
public choice: number;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public note: Note | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
@Column("integer")
|
@ManyToOne(() => Note, {
|
||||||
public choice: number;
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,23 +5,18 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
OneToOne,
|
OneToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import type { User } from "./user.js";
|
import type { User } from "./user.js";
|
||||||
import { noteVisibilities } from "../../types.js";
|
import { noteVisibilities } from "@/types.js";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Poll {
|
export class Poll {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@OneToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
@Column("timestamp without time zone", {
|
@Column("timestamp without time zone", {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
|
@ -65,6 +60,14 @@ export class Poll {
|
||||||
public userHost: string | null;
|
public userHost: string | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<Poll>) {
|
constructor(data: Partial<Poll>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
OneToOne,
|
OneToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import type { User } from "./user.js";
|
import type { User } from "./user.js";
|
||||||
|
@ -15,12 +16,6 @@ export class PromoNote {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@OneToOne((type) => Note, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
|
|
||||||
@Column("timestamp without time zone")
|
@Column("timestamp without time zone")
|
||||||
public expiresAt: Date;
|
public expiresAt: Date;
|
||||||
|
|
||||||
|
@ -32,4 +27,12 @@ export class PromoNote {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
|
@ -25,18 +26,20 @@ export class PromoRead {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public note: Note | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -32,12 +33,6 @@ export class RegistryItem {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 1024,
|
length: 1024,
|
||||||
comment: "The key of the RegistryItem.",
|
comment: "The key of the RegistryItem.",
|
||||||
|
@ -66,4 +61,12 @@ export class RegistryItem {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public domain: string | null;
|
public domain: string | null;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,13 @@ import {
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
Entity,
|
Entity,
|
||||||
Index,
|
Index,
|
||||||
JoinColumn,
|
// JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
// ManyToOne,
|
||||||
|
// type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { User } from "./user.js";
|
import type { User } from "./user.js";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Index(["muterId", "muteeId"], { unique: true })
|
@Index(["muterId", "muteeId"], { unique: true })
|
||||||
|
@ -28,12 +29,6 @@ export class RenoteMuting {
|
||||||
})
|
})
|
||||||
public muteeId: User["id"];
|
public muteeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public mutee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,9 +36,19 @@ export class RenoteMuting {
|
||||||
})
|
})
|
||||||
public muterId: User["id"];
|
public muterId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
//#region Relations
|
||||||
onDelete: "CASCADE",
|
/* FIXME: There is no such relation */
|
||||||
})
|
// @ManyToOne(() => User, {
|
||||||
@JoinColumn()
|
// onDelete: "CASCADE",
|
||||||
public muter: User | null;
|
// })
|
||||||
|
// @JoinColumn()
|
||||||
|
// public mutee: Relation<User>;
|
||||||
|
|
||||||
|
/* FIXME: There is no such relation */
|
||||||
|
// @ManyToOne(() => User, {
|
||||||
|
// onDelete: "CASCADE",
|
||||||
|
// })
|
||||||
|
// @JoinColumn()
|
||||||
|
// public muter: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,13 @@ import {
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
Entity,
|
Entity,
|
||||||
Index,
|
Index,
|
||||||
JoinColumn,
|
// JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
// ManyToOne,
|
||||||
|
// type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { User } from "./user.js";
|
import type { User } from "./user.js";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Index(["muterId", "muteeId"], { unique: true })
|
@Index(["muterId", "muteeId"], { unique: true })
|
||||||
|
@ -28,12 +29,6 @@ export class ReplyMuting {
|
||||||
})
|
})
|
||||||
public muteeId: User["id"];
|
public muteeId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public mutee: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,9 +36,19 @@ export class ReplyMuting {
|
||||||
})
|
})
|
||||||
public muterId: User["id"];
|
public muterId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
//#region Relations
|
||||||
onDelete: "CASCADE",
|
/* FIXME: There is no such relation */
|
||||||
})
|
// @ManyToOne(() => User, {
|
||||||
@JoinColumn()
|
// onDelete: "CASCADE",
|
||||||
public muter: User | null;
|
// })
|
||||||
|
// @JoinColumn()
|
||||||
|
// public mutee: Relation<User>;
|
||||||
|
|
||||||
|
/* FIXME: There is no such relation */
|
||||||
|
// @ManyToOne(() => User, {
|
||||||
|
// onDelete: "CASCADE",
|
||||||
|
// })
|
||||||
|
// @JoinColumn()
|
||||||
|
// public muter: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -23,12 +24,6 @@ export class Signin {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
})
|
})
|
||||||
|
@ -39,4 +34,12 @@ export class Signin {
|
||||||
|
|
||||||
@Column("boolean")
|
@Column("boolean")
|
||||||
public success: boolean;
|
public success: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -21,12 +22,6 @@ export class SwSubscription {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 512,
|
length: 512,
|
||||||
})
|
})
|
||||||
|
@ -46,4 +41,12 @@ export class SwSubscription {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
public sendReadMessage: boolean;
|
public sendReadMessage: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { UserGroup } from "./user-group.js";
|
import { UserGroup } from "./user-group.js";
|
||||||
|
@ -28,12 +29,6 @@ export class UserGroupInvitation {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,9 +36,17 @@ export class UserGroupInvitation {
|
||||||
})
|
})
|
||||||
public userGroupId: UserGroup["id"];
|
public userGroupId: UserGroup["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => UserGroup, {
|
//#region Relation
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public userGroup: UserGroup | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserGroup, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public userGroup: Relation<UserGroup>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { UserGroup } from "./user-group.js";
|
import { UserGroup } from "./user-group.js";
|
||||||
|
@ -28,12 +29,6 @@ export class UserGroupJoining {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,9 +36,17 @@ export class UserGroupJoining {
|
||||||
})
|
})
|
||||||
public userGroupId: UserGroup["id"];
|
public userGroupId: UserGroup["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => UserGroup, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public userGroup: UserGroup | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserGroup, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public userGroup: Relation<UserGroup>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -32,17 +33,19 @@ export class UserGroup {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("boolean", {
|
@Column("boolean", {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
public isPrivate: boolean;
|
public isPrivate: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<UserGroup>) {
|
constructor(data: Partial<UserGroup>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from "typeorm";
|
import {
|
||||||
|
PrimaryColumn,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
Column,
|
||||||
|
OneToOne,
|
||||||
|
type Relation,
|
||||||
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
|
||||||
|
@ -7,12 +14,6 @@ export class UserKeypair {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@OneToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 4096,
|
length: 4096,
|
||||||
})
|
})
|
||||||
|
@ -23,6 +24,14 @@ export class UserKeypair {
|
||||||
})
|
})
|
||||||
public privateKey: string;
|
public privateKey: string;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<UserKeypair>) {
|
constructor(data: Partial<UserKeypair>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { UserList } from "./user-list.js";
|
import { UserList } from "./user-list.js";
|
||||||
|
@ -28,12 +29,6 @@ export class UserListJoining {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
@ -41,9 +36,17 @@ export class UserListJoining {
|
||||||
})
|
})
|
||||||
public userListId: UserList["id"];
|
public userListId: UserList["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => UserList, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public userList: UserList | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserList, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public userList: Relation<UserList>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -26,15 +27,17 @@ export class UserList {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
comment: "The name of the UserList.",
|
comment: "The name of the UserList.",
|
||||||
})
|
})
|
||||||
public name: string;
|
public name: string;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { Note } from "./note.js";
|
import { Note } from "./note.js";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
|
@ -25,18 +26,20 @@ export class UserNotePining {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public noteId: Note["id"];
|
public noteId: Note["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => Note, {
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public note: Note | null;
|
public user: Relation<User>;
|
||||||
|
|
||||||
|
@ManyToOne(() => Note, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public note: Relation<Note>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
OneToOne,
|
OneToOne,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { ffVisibility, notificationTypes } from "@/types.js";
|
import { ffVisibility, notificationTypes } from "@/types.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -18,12 +19,6 @@ export class UserProfile {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@OneToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -246,6 +241,14 @@ export class UserProfile {
|
||||||
public userHost: string | null;
|
public userHost: string | null;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<UserProfile>) {
|
constructor(data: Partial<UserProfile>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
OneToOne,
|
OneToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -14,12 +15,6 @@ export class UserPublickey {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@OneToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index({ unique: true })
|
@Index({ unique: true })
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 512,
|
length: 512,
|
||||||
|
@ -31,6 +26,14 @@ export class UserPublickey {
|
||||||
})
|
})
|
||||||
public keyPem: string;
|
public keyPem: string;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<UserPublickey>) {
|
constructor(data: Partial<UserPublickey>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
Index,
|
Index,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -20,12 +21,6 @@ export class UserSecurityKey {
|
||||||
@Column(id())
|
@Column(id())
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
comment:
|
comment:
|
||||||
|
@ -45,6 +40,14 @@ export class UserSecurityKey {
|
||||||
})
|
})
|
||||||
public name: string;
|
public name: string;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<UserSecurityKey>) {
|
constructor(data: Partial<UserSecurityKey>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
OneToOne,
|
OneToOne,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
import { DriveFile } from "./drive-file.js";
|
import { DriveFile } from "./drive-file.js";
|
||||||
|
@ -106,12 +107,6 @@ export class User {
|
||||||
})
|
})
|
||||||
public avatarId: DriveFile["id"] | null;
|
public avatarId: DriveFile["id"] | null;
|
||||||
|
|
||||||
@OneToOne((type) => DriveFile, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public avatar: DriveFile | null;
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -119,12 +114,6 @@ export class User {
|
||||||
})
|
})
|
||||||
public bannerId: DriveFile["id"] | null;
|
public bannerId: DriveFile["id"] | null;
|
||||||
|
|
||||||
@OneToOne((type) => DriveFile, {
|
|
||||||
onDelete: "SET NULL",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public banner: DriveFile | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
|
@ -286,6 +275,22 @@ export class User {
|
||||||
})
|
})
|
||||||
public isIndexable: boolean;
|
public isIndexable: boolean;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@OneToOne(() => DriveFile, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public avatar: Relation<DriveFile | null>;
|
||||||
|
|
||||||
|
@OneToOne(() => DriveFile, {
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public banner: Relation<DriveFile | null>;
|
||||||
|
//#endregion
|
||||||
|
|
||||||
constructor(data: Partial<User>) {
|
constructor(data: Partial<User>) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
Column,
|
Column,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
|
type Relation,
|
||||||
} from "typeorm";
|
} from "typeorm";
|
||||||
import { User } from "./user.js";
|
import { User } from "./user.js";
|
||||||
import { id } from "../id.js";
|
import { id } from "../id.js";
|
||||||
|
@ -37,12 +38,6 @@ export class Webhook {
|
||||||
})
|
})
|
||||||
public userId: User["id"];
|
public userId: User["id"];
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
@Column("varchar", {
|
||||||
length: 128,
|
length: 128,
|
||||||
comment: "The name of the Antenna.",
|
comment: "The name of the Antenna.",
|
||||||
|
@ -88,4 +83,12 @@ export class Webhook {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
public latestStatus: number | null;
|
public latestStatus: number | null;
|
||||||
|
|
||||||
|
//#region Relations
|
||||||
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: Relation<User>;
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,22 +297,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {
|
import { computed, inject, nextTick, onMounted, ref, watch } from "vue";
|
||||||
computed,
|
|
||||||
defineAsyncComponent,
|
|
||||||
inject,
|
|
||||||
nextTick,
|
|
||||||
onMounted,
|
|
||||||
ref,
|
|
||||||
watch,
|
|
||||||
} from "vue";
|
|
||||||
import * as mfm from "mfm-js";
|
import * as mfm from "mfm-js";
|
||||||
import autosize from "autosize";
|
import autosize from "autosize";
|
||||||
import insertTextAtCursor from "insert-text-at-cursor";
|
import insertTextAtCursor from "insert-text-at-cursor";
|
||||||
import { length } from "stringz";
|
import { length } from "stringz";
|
||||||
import { toASCII } from "punycode/";
|
import { toASCII } from "punycode/";
|
||||||
import { acct } from "firefish-js";
|
import { acct } from "firefish-js";
|
||||||
import type { entities, languages, noteVisibilities } from "firefish-js";
|
import type { entities, languages } from "firefish-js";
|
||||||
import { throttle } from "throttle-debounce";
|
import { throttle } from "throttle-debounce";
|
||||||
import XNoteSimple from "@/components/MkNoteSimple.vue";
|
import XNoteSimple from "@/components/MkNoteSimple.vue";
|
||||||
import XNotePreview from "@/components/MkNotePreview.vue";
|
import XNotePreview from "@/components/MkNotePreview.vue";
|
||||||
|
@ -347,6 +339,8 @@ import {
|
||||||
} from "@/scripts/language-utils";
|
} from "@/scripts/language-utils";
|
||||||
import type { MenuItem } from "@/types/menu";
|
import type { MenuItem } from "@/types/menu";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
import MkVisibilityPicker from "@/components/MkVisibilityPicker.vue";
|
||||||
|
import type { NoteVisibility } from "@/types/note";
|
||||||
|
|
||||||
const modal = inject("modal");
|
const modal = inject("modal");
|
||||||
|
|
||||||
|
@ -358,7 +352,7 @@ const props = withDefaults(
|
||||||
mention?: entities.User;
|
mention?: entities.User;
|
||||||
specified?: entities.User;
|
specified?: entities.User;
|
||||||
initialText?: string;
|
initialText?: string;
|
||||||
initialVisibility?: typeof noteVisibilities;
|
initialVisibility?: NoteVisibility;
|
||||||
initialLanguage?: typeof languages;
|
initialLanguage?: typeof languages;
|
||||||
initialFiles?: entities.DriveFile[];
|
initialFiles?: entities.DriveFile[];
|
||||||
initialLocalOnly?: boolean;
|
initialLocalOnly?: boolean;
|
||||||
|
@ -412,10 +406,9 @@ const localOnly = ref<boolean>(
|
||||||
);
|
);
|
||||||
const visibility = ref(
|
const visibility = ref(
|
||||||
props.initialVisibility ??
|
props.initialVisibility ??
|
||||||
((defaultStore.state.rememberNoteVisibility
|
(defaultStore.state.rememberNoteVisibility
|
||||||
? defaultStore.state.visibility
|
? defaultStore.state.visibility
|
||||||
: defaultStore.state
|
: defaultStore.state.defaultNoteVisibility),
|
||||||
.defaultNoteVisibility) as (typeof noteVisibilities)[number]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const visibleUsers = ref([]);
|
const visibleUsers = ref([]);
|
||||||
|
@ -737,7 +730,7 @@ function setVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
os.popup(
|
os.popup(
|
||||||
defineAsyncComponent(() => import("@/components/MkVisibilityPicker.vue")),
|
MkVisibilityPicker,
|
||||||
{
|
{
|
||||||
currentVisibility: visibility.value,
|
currentVisibility: visibility.value,
|
||||||
currentLocalOnly: localOnly.value,
|
currentLocalOnly: localOnly.value,
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { shallowRef } from "vue";
|
import { shallowRef } from "vue";
|
||||||
|
|
||||||
import type { entities, languages, noteVisibilities } from "firefish-js";
|
import type { entities, languages } from "firefish-js";
|
||||||
import MkModal from "@/components/MkModal.vue";
|
import MkModal from "@/components/MkModal.vue";
|
||||||
import MkPostForm from "@/components/MkPostForm.vue";
|
import MkPostForm from "@/components/MkPostForm.vue";
|
||||||
|
import type { NoteVisibility } from "@/types/note";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reply?: entities.Note;
|
reply?: entities.Note;
|
||||||
|
@ -32,7 +33,7 @@ const props = defineProps<{
|
||||||
mention?: entities.User;
|
mention?: entities.User;
|
||||||
specified?: entities.User;
|
specified?: entities.User;
|
||||||
initialText?: string;
|
initialText?: string;
|
||||||
initialVisibility?: typeof noteVisibilities;
|
initialVisibility?: NoteVisibility;
|
||||||
initialLanguage?: typeof languages;
|
initialLanguage?: typeof languages;
|
||||||
initialFiles?: entities.DriveFile[];
|
initialFiles?: entities.DriveFile[];
|
||||||
initialLocalOnly?: boolean;
|
initialLocalOnly?: boolean;
|
||||||
|
|
|
@ -142,16 +142,16 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, ref, shallowRef, watch } from "vue";
|
import { nextTick, ref, shallowRef, watch } from "vue";
|
||||||
import type { noteVisibilities } from "firefish-js";
|
|
||||||
import MkModal from "@/components/MkModal.vue";
|
import MkModal from "@/components/MkModal.vue";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
import type { NoteVisibility } from "@/types/note";
|
||||||
|
|
||||||
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
currentVisibility: (typeof noteVisibilities)[number];
|
currentVisibility: NoteVisibility;
|
||||||
currentLocalOnly: boolean;
|
currentLocalOnly: boolean;
|
||||||
src?: HTMLElement;
|
src?: HTMLElement;
|
||||||
}>(),
|
}>(),
|
||||||
|
@ -159,7 +159,7 @@ const props = withDefaults(
|
||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: "changeVisibility", v: (typeof noteVisibilities)[number]): void;
|
(ev: "changeVisibility", v: NoteVisibility): void;
|
||||||
(ev: "changeLocalOnly", v: boolean): void;
|
(ev: "changeLocalOnly", v: boolean): void;
|
||||||
(ev: "closed"): void;
|
(ev: "closed"): void;
|
||||||
}>();
|
}>();
|
||||||
|
@ -171,9 +171,7 @@ watch(localOnly, () => {
|
||||||
emit("changeLocalOnly", localOnly.value);
|
emit("changeLocalOnly", localOnly.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
function choose(
|
function choose(visibility: NoteVisibility): void {
|
||||||
visibility: (typeof noteVisibilities)[number] | "private",
|
|
||||||
): void {
|
|
||||||
v.value = visibility;
|
v.value = visibility;
|
||||||
emit("changeVisibility", visibility);
|
emit("changeVisibility", visibility);
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import { computed, ref } from "vue";
|
||||||
|
|
||||||
// SPECIFICATION: https://misskey-hub.net/docs/features/share-form.html
|
// SPECIFICATION: https://misskey-hub.net/docs/features/share-form.html
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import { acct, noteVisibilities } from "firefish-js";
|
import { acct } from "firefish-js";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import XPostForm from "@/components/MkPostForm.vue";
|
import XPostForm from "@/components/MkPostForm.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
|
@ -42,6 +42,8 @@ import { mainRouter } from "@/router";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import icon from "@/scripts/icon";
|
import icon from "@/scripts/icon";
|
||||||
|
import type { NoteVisibility } from "@/types/note";
|
||||||
|
import { noteVisibilitiesClient } from "@/scripts/consts";
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const localOnlyQuery = urlParams.get("localOnly");
|
const localOnlyQuery = urlParams.get("localOnly");
|
||||||
|
@ -54,8 +56,14 @@ const url = urlParams.get("url");
|
||||||
const initialText = ref(null as string | null);
|
const initialText = ref(null as string | null);
|
||||||
const reply = ref(null as entities.Note | null);
|
const reply = ref(null as entities.Note | null);
|
||||||
const renote = ref(null as entities.Note | null);
|
const renote = ref(null as entities.Note | null);
|
||||||
|
|
||||||
|
function isVisibility(v: string | null): v is NoteVisibility {
|
||||||
|
if (v == null) return false;
|
||||||
|
return (noteVisibilitiesClient as readonly string[]).includes(v);
|
||||||
|
}
|
||||||
|
|
||||||
const visibility = ref(
|
const visibility = ref(
|
||||||
noteVisibilities.includes(visibilityQuery) ? visibilityQuery : null,
|
isVisibility(visibilityQuery) ? visibilityQuery : undefined,
|
||||||
);
|
);
|
||||||
const localOnly = ref(
|
const localOnly = ref(
|
||||||
localOnlyQuery === "0" ? false : localOnlyQuery === "1" ? true : null,
|
localOnlyQuery === "0" ? false : localOnlyQuery === "1" ? true : null,
|
||||||
|
|
6
packages/client/src/scripts/consts.ts
Normal file
6
packages/client/src/scripts/consts.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { noteVisibilities } from "firefish-js";
|
||||||
|
import type { NoteVisibility } from "@/types/note";
|
||||||
|
|
||||||
|
export const noteVisibilitiesClient = (
|
||||||
|
noteVisibilities as readonly NoteVisibility[]
|
||||||
|
).concat("private");
|
|
@ -1,6 +1,7 @@
|
||||||
import { markRaw, ref } from "vue";
|
import { markRaw, ref } from "vue";
|
||||||
import { isSignedIn } from "./me";
|
import { isSignedIn } from "./me";
|
||||||
import { Storage } from "./pizzax";
|
import { Storage } from "./pizzax";
|
||||||
|
import type { NoteVisibility } from "@/types/note";
|
||||||
|
|
||||||
export const postFormActions = [];
|
export const postFormActions = [];
|
||||||
export const userActions = [];
|
export const userActions = [];
|
||||||
|
@ -75,7 +76,7 @@ export const defaultStore = markRaw(
|
||||||
},
|
},
|
||||||
defaultNoteVisibility: {
|
defaultNoteVisibility: {
|
||||||
where: "account",
|
where: "account",
|
||||||
default: "public",
|
default: "public" as NoteVisibility,
|
||||||
},
|
},
|
||||||
defaultNoteLocalOnly: {
|
defaultNoteLocalOnly: {
|
||||||
where: "account",
|
where: "account",
|
||||||
|
@ -123,12 +124,7 @@ export const defaultStore = markRaw(
|
||||||
},
|
},
|
||||||
visibility: {
|
visibility: {
|
||||||
where: "deviceAccount",
|
where: "deviceAccount",
|
||||||
default: "public" as
|
default: "public" as NoteVisibility,
|
||||||
| "public"
|
|
||||||
| "home"
|
|
||||||
| "followers"
|
|
||||||
| "specified"
|
|
||||||
| "private",
|
|
||||||
},
|
},
|
||||||
localOnly: {
|
localOnly: {
|
||||||
where: "deviceAccount",
|
where: "deviceAccount",
|
||||||
|
|
3
packages/client/src/types/note.ts
Normal file
3
packages/client/src/types/note.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { noteVisibilities } from "firefish-js";
|
||||||
|
|
||||||
|
export type NoteVisibility = (typeof noteVisibilities)[number] | "private";
|
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021-2023 Kainoa Kanter, Firefish contributors, Syuilo, and misskey-js contributors
|
Copyright (c) 2021-2024 Firefish contributors, Kainoa Kanter, Syuilo, and misskey-js contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
Loading…
Reference in a new issue