Skip to content

Commit 64fa7b2

Browse files
authored
feat(count): add middleware to deactivate count (#780)
1 parent 4199902 commit 64fa7b2

File tree

5 files changed

+1936
-2542
lines changed

5 files changed

+1936
-2542
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"dependencies": {
2828
"@babel/runtime": "7.15.4",
2929
"bluebird": "2.9.25",
30-
"forest-express": "9.3.3",
30+
"forest-express": "9.4.0",
3131
"http-errors": "1.7.2",
3232
"lodash": "4.17.21",
3333
"moment": "2.24.0",

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exports.StatSerializer = Interface.StatSerializer;
1414
exports.ResourceSerializer = Interface.ResourceSerializer;
1515

1616
exports.PermissionMiddlewareCreator = Interface.PermissionMiddlewareCreator;
17+
exports.deactivateCountMiddleware = Interface.deactivateCountMiddleware;
1718
exports.RecordsCounter = Interface.RecordsCounter;
1819
exports.RecordsExporter = Interface.RecordsExporter;
1920
exports.RecordsGetter = Interface.RecordsGetter;

test/tests/index.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ describe('index', () => {
4040
expect(forestExpressMongoose.ResourceSerializer).toBeInstanceOf(Function);
4141
});
4242

43+
it('should export deactivate count middleware', () => {
44+
expect.assertions(2);
45+
46+
expect(forestExpressMongoose.deactivateCountMiddleware).toBeDefined();
47+
expect(forestExpressMongoose.deactivateCountMiddleware).toBeInstanceOf(Function);
48+
});
49+
4350
it('should export a list of records functions', () => {
4451
expect.assertions(20);
4552

types/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ export class RecordSerializer<T> {
158158
serialize(records: Record<string, any> | Record<string, any>[]): Promise<RecordsSerialized>;
159159
}
160160

161+
// Optional middleware(s) related to the perf
162+
163+
export function deactivateCountMiddleware(request: Request, response: Response, next: NextFunction): void;
164+
165+
161166
// Everything related to Forest permissions
162167

163168
export class PermissionMiddlewareCreator {

0 commit comments

Comments
 (0)