From f465a4aa2e971f5b31f29ea4b1ce6f6398b2281b Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 19 Apr 2020 13:16:52 +0200 Subject: [PATCH] Fix typescript errors --- src/lib/models/Event.ts | 2 +- src/lib/models/Group.ts | 2 +- src/lib/models/Post.ts | 2 +- src/lib/models/User.ts | 2 +- src/routes/HomeRoute.ts | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/models/Event.ts b/src/lib/models/Event.ts index 16a85a3..cfcb7bc 100644 --- a/src/lib/models/Event.ts +++ b/src/lib/models/Event.ts @@ -84,7 +84,7 @@ export class Event extends Model { public async deletable({userId}: { userId: number }, request: any): Promise { userId = userId ?? request.session.userId; if (userId) { - const group = await this.$get("rGroup") as Group; + const group = await this.$get("rGroup") as Group; const user = await User.findByPk(userId); return (await group.$has("rAdmins", user)) || user.isAdmin; } else { diff --git a/src/lib/models/Group.ts b/src/lib/models/Group.ts index 245003f..ed2c4bb 100644 --- a/src/lib/models/Group.ts +++ b/src/lib/models/Group.ts @@ -93,7 +93,7 @@ export class Group extends Model { * Returns the media url of the group which is the profile picture */ public async picture(): Promise { - const media = await this.$get("rMedia") as Media; + const media = await this.$get("rMedia") as Media; return media ? media.url : undefined; } diff --git a/src/lib/models/Post.ts b/src/lib/models/Post.ts index d1acda0..49074d4 100644 --- a/src/lib/models/Post.ts +++ b/src/lib/models/Post.ts @@ -149,7 +149,7 @@ export class Post extends Model { * Returns the media description object of the post */ public async media() { - return await this.$get("rMedia") as Media; + return await this.$get("rMedia") as Media; } /** diff --git a/src/lib/models/User.ts b/src/lib/models/User.ts index ad571db..241ae47 100644 --- a/src/lib/models/User.ts +++ b/src/lib/models/User.ts @@ -267,7 +267,7 @@ export class User extends Model { * Returns the media url which is the profile picture */ public async profilePicture(): Promise { - const media = await this.$get("rMedia") as Media; + const media = await this.$get("rMedia") as Media; return media ? media.url : undefined; } diff --git a/src/routes/HomeRoute.ts b/src/routes/HomeRoute.ts index 97cc980..e4da339 100644 --- a/src/routes/HomeRoute.ts +++ b/src/routes/HomeRoute.ts @@ -40,7 +40,7 @@ class HomeRoute extends Route { } }); globals.internalEmitter.on(InternalEvents.REQUESTCREATE, async (request: Request) => { - if ((await request.$get("sender") as User).id === socket.handshake.session.userId) { + if ((await request.$get("rSender") as User).id === socket.handshake.session.userId) { socket.emit("request", request); } }); @@ -92,7 +92,7 @@ class HomeRoute extends Route { } }); globals.internalEmitter.on(InternalEvents.GQLCHATMESSAGE, async (message: ChatMessage) => { - if ((await message.$get("chat") as ChatRoom).id === chatId) { + if ((await message.$get("rChat") as ChatRoom).id === chatId) { socket.emit("chatMessage", Object.assign(message, {htmlContent: message.htmlContent})); } });