Add function to get all mappings by type
This commit is contained in:
parent
07f41ec618
commit
ba900e913f
@ -1,7 +1,7 @@
|
|||||||
import { DataSource } from 'typeorm'
|
import { DataSource } from 'typeorm'
|
||||||
|
import { Entity, entities } from '../Entities'
|
||||||
import { IdMapping } from '../entity/IdMapping'
|
import { IdMapping } from '../entity/IdMapping'
|
||||||
import { Membership } from '../entity/Membership'
|
import { Membership } from '../entity/Membership'
|
||||||
import { Entity, entities } from '../Entities'
|
|
||||||
|
|
||||||
const AppDataSource = new DataSource({
|
const AppDataSource = new DataSource({
|
||||||
type: 'sqlite',
|
type: 'sqlite',
|
||||||
@ -25,6 +25,10 @@ export function getMapping(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAllMappingsByType(type: number): Promise<IdMapping[]> {
|
||||||
|
return AppDataSource.manager.findBy(IdMapping, { type })
|
||||||
|
}
|
||||||
|
|
||||||
export function getMappingByMatrixId(id: string): Promise<IdMapping | null> {
|
export function getMappingByMatrixId(id: string): Promise<IdMapping | null> {
|
||||||
return AppDataSource.manager.findOneBy(IdMapping, {
|
return AppDataSource.manager.findOneBy(IdMapping, {
|
||||||
matrixId: id,
|
matrixId: id,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user