Skip to content

Commit

Permalink
fix(serialize): developpers can now specify the fields they want to s…
Browse files Browse the repository at this point in the history
…erialize
  • Loading branch information
SteveBunlon committed Nov 2, 2023
1 parent 419acd9 commit ac99332
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/services/exposed/record-serializer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { inject } = require('@forestadmin/context');
const ResourceSerializer = require('../../serializers/resource');
const ParamsFieldsDeserializer = require('../../deserializers/params-fields');

class RecordSerializer {
constructor(model, user, query, { configStore } = inject()) {
Expand All @@ -17,6 +18,7 @@ class RecordSerializer {

this.model = model;
this.configStore = configStore;
this.query = query;
}

serialize(records, meta = null) {
Expand All @@ -26,6 +28,9 @@ class RecordSerializer {
records,
this.configStore.integrator,
meta,
null,
null,
this.query?.fields ? new ParamsFieldsDeserializer(this.query.fields).perform() : null,
).perform();
}
}
Expand Down

0 comments on commit ac99332

Please sign in to comment.