Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { logger, Logger } from '../core/logger';
import {
generateEnumMapImports,
entityToCreateInput,
entityToCreateManyArgs,
entityToOrderByEnum,
entityToUpdateInput,
entityToUpdateInputArgs,
entityToWhereArgs,
entityToWhereInput,
entityToWhereUniqueInput
} from './TypeORMConverter';
import { getMetadataStorage, ModelMetadata } from '../metadata';
export class SchemaGenerator {
static logger: Logger = Container.has('warthog.logger')
? Container.get('warthog.logger')
: logger;
static generate(
// This will reference 'warthog in the deployed module, but we need to do a relative import in the examples library
warthogImportPath = 'warthog'
): string {
const metadata = getMetadataStorage();
let template = `
// This file has been auto-generated by Warthog. Do not update directly as it
// will be re-written. If you need to change this file, update models or add
// new TypeGraphQL objects
// @ts-ignore
import { GraphQLDateTime as DateTime } from 'graphql-iso-date';
import { GraphQLID as ID } from 'graphql';
protected async setCurrentStation(user: User | AnonymousUser) {
const manager = Container.has(RealTimeStationsManager) && Container.get(RealTimeStationsManager);
if (manager) {
this.currentStation = manager.stations.find(station => station.isExistedUser(user));
} else {
this.logger.error('could not locate manager');
}
}
}