I wrote this function that filter the table building end optionally I can pass a Prisma.BuildingInclude object to return one ore more subobject.
async describeEntity(filter: Filter, include?: Prisma.BuildingInclude): Promise<CCResponse> {
try {
const entity = await this.prisma.building.findMany({
where: this.queryCondition(filter),
include,
});
return new CCResponse('OK', entity);
}
catch (err) {
console.log(err);
return new CCResponse('INTERNAL_ERROR', this.content['GeneralError']);
}
}
The problem is that if I pass the include parameter, into prisma response I have also the fields of the building. How can I return only the subobject fields when the include parameter is present?