mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 10:22:39 +01:00
Merge pull request #1178 from DEVTomatoCake/fix/1154-mysql-charset
This commit is contained in:
commit
9bcc178093
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,8 +20,12 @@ import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Team } from "./Team";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("applications")
|
||||
@Entity({
|
||||
name: "applications",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Application extends BaseClass {
|
||||
@Column()
|
||||
name: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -27,8 +27,12 @@ import {
|
||||
import { URL } from "url";
|
||||
import { deleteFile } from "../util/cdn";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("attachments")
|
||||
@Entity({
|
||||
name: "attachments",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Attachment extends BaseClass {
|
||||
@Column()
|
||||
filename: string; // name of file attached
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,6 +20,7 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { ChannelPermissionOverwrite } from "./Channel";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum AuditLogEvents {
|
||||
// guild level
|
||||
@ -111,7 +112,10 @@ export enum AuditLogEvents {
|
||||
ROUTE_UPDATE = 226,
|
||||
}
|
||||
|
||||
@Entity("audit_logs")
|
||||
@Entity({
|
||||
name: "audit_logs",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class AuditLog extends BaseClass {
|
||||
@JoinColumn({ name: "target_id" })
|
||||
@ManyToOne(() => User)
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,8 +20,12 @@ import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import crypto from "crypto";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("backup_codes")
|
||||
@Entity({
|
||||
name: "backup_codes",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class BackupCode extends BaseClass {
|
||||
@JoinColumn({ name: "user_id" })
|
||||
@ManyToOne(() => User, { onDelete: "CASCADE" })
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClassWithoutId } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("badges")
|
||||
@Entity({
|
||||
name: "badges",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Badge extends BaseClassWithoutId {
|
||||
@Column({ primary: true })
|
||||
id: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,8 +20,12 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Guild } from "./Guild";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("bans")
|
||||
@Entity({
|
||||
name: "bans",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Ban extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
@RelationId((ban: Ban) => ban.user)
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
// TODO: categories:
|
||||
// [{
|
||||
@ -33,7 +34,10 @@ import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
|
||||
// }]
|
||||
// Also populate discord default categories
|
||||
|
||||
@Entity("categories")
|
||||
@Entity({
|
||||
name: "categories",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Categories extends BaseClassWithoutId {
|
||||
// Not using snowflake
|
||||
|
||||
|
@ -44,6 +44,7 @@ import { Recipient } from "./Recipient";
|
||||
import { PublicUserProjection, User } from "./User";
|
||||
import { VoiceState } from "./VoiceState";
|
||||
import { Webhook } from "./Webhook";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum ChannelType {
|
||||
GUILD_TEXT = 0, // a text channel within a guild
|
||||
@ -69,7 +70,10 @@ export enum ChannelType {
|
||||
UNHANDLED = 255, // unhandled unowned pass-through channel type
|
||||
}
|
||||
|
||||
@Entity("channels")
|
||||
@Entity({
|
||||
name: "channels",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Channel extends BaseClass {
|
||||
@Column()
|
||||
created_at: Date;
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("client_release")
|
||||
@Entity({
|
||||
name: "client_release",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Release extends BaseClass {
|
||||
@Column()
|
||||
name: string;
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("config")
|
||||
@Entity({
|
||||
name: "config",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class ConfigEntity extends BaseClassWithoutId {
|
||||
@PrimaryIdColumn()
|
||||
key: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,13 +20,17 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { ConnectedAccountTokenData } from "../interfaces";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export type PublicConnectedAccount = Pick<
|
||||
ConnectedAccount,
|
||||
"name" | "type" | "verified"
|
||||
>;
|
||||
|
||||
@Entity("connected_accounts")
|
||||
@Entity({
|
||||
name: "connected_accounts",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class ConnectedAccount extends BaseClass {
|
||||
@Column()
|
||||
external_id: string;
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("connection_config")
|
||||
@Entity({
|
||||
name: "connection_config",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class ConnectionConfigEntity extends BaseClassWithoutId {
|
||||
@PrimaryIdColumn()
|
||||
key: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -19,8 +19,12 @@
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Entity, Column } from "typeorm";
|
||||
import { Embed } from "./Message";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("embed_cache")
|
||||
@Entity({
|
||||
name: "embed_cache",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class EmbedCache extends BaseClass {
|
||||
@Column()
|
||||
url: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,8 +20,12 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { User } from ".";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Guild } from "./Guild";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("emojis")
|
||||
@Entity({
|
||||
name: "emojis",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Emoji extends BaseClass {
|
||||
@Column()
|
||||
animated: boolean;
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("security_settings")
|
||||
@Entity({
|
||||
name: "security_settings",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class SecuritySettings extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
guild_id: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -37,6 +37,7 @@ import { Template } from "./Template";
|
||||
import { User } from "./User";
|
||||
import { VoiceState } from "./VoiceState";
|
||||
import { Webhook } from "./Webhook";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
// TODO: application_command_count, application_command_counts: {1: 0, 2: 0, 3: 0}
|
||||
// TODO: guild_scheduled_events
|
||||
@ -66,7 +67,10 @@ export const PublicGuildRelations = [
|
||||
// "members.user",
|
||||
];
|
||||
|
||||
@Entity("guilds")
|
||||
@Entity({
|
||||
name: "guilds",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Guild extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
@RelationId((guild: Guild) => guild.afk_channel)
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -22,10 +22,14 @@ import { Channel } from "./Channel";
|
||||
import { Guild } from "./Guild";
|
||||
import { Member } from "./Member";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export const PublicInviteRelation = ["inviter", "guild", "channel"];
|
||||
|
||||
@Entity("invites")
|
||||
@Entity({
|
||||
name: "invites",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Invite extends BaseClassWithoutId {
|
||||
@PrimaryIdColumn()
|
||||
code: string;
|
||||
|
@ -48,6 +48,7 @@ import { Guild } from "./Guild";
|
||||
import { Message } from "./Message";
|
||||
import { Role } from "./Role";
|
||||
import { PublicUser, User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export const MemberPrivateProjection: (keyof Member)[] = [
|
||||
"id",
|
||||
@ -65,7 +66,10 @@ export const MemberPrivateProjection: (keyof Member)[] = [
|
||||
"user",
|
||||
];
|
||||
|
||||
@Entity("members")
|
||||
@Entity({
|
||||
name: "members",
|
||||
engine: dbEngine,
|
||||
})
|
||||
@Index(["id", "guild_id"], { unique: true })
|
||||
export class Member extends BaseClassWithoutId {
|
||||
@PrimaryGeneratedColumn()
|
||||
|
@ -39,6 +39,7 @@ import { Guild } from "./Guild";
|
||||
import { Webhook } from "./Webhook";
|
||||
import { Sticker } from "./Sticker";
|
||||
import { Attachment } from "./Attachment";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum MessageType {
|
||||
DEFAULT = 0,
|
||||
@ -68,7 +69,10 @@ export enum MessageType {
|
||||
UNHANDLED = 255,
|
||||
}
|
||||
|
||||
@Entity("messages")
|
||||
@Entity({
|
||||
name: "messages",
|
||||
engine: dbEngine,
|
||||
})
|
||||
@Index(["channel_id", "id"], { unique: true })
|
||||
export class Message extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -23,6 +23,7 @@ import {
|
||||
PrimaryGeneratedColumn,
|
||||
BaseEntity,
|
||||
} from "typeorm";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export const PrimaryIdAutoGenerated = process.env.DATABASE?.startsWith(
|
||||
"mongodb",
|
||||
@ -30,7 +31,10 @@ export const PrimaryIdAutoGenerated = process.env.DATABASE?.startsWith(
|
||||
? ObjectIdColumn
|
||||
: PrimaryGeneratedColumn;
|
||||
|
||||
@Entity("migrations")
|
||||
@Entity({
|
||||
name: "migrations",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Migration extends BaseEntity {
|
||||
@PrimaryIdAutoGenerated()
|
||||
id: number;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -19,8 +19,12 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, Unique } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("notes")
|
||||
@Entity({
|
||||
name: "notes",
|
||||
engine: dbEngine,
|
||||
})
|
||||
@Unique(["owner", "target"])
|
||||
export class Note extends BaseClass {
|
||||
@JoinColumn({ name: "owner_id" })
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("rate_limits")
|
||||
@Entity({
|
||||
name: "rate_limits",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class RateLimit extends BaseClass {
|
||||
@Column() // no relation as it also
|
||||
executor_id: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -27,12 +27,16 @@ import {
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Channel } from "./Channel";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
// for read receipts
|
||||
// notification cursor and public read receipt need to be forwards-only (the former to prevent re-pinging when marked as unread, and the latter to be acceptable as a legal acknowledgement in criminal proceedings), and private read marker needs to be advance-rewind capable
|
||||
// public read receipt ≥ notification cursor ≥ private fully read marker
|
||||
|
||||
@Entity("read_states")
|
||||
@Entity({
|
||||
name: "read_states",
|
||||
engine: dbEngine,
|
||||
})
|
||||
@Index(["channel_id", "user_id"], { unique: true })
|
||||
export class ReadState extends BaseClass {
|
||||
@Column()
|
||||
|
@ -1,25 +1,29 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("recipients")
|
||||
@Entity({
|
||||
name: "recipients",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Recipient extends BaseClass {
|
||||
@Column()
|
||||
@RelationId((recipient: Recipient) => recipient.channel)
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -26,6 +26,7 @@ import {
|
||||
} from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum RelationshipType {
|
||||
outgoing = 4,
|
||||
@ -34,7 +35,10 @@ export enum RelationshipType {
|
||||
friends = 1,
|
||||
}
|
||||
|
||||
@Entity("relationships")
|
||||
@Entity({
|
||||
name: "relationships",
|
||||
engine: dbEngine,
|
||||
})
|
||||
@Index(["from_id", "to_id"], { unique: true })
|
||||
export class Relationship extends BaseClass {
|
||||
@Column({})
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,8 +20,12 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Guild } from "./Guild";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("roles")
|
||||
@Entity({
|
||||
name: "roles",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Role extends BaseClass {
|
||||
@Column()
|
||||
@RelationId((role: Role) => role.guild)
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -19,8 +19,12 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("security_keys")
|
||||
@Entity({
|
||||
name: "security_keys",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class SecurityKey extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
@RelationId((key: SecurityKey) => key.user)
|
||||
|
@ -21,10 +21,14 @@ import { BaseClass } from "./BaseClass";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { ClientStatus, Status } from "../interfaces/Status";
|
||||
import { Activity } from "../interfaces/Activity";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
//TODO we need to remove all sessions on server start because if the server crashes without closing websockets it won't delete them
|
||||
|
||||
@Entity("sessions")
|
||||
@Entity({
|
||||
name: "sessions",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Session extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
@RelationId((session: Session) => session.user)
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,6 +20,7 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Guild } from "./Guild";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum StickerType {
|
||||
STANDARD = 1,
|
||||
@ -33,7 +34,10 @@ export enum StickerFormatType {
|
||||
LOTTIE = 3,
|
||||
}
|
||||
|
||||
@Entity("stickers")
|
||||
@Entity({
|
||||
name: "stickers",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Sticker extends BaseClass {
|
||||
@Column()
|
||||
name: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -26,8 +26,12 @@ import {
|
||||
} from "typeorm";
|
||||
import { Sticker } from ".";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("sticker_packs")
|
||||
@Entity({
|
||||
name: "sticker_packs",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class StickerPack extends BaseClass {
|
||||
@Column()
|
||||
name: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -27,8 +27,12 @@ import {
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { TeamMember } from "./TeamMember";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("teams")
|
||||
@Entity({
|
||||
name: "teams",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Team extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
icon?: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -19,13 +19,17 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum TeamMemberState {
|
||||
INVITED = 1,
|
||||
ACCEPTED = 2,
|
||||
}
|
||||
|
||||
@Entity("team_members")
|
||||
@Entity({
|
||||
name: "team_members",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class TeamMember extends BaseClass {
|
||||
@Column({ type: "int" })
|
||||
membership_state: TeamMemberState;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,8 +20,12 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { Guild } from "./Guild";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("templates")
|
||||
@Entity({
|
||||
name: "templates",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Template extends BaseClass {
|
||||
@Column({ unique: true })
|
||||
code: string;
|
||||
|
@ -34,6 +34,7 @@ import { Relationship } from "./Relationship";
|
||||
import { SecurityKey } from "./SecurityKey";
|
||||
import { Session } from "./Session";
|
||||
import { UserSettings } from "./UserSettings";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum PublicUserEnum {
|
||||
username,
|
||||
@ -86,7 +87,10 @@ export interface UserPrivate extends Pick<User, PrivateUserKeys> {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
@Entity("users")
|
||||
@Entity({
|
||||
name: "users",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class User extends BaseClass {
|
||||
@Column()
|
||||
username: string; // username max length 32, min 2 (should be configurable)
|
||||
|
@ -18,8 +18,12 @@
|
||||
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { BaseClassWithoutId } from "./BaseClass";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("user_settings")
|
||||
@Entity({
|
||||
name: "user_settings",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class UserSettings extends BaseClassWithoutId {
|
||||
@PrimaryGeneratedColumn()
|
||||
index: string;
|
||||
|
@ -1,24 +1,28 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseEntity, Column, Entity, PrimaryColumn } from "typeorm";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
@Entity("valid_registration_tokens")
|
||||
@Entity({
|
||||
name: "valid_registration_tokens",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class ValidRegistrationToken extends BaseEntity {
|
||||
@PrimaryColumn()
|
||||
token: string;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -22,9 +22,13 @@ import { Channel } from "./Channel";
|
||||
import { Guild } from "./Guild";
|
||||
import { Member } from "./Member";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
//https://gist.github.com/vassjozsef/e482c65df6ee1facaace8b3c9ff66145#file-voice_state-ex
|
||||
@Entity("voice_states")
|
||||
@Entity({
|
||||
name: "voice_states",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class VoiceState extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
@RelationId((voice_state: VoiceState) => voice_state.guild)
|
||||
|
@ -22,6 +22,7 @@ import { BaseClass } from "./BaseClass";
|
||||
import { Channel } from "./Channel";
|
||||
import { Guild } from "./Guild";
|
||||
import { User } from "./User";
|
||||
import { dbEngine } from "../util/Database";
|
||||
|
||||
export enum WebhookType {
|
||||
Incoming = 1,
|
||||
@ -29,7 +30,10 @@ export enum WebhookType {
|
||||
Application = 3,
|
||||
}
|
||||
|
||||
@Entity("webhooks")
|
||||
@Entity({
|
||||
name: "webhooks",
|
||||
engine: dbEngine,
|
||||
})
|
||||
export class Webhook extends BaseClass {
|
||||
@Column({ type: "int" })
|
||||
type: WebhookType;
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -134,3 +134,6 @@ export { DataSourceOptions, DatabaseType, dbConnection };
|
||||
export async function closeDatabase() {
|
||||
await dbConnection?.destroy();
|
||||
}
|
||||
|
||||
export const dbEngine =
|
||||
"InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
|
||||
|
Loading…
Reference in New Issue
Block a user