Merge branch 'feat/notesTable' into slowcord

This commit is contained in:
Madeline
2022-07-23 20:56:26 +10:00
4 changed files with 49 additions and 15 deletions
+18
View File
@@ -0,0 +1,18 @@
import { Column, Entity, JoinColumn, ManyToOne, Unique } from "typeorm";
import { BaseClass } from "./BaseClass";
import { User } from "./User";
@Entity("notes")
@Unique(["owner", "target"])
export class Note extends BaseClass {
@JoinColumn({ name: "owner_id" })
@ManyToOne(() => User, { onDelete: "CASCADE" })
owner: User;
@JoinColumn({ name: "target_id" })
@ManyToOne(() => User, { onDelete: "CASCADE" })
target: User;
@Column()
content: string;
}
+1 -3
View File
@@ -5,6 +5,7 @@ import { Relationship } from "./Relationship";
import { ConnectedAccount } from "./ConnectedAccount";
import { Config, FieldErrors, Snowflake, trimSpecial } from "..";
import { Member, Session } from ".";
import { Note } from "./Note";
export enum PublicUserEnum {
username,
@@ -174,9 +175,6 @@ export class User extends BaseClass {
@Column({ type: "simple-json", select: false })
extended_settings: string;
@Column({ type: "simple-json" })
notes: { [key: string]: string }; //key is ID of user
toPublicUser() {
const user: any = {};
PublicUserProjection.forEach((x) => {
+2 -1
View File
@@ -28,4 +28,5 @@ export * from "./User";
export * from "./VoiceState";
export * from "./Webhook";
export * from "./ClientRelease";
export * from "./BackupCodes";
export * from "./BackupCodes";
export * from "./Note";