Get car Images from URL instead of Base64 in car list
MODIFY
src/storage/mongodb/CarStorage.ts
src/storage/mongodb/CarStorage.ts
@@ -667,6 +667,19 @@ export default class CarStorage {
aggregation.push({
$limit: (dbParams.limit > 0 && dbParams.limit < Constants.DB_RECORD_COUNT_CEIL) ? dbParams.limit : Constants.DB_RECORD_COUNT_CEIL
});
+ // Users
+ if (params.withUser) {
+ DatabaseUtils.pushUserLookupInAggregation({
+ tenantID: tenant.id, aggregation: aggregation, asField: 'user', localField: 'userID',
+ foreignField: '_id', oneToOneCardinality: true, oneToOneCardinalityNotNull: false
+ });
+ }
+ // Car Catalog
+ if (withCarCatalog) {
+ DatabaseUtils.pushCarCatalogLookupInAggregation({
+ tenantID: Constants.DEFAULT_TENANT, aggregation, localField: 'carCatalogID', foreignField: '_id',
+ asField: 'carCatalog', oneToOneCardinality: true
+ });
// Car Image
aggregation.push({
$addFields: {
@@ -685,19 +698,6 @@ export default class CarStorage {
}
}
});
- // Users
- if (params.withUser) {
- DatabaseUtils.pushUserLookupInAggregation({
- tenantID: tenant.id, aggregation: aggregation, asField: 'user', localField: 'userID',
- foreignField: '_id', oneToOneCardinality: true, oneToOneCardinalityNotNull: false
- });
- }
- // Car Catalog
- if (withCarCatalog) {
- DatabaseUtils.pushCarCatalogLookupInAggregation({
- tenantID: Constants.DEFAULT_TENANT, aggregation, localField: 'carCatalogID', foreignField: '_id',
- asField: 'carCatalog', oneToOneCardinality: true
- });
}
// Add Created By / Last Changed By
DatabaseUtils.pushCreatedLastChangedInAggregation(tenant.id, aggregation);

Get car Images from URL instead of Base64 in car list