1

i try to run query graphql:

projects(input:{
    nameTerm:""
    projectTypeTerm:""
    statusTerm:"Initiation Phase"

  })
  {
    id
    name
    status
  }
}

and after that it return message operator does not exist: project_status_enum ~~ unknown" file resolver:

 @Query(() => [Project], { name: 'projects' })
  getProjects(@Args('input') input: GetProjectsInput, ) {
    const query = this.mapper.map(input, GetProjectsQuery, GetProjectsInput);
    return this.queryBus.execute(query);
  }

file enum:

export enum statusProject {
  Initiation = 'Initiation Phase',
  Planning = 'Planning Phase',
  Execution = 'Execution Phase',
  ProjectClosure = 'Project Closure',
}

file handle query:

 async execute(query: GetProjectsQuery): Promise<Project[]> {
    return await this.ProjectRepository.find({
      where: {
        name: Like(`%${query.nameTerm}%`),
        status: Like(`%${query.statusTerm}%`),
        projectType: Like(`%${query.projectTypeTerm}%`)
      },
    });
  }

I try to add {enum:statusProject} in @Query but not work and hope result is:

"projects": \[
{
"id": "77b7134f-270a-4a41-a85a-377311fdbb91",
"name": "Time ABCDFG",
"status": "Initiation Phase"
},\]

1 Answer 1

1

I have fixed the problem by changing status: Like(`%${query.statusTerm}%`)
to status: {query.statusTerm}

Like cannot be used with enum.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.