From ba900e913f8d2a058d30cf03241436cd88c1e5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20H=C3=BCttemann?= Date: Thu, 14 Sep 2023 16:09:34 +0200 Subject: [PATCH] Add function to get all mappings by type --- src/helpers/storage.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/helpers/storage.ts b/src/helpers/storage.ts index a3031dd..b2ddf2b 100644 --- a/src/helpers/storage.ts +++ b/src/helpers/storage.ts @@ -1,7 +1,7 @@ import { DataSource } from 'typeorm' +import { Entity, entities } from '../Entities' import { IdMapping } from '../entity/IdMapping' import { Membership } from '../entity/Membership' -import { Entity, entities } from '../Entities' const AppDataSource = new DataSource({ type: 'sqlite', @@ -25,6 +25,10 @@ export function getMapping( }) } +export function getAllMappingsByType(type: number): Promise { + return AppDataSource.manager.findBy(IdMapping, { type }) +} + export function getMappingByMatrixId(id: string): Promise { return AppDataSource.manager.findOneBy(IdMapping, { matrixId: id,