added entityTypes dans les filters
MODIFY
src/assets/server/rest/v1/schemas/pricing/pricing-definition-get.json
src/assets/server/rest/v1/schemas/pricing/pricing-definition-get.json
"properties": {
"ID": {
"$ref": "pricing-definition#/definitions/id"
+ },
+ "entityID": {
+ "$ref": "pricing-definition#/definitions/entityID"
+ },
+ "entityType": {
+ "$ref": "pricing-definition#/definitions/entityType"
}
},
"required": [

MODIFY
src/assets/server/rest/v1/schemas/pricing/pricing-definitions-get.json
src/assets/server/rest/v1/schemas/pricing/pricing-definitions-get.json
"title": "Get Pricing Definitions Request",
"type": "object",
"properties": {
- "EntityID": {
- "type": "string",
- "sanitize": "mongo"
+ "entityID": {
+ "$ref": "pricing-definition#/definitions/entityID"
+ },
+ "entityType": {
+ "$ref": "pricing-definition#/definitions/entityType"
+ },
+ "Limit": {
+ "$ref": "common#/definitions/limit"
}
}
}

MODIFY
src/server/rest/v1/service/PricingService.ts
src/server/rest/v1/service/PricingService.ts
@@ -47,6 +47,8 @@ export default class PricingService {
}
// Get the pricing definitions
const pricingDefinitions = await PricingStorage.getPricingDefinitions(req.tenant, {
+ entityIDs: filteredRequest.entityID ? filteredRequest.entityID.split('|') : null,
+ entityTypes: filteredRequest.entityType ? filteredRequest.entityType.split('|') : null,
...authorizationPricingDefinitionsFilter.filters
}, {
limit: filteredRequest.Limit,

MODIFY
src/storage/mongodb/PricingStorage.ts
src/storage/mongodb/PricingStorage.ts
@@ -57,10 +57,11 @@ export default class PricingStorage {
}
public static async getPricingDefinition(tenant: Tenant, id: string,
- params: { entityIDs?: string[]; } = {}, projectFields?: string[]): Promise<PricingDefinition> {
+ params: { entityIDs?: string[]; entityTypes?: string[]; } = {}, projectFields?: string[]): Promise<PricingDefinition> {
const pricingDefinitionMDB = await PricingStorage.getPricingDefinitions(tenant, {
pricingDefinitionIDs: [id],
entityIDs: params.entityIDs,
+ entityTypes: params.entityTypes
}, Constants.DB_PARAMS_SINGLE_RECORD, projectFields);
return pricingDefinitionMDB.count === 1 ? pricingDefinitionMDB.result[0] : null;
}
@@ -69,6 +70,7 @@ export default class PricingStorage {
params: {
pricingDefinitionIDs?: string[],
entityIDs?: string[];
+ entityTypes?: string[];
},
dbParams: DbParams, projectFields?: string[]): Promise<DataResult<PricingDefinition>> {
const uniqueTimerID = Logging.traceDatabaseRequestStart();

MODIFY
src/types/requests/HttpPricingRequest.ts
src/types/requests/HttpPricingRequest.ts
@@ -8,5 +8,6 @@ export interface HttpPricingDefinitionRequest extends HttpByIDRequest {
export interface HttpPricingDefinitionsRequest extends HttpDatabaseRequest {
ID?: string;
Search?: string;
- EntityID?: string;
+ entityID?: string;
+ entityType?: string;
}

added entityTypes dans les filters