ent icon indicating copy to clipboard operation
ent copied to clipboard

generate EntQuery for global queries

Open lolopinto opened this issue 1 year ago • 0 comments

recently had to manually create the query but it seems like we should generate it

the main reason not to is that's it unclear what the source id is

export class FooEdge extends AssocEdge {}

export const countLoaderFactory = new AssocEdgeCountLoaderFactory(
  EdgeType.Foo,
);
export const edgeLoaderFactory = new AssocEdgeLoaderFactory(
  EdgeType.Foo,
  () => FooEdge,
);

export class FooQuery extends AssocEdgeQueryBase<
  Ent<Viewer>,
  Profile,
  FooEdge,
  Viewer
> {
  constructor(viewer: Viewer) {
    super(
      viewer,
      GLOBAL_SOURCE,
      countLoaderFactory,
      edgeLoaderFactory,
      Profile.loaderOptions(),
    );
  }

  static query(viewer: Viewer): GlobalOnlineProfilesQuery {
    return new GlobalOnlineProfilesQuery(viewer);
  }

  withoutTransformations(): this {
    this.configureEdgeQueryableDataOptions({ disableTransformations: true });
    return this;
  }

  async sourceEnt(_id: ID) {
    return null;
  }
}

lolopinto avatar Aug 07 '23 19:08 lolopinto