I am currently utilizing GraphQL and Typeorm in conjunction with an Oracle Database, specifically focusing on retrieving all data from a specific table. The query that is being executed is:
SELECT "inventory"."id" AS "inventory_id", "inventory"."value" AS "inventory_value", "inventory"."description" AS "inventory_description" FROM "inventory" "inventory"
However, it should actually be:
SELECT "inventory"."id" AS "inventory_id", "inventory"."value" AS "inventory_value", "inventory"."description" AS "inventory_description" FROM "dbname.inventory"
The database referenced as "dbname" is connected through a Public Oracle Database Link.
I am wondering if there is a way for me to add "dbname." to the table segment of the GraphQL query or if there is a more efficient approach to address this issue?
Below are my model and resolver files. Please feel free to reach out with any inquiries or suggestions. Thank you in advance and do not hesitate to ask for clarification on anything.
// Inventory.ts
import { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from "typeorm";
import { ObjectType, Field } from "type-graphql";
@Entity()
@ObjectType()
export class inventory extends BaseEntity {
@PrimaryGeneratedColumn("uuid") id: number;
@Field()
@Column({ type: "varchar" })
value: number;
@Field()
@Column({ type: "varchar" })
description: string;
}
// InventoryResolver.ts
import { Resolver, Query } from "type-graphql";
import { inventory } from "../../models/Inventory";
@Resolver(inventory)
export class InventoryResolver {
constructor() {}
@Query(() => inventory, { nullable: true })
async queryInventory() {
return inventory.find();
}
}