Skip to content

Commit c009a3a

Browse files
committed
Fix injection on project concrete repos
Concretes aren't finished creating by the time this constructor is called. Since we haven't declared these dependencies to NestJS. Probably will iterate on this later.
1 parent c12998c commit c009a3a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/project/project.edgedb.repository.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Injectable, Type } from '@nestjs/common';
22
import { ModuleRef } from '@nestjs/core';
3+
import { LazyGetter } from 'lazy-get-decorator';
34
import { PublicOf, SortablePaginationInput, UnsecuredDto } from '~/common';
4-
import { grabInstances, InstanceMapOf } from '~/common/instance-maps';
5+
import { grabInstances } from '~/common/instance-maps';
56
import { ChangesOf } from '~/core/database/changes';
67
import { castToEnum, e, RepoFor, ScopeOf } from '~/core/edgedb';
78
import {
@@ -57,11 +58,12 @@ export class ProjectEdgeDBRepository
5758
})
5859
implements PublicOf<Neo4jRepository>
5960
{
60-
protected readonly concretes: InstanceMapOf<typeof ConcreteRepos>;
61-
62-
constructor(moduleRef: ModuleRef) {
61+
constructor(private readonly moduleRef: ModuleRef) {
6362
super();
64-
this.concretes = grabInstances(moduleRef, ConcreteRepos);
63+
}
64+
65+
@LazyGetter() protected get concretes() {
66+
return grabInstances(this.moduleRef, ConcreteRepos);
6567
}
6668

6769
async create(input: CreateProject) {

0 commit comments

Comments
 (0)