mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-29 16:04:14 +00:00
Switch to migrations fully
This commit is contained in:
@@ -45,7 +45,8 @@ router.post("/", route({ body: "InviteCreateSchema", permission: "CREATE_INSTANT
|
||||
channel_id: channel_id,
|
||||
inviter_id: user_id
|
||||
}).save();
|
||||
const data = invite.toJSON();
|
||||
//TODO: check this, removed toJSON call
|
||||
const data = JSON.parse(JSON.stringify(invite));
|
||||
data.inviter = await User.getPublicUser(req.user_id);
|
||||
data.guild = await Guild.findOne({ where: { id: guild_id } });
|
||||
data.channel = channel;
|
||||
|
||||
@@ -61,7 +61,8 @@ router.patch("/", route({ body: "GuildUpdateSchema"}), async (req: Request, res:
|
||||
// TODO: check if body ids are valid
|
||||
guild.assign(body);
|
||||
|
||||
const data = guild.toJSON();
|
||||
//TODO: check this, removed toJSON call
|
||||
const data = JSON.parse(JSON.stringify(guild));
|
||||
// TODO: guild hashes
|
||||
// TODO: fix vanity_url_code, template_id
|
||||
delete data.vanity_url_code;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Config, Guild, Session } from "@fosscord/util";
|
||||
import { createQueryBuilder } from "typeorm";
|
||||
|
||||
export async function initInstance() {
|
||||
// TODO: clean up database and delete tombstone data
|
||||
@@ -9,7 +10,7 @@ export async function initInstance() {
|
||||
const { autoJoin } = Config.get().guild;
|
||||
|
||||
if (autoJoin.enabled && !autoJoin.guilds?.length) {
|
||||
let guild = await Guild.findOne({});
|
||||
let guild = await Guild.findOne({where: {}, order: {id: "ASC"}});
|
||||
if (guild) {
|
||||
// @ts-ignore
|
||||
await Config.set({ guild: { autoJoin: { guilds: [guild.id] } } });
|
||||
|
||||
@@ -201,9 +201,10 @@ export async function postHandleMessage(message: Message) {
|
||||
export async function sendMessage(opts: MessageOptions) {
|
||||
const message = await handleMessage({ ...opts, timestamp: new Date() });
|
||||
|
||||
//TODO: check this, removed toJSON call
|
||||
await Promise.all([
|
||||
Message.insert(message),
|
||||
emitEvent({ event: "MESSAGE_CREATE", channel_id: opts.channel_id, data: message.toJSON() } as MessageCreateEvent)
|
||||
emitEvent({ event: "MESSAGE_CREATE", channel_id: opts.channel_id, data: message } as MessageCreateEvent)
|
||||
]);
|
||||
|
||||
postHandleMessage(message).catch((e) => {}); // no await as it should catch error non-blockingly
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export * from "./entities/AssetCacheItem";
|
||||
export * from "./handlers/Message";
|
||||
export * from "./handlers/route";
|
||||
export * from "./handlers/Voice";
|
||||
export * from "./utility/Base64";
|
||||
export * from "./utility/ipAddress";
|
||||
export * from "./handlers/Message";
|
||||
export * from "./utility/passwordStrength";
|
||||
export * from "./utility/RandomInviteID";
|
||||
export * from "./handlers/route";
|
||||
export * from "./utility/String";
|
||||
export * from "./handlers/Voice";
|
||||
export * from "./entities/AssetCacheItem";
|
||||
export * from "./utility/String";
|
||||
Reference in New Issue
Block a user