feat: pagination with total count (#3384)
* feat: add totalCount * feat: add command for production to fix existing tables
This commit is contained in:
@ -140,6 +140,11 @@ export class WorkspaceMigrationRunnerService {
|
||||
}),
|
||||
true,
|
||||
);
|
||||
|
||||
// Enable totalCount for the table
|
||||
await queryRunner.query(`
|
||||
COMMENT ON TABLE "${schemaName}"."${tableName}" IS '@graphql({"totalCount": {"enabled": true}})';
|
||||
`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
|
||||
import { GraphQLFieldConfigMap, GraphQLObjectType } from 'graphql';
|
||||
import { GraphQLFieldConfigMap, GraphQLInt, GraphQLObjectType } from 'graphql';
|
||||
|
||||
import { WorkspaceBuildSchemaOptions } from 'src/workspace/workspace-schema-builder/interfaces/workspace-build-schema-optionts.interface';
|
||||
import { ObjectMetadataInterface } from 'src/metadata/field-metadata/interfaces/object-metadata.interface';
|
||||
@ -71,6 +71,11 @@ export class ConnectionTypeDefinitionFactory {
|
||||
),
|
||||
};
|
||||
|
||||
fields.totalCount = {
|
||||
type: GraphQLInt,
|
||||
description: 'Total number of records in the connection',
|
||||
};
|
||||
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user