fix: multiple bug fixes
All checks were successful
Queue Release Build / prepare (push) Successful in 15s
Deploy Web Apps / deploy (push) Successful in 6m54s
Queue Release Build / build-windows (push) Successful in 16m6s
Queue Release Build / build-linux (push) Successful in 30m58s
Queue Release Build / finalize (push) Successful in 44s
All checks were successful
Queue Release Build / prepare (push) Successful in 15s
Deploy Web Apps / deploy (push) Successful in 6m54s
Queue Release Build / build-windows (push) Successful in 16m6s
Queue Release Build / build-linux (push) Successful in 30m58s
Queue Release Build / finalize (push) Successful in 44s
isolated users, db backup, weird disconnect issues for long voice sessions,
This commit is contained in:
9
electron/cqrs/queries/handlers/getCurrentUserId.ts
Normal file
9
electron/cqrs/queries/handlers/getCurrentUserId.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { MetaEntity } from '../../../entities';
|
||||
|
||||
export async function handleGetCurrentUserId(dataSource: DataSource): Promise<string | null> {
|
||||
const metaRepo = dataSource.getRepository(MetaEntity);
|
||||
const metaRow = await metaRepo.findOne({ where: { key: 'currentUserId' } });
|
||||
|
||||
return metaRow?.value?.trim() || null;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
GetMessageByIdQuery,
|
||||
GetReactionsForMessageQuery,
|
||||
GetUserQuery,
|
||||
GetCurrentUserIdQuery,
|
||||
GetRoomQuery,
|
||||
GetBansForRoomQuery,
|
||||
IsUserBannedQuery,
|
||||
@@ -19,6 +20,7 @@ import { handleGetMessageById } from './handlers/getMessageById';
|
||||
import { handleGetReactionsForMessage } from './handlers/getReactionsForMessage';
|
||||
import { handleGetUser } from './handlers/getUser';
|
||||
import { handleGetCurrentUser } from './handlers/getCurrentUser';
|
||||
import { handleGetCurrentUserId } from './handlers/getCurrentUserId';
|
||||
import { handleGetUsersByRoom } from './handlers/getUsersByRoom';
|
||||
import { handleGetRoom } from './handlers/getRoom';
|
||||
import { handleGetAllRooms } from './handlers/getAllRooms';
|
||||
@@ -34,6 +36,7 @@ export const buildQueryHandlers = (dataSource: DataSource): Record<QueryTypeKey,
|
||||
[QueryType.GetReactionsForMessage]: (query) => handleGetReactionsForMessage(query as GetReactionsForMessageQuery, dataSource),
|
||||
[QueryType.GetUser]: (query) => handleGetUser(query as GetUserQuery, dataSource),
|
||||
[QueryType.GetCurrentUser]: () => handleGetCurrentUser(dataSource),
|
||||
[QueryType.GetCurrentUserId]: () => handleGetCurrentUserId(dataSource),
|
||||
[QueryType.GetUsersByRoom]: () => handleGetUsersByRoom(dataSource),
|
||||
[QueryType.GetRoom]: (query) => handleGetRoom(query as GetRoomQuery, dataSource),
|
||||
[QueryType.GetAllRooms]: () => handleGetAllRooms(dataSource),
|
||||
|
||||
@@ -27,6 +27,7 @@ export const QueryType = {
|
||||
GetReactionsForMessage: 'get-reactions-for-message',
|
||||
GetUser: 'get-user',
|
||||
GetCurrentUser: 'get-current-user',
|
||||
GetCurrentUserId: 'get-current-user-id',
|
||||
GetUsersByRoom: 'get-users-by-room',
|
||||
GetRoom: 'get-room',
|
||||
GetAllRooms: 'get-all-rooms',
|
||||
@@ -214,6 +215,7 @@ export interface GetMessageByIdQuery { type: typeof QueryType.GetMessageById; pa
|
||||
export interface GetReactionsForMessageQuery { type: typeof QueryType.GetReactionsForMessage; payload: { messageId: string } }
|
||||
export interface GetUserQuery { type: typeof QueryType.GetUser; payload: { userId: string } }
|
||||
export interface GetCurrentUserQuery { type: typeof QueryType.GetCurrentUser; payload: Record<string, never> }
|
||||
export interface GetCurrentUserIdQuery { type: typeof QueryType.GetCurrentUserId; payload: Record<string, never> }
|
||||
export interface GetUsersByRoomQuery { type: typeof QueryType.GetUsersByRoom; payload: { roomId: string } }
|
||||
export interface GetRoomQuery { type: typeof QueryType.GetRoom; payload: { roomId: string } }
|
||||
export interface GetAllRoomsQuery { type: typeof QueryType.GetAllRooms; payload: Record<string, never> }
|
||||
@@ -229,6 +231,7 @@ export type Query =
|
||||
| GetReactionsForMessageQuery
|
||||
| GetUserQuery
|
||||
| GetCurrentUserQuery
|
||||
| GetCurrentUserIdQuery
|
||||
| GetUsersByRoomQuery
|
||||
| GetRoomQuery
|
||||
| GetAllRoomsQuery
|
||||
|
||||
Reference in New Issue
Block a user