Skip to content

Commit

Permalink
feat(crudglobalconfig): Allow any relation to be joined in the config
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami Sammour committed Jul 14, 2020
1 parent 5534321 commit 162e33e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface CrudGlobalConfig {
maxLimit?: number;
cache?: number | false;
alwaysPaginate?: boolean;
join?: boolean;
};
serialize?: {
getMany?: false;
Expand Down
4 changes: 4 additions & 0 deletions packages/crud/test/crud-config.service.global.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { CrudConfigService } from '../src/module/crud-config.service';
const conf: CrudGlobalConfig = {
query: {
limit: 10,
join: true,
},
params: {
id: {
Expand Down Expand Up @@ -60,6 +61,7 @@ describe('#crud', () => {
model: { type: TestModel },
query: {
limit: 12,
join: false,
},
params: {
id: {
Expand Down Expand Up @@ -114,6 +116,7 @@ describe('#crud', () => {
expect(res.body.req.options.routes.replaceOneBase.allowParamsOverride).toBe(
true,
);
expect(res.body.req.options.query.join).toBe(true);
done();
});
});
Expand All @@ -139,6 +142,7 @@ describe('#crud', () => {
false,
);
expect(res.body.req.options.routes.deleteOneBase.returnDeleted).toBe(true);
expect(res.body.req.options.query.join).toBe(false);
done();
});
});
Expand Down

0 comments on commit 162e33e

Please sign in to comment.