public FKPSystemQuery(IRepositoryWrapperFKP repository) { Field <ListGraphType <VersionType> >("versions", resolve: context => repository.Version.GetAll(), description: "Все основные версии программы."); Field <VersionType>("version", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "versionId" }), resolve: context => { if (Guid.TryParse(context.GetArgument <string>("versionId"), out var versionId)) { return(repository.Version.GetById(versionId)); } context.Errors.Add(new ExecutionError("Wrong value for guid")); return(null); }); Field <ListGraphType <FinanceWorkPlaceType> >("financeWorkPlaces", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "versionId" }), resolve: context => { var versionId = context.GetArgument <Guid>("versionId"); return(repository.FinanceWorkPlace.GetAllByVersionId(versionId)); } ); Field <ListGraphType <GoalType> >("goals", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "versionId" }), resolve: context => { var versionId = context.GetArgument <Guid>("versionId"); return(repository.Version.GetGoalsByVersionId(versionId)); }, description: "Цели и задачи." ); Field <VersionGeneralInfoType>("versionGeneralInfo", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "versionId" }), resolve: context => { var versionId = context.GetArgument <Guid>("versionId"); return(repository.Version.GetVersionGeneralInfo(versionId)); }, description: "Общая информация о версии программы." ); }
public VersionType(IRepositoryWrapperFKP repository, IDataLoaderContextAccessor dataLoader) { Field(v => v.Rid, type: typeof(IdGraphType)).Name("id").Description("Идентификатор версии программы."); Field(v => v.Code, true).Description("Краткое наименование программы."); Field(v => v.Name, true).Description("Наименование программы."); Field(v => v.Description, true).Description("Описание программы."); Field <VersionGeneralInfoType>("versionGeneralInfo", resolve: context => repository.Version.GetVersionGeneralInfo(context.Source.Rid), description: "Общая информация о версии программы."); Field <ListGraphType <GoalType> >("goals", resolve: context => { var loader = dataLoader.Context .GetOrAddCollectionBatchLoader <Guid, Goal>( "GetAllGoalsByVersionIds", repository.Version.GetAllByVersionIds); return(loader.LoadAsync(context.Source.Rid)); }, description: "Цели и задачи версии программы"); Field <ListGraphType <SpacecraftScheduleType> >("spacecraftSchedules", resolve: context => { var loader = dataLoader.Context .GetOrAddCollectionBatchLoader <Guid, VSpacecraftSpacecraftSchedule>("GetAllSpacecraftSchedulesByVersionIds", repository.SpacecraftSchedule.GetAllByVersionIds); return(loader.LoadAsync(context.Source.Rid)); }, description: "Расписание космических полетов на 2016-2025 года."); Field <ListGraphType <FinanceWorkPlaceType> >("financeWorkPlaces", resolve: context => { var loader = dataLoader.Context .GetOrAddCollectionBatchLoader <Guid, FinanceWorkPlace>( "GetAllFinanceWorkPlacesByVersionIds", repository.FinanceWorkPlace.GetAllByVersionIds); return(loader.LoadAsync(context.Source.Rid)); }, description: "Финансирование."); }
public ProjectsController(IRepositoryWrapperFKP repository) { _repository = repository; }
public FinanceController(IRepositoryWrapperFKP repository) { _repository = repository; }
public SpacecraftsController(IRepositoryWrapperFKP repository) { _repository = repository; }
public TargetIndicatorsController(IRepositoryWrapperFKP repository) { _repository = repository; }
public EconomicEffectsController(IRepositoryWrapperFKP repository) { _repository = repository; }
public WorkEventsController(FKPSystemContext fkpSystemContext, IRepositoryWrapperFKP repository) { _fkpSystemContext = fkpSystemContext; _repository = repository; }
public VersionsController(IRepositoryWrapperFKP repository) { _repository = repository; }