* Feature: add createCustomField resolver * update mocks * fix import * invalidate workspace datasource cache after migration * fix typo
29 lines
787 B
TypeScript
29 lines
787 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { ObjectMetadata } from './object-metadata.entity';
|
|
|
|
@Injectable()
|
|
export class ObjectMetadataService {
|
|
constructor(
|
|
@InjectRepository(ObjectMetadata, 'metadata')
|
|
private readonly fieldMetadataRepository: Repository<ObjectMetadata>,
|
|
) {}
|
|
|
|
public async getObjectMetadataFromDataSourceId(dataSourceId: string) {
|
|
return this.fieldMetadataRepository.find({
|
|
where: { dataSourceId },
|
|
relations: ['fields'],
|
|
});
|
|
}
|
|
|
|
public async getObjectMetadataFromId(objectMetadataId: string) {
|
|
return this.fieldMetadataRepository.findOne({
|
|
where: { id: objectMetadataId },
|
|
relations: ['fields'],
|
|
});
|
|
}
|
|
}
|