From fee39e65ae2230c7d559077db985c31bd19627fd Mon Sep 17 00:00:00 2001 From: Rashmika998 Date: Fri, 3 Apr 2026 10:40:24 +0530 Subject: [PATCH 1/5] add instances based endpoints --- .../backend/modules/entity/entity.bal | 11 + .../backend/modules/entity/types.bal | 112 ++++++---- .../backend/modules/types/types.bal | 57 +++-- apps/customer-portal/backend/openapi.yaml | 144 ++++++++++--- apps/customer-portal/backend/service.bal | 203 ++++++++++++++++-- apps/customer-portal/backend/utils.bal | 40 ++-- 6 files changed, 463 insertions(+), 104 deletions(-) diff --git a/apps/customer-portal/backend/modules/entity/entity.bal b/apps/customer-portal/backend/modules/entity/entity.bal index 1a32dfa9ca..69e843e3a8 100644 --- a/apps/customer-portal/backend/modules/entity/entity.bal +++ b/apps/customer-portal/backend/modules/entity/entity.bal @@ -554,3 +554,14 @@ public isolated function getProjectChangeRequestStats(string idToken, string pro return csEntityClient->/projects/[projectId]/change\-requests/stats.get(generateHeaders(idToken)); } + +# Search instances by criteria. +# +# + idToken - ID token for authorization +# + payload - Instance search payload containing search criteria for instances +# + return - Instances response containing matching instances or error +public isolated function searchInstances(string idToken, InstanceSearchPayload payload) + returns InstancesResponse|error { + + return csEntityClient->/instances/search.post(payload, generateHeaders(idToken)); +} diff --git a/apps/customer-portal/backend/modules/entity/types.bal b/apps/customer-portal/backend/modules/entity/types.bal index 0c935ab7f1..63b56728ac 100644 --- a/apps/customer-portal/backend/modules/entity/types.bal +++ b/apps/customer-portal/backend/modules/entity/types.bal @@ -848,38 +848,10 @@ public type ProductUpdate record {| public type DeployedProductSearchPayload record {| # Deployment ID IdString deploymentId; - # Filters - record { - # Consumption based filters - ConsumptionFilter consumption?; - } filters?; # Pagination details Pagination pagination?; |}; -# Instance information. -public type Instance record {| - # ID of the instance - IdString id; - # Instance identifier - string instance; - # Core usage count - int? coreUsageCount; - # Update count - int? updates; - # JDK version - string? jdkVersion; - # Created date and time - string? createdOn; - # Updated date and time - string? updatedOn; - # Custom created date and time - string? customCreatedOn; - # Custom updated date and time - string? customUpdatedOn; - json...; -|}; - # Deployed product data. public type DeployedProduct record {| # ID @@ -910,8 +882,6 @@ public type DeployedProduct record {| string? endOfLifeOn; # Instances of the deployed product int instanceCount?; - # Details of the instances - Instance[]? instances?; json...; |}; @@ -1003,21 +973,83 @@ public type DeploymentSearchPayload record {| record {| # Project IDs IdString[] projectIds?; - # Consumption based filters - ConsumptionFilter consumption?; |} filters?; # Pagination details Pagination pagination?; |}; -# Consumption filter. -public type ConsumptionFilter record {| - # Indicates whether to filter based on consumption (true to filter) - boolean include?; - # Start date of consumption - Date startDate?; - # End date of consumption - Date endDate?; +# Instance search filters. +public type InstanceSearchPayload record {| + # Filter criteria + record {| + # Start date of consumption + Date startDate?; + # End date of consumption + Date endDate?; + # List of project IDs (mutually exclusive with deploymentIds and deployedProductIds) + IdString[] projectIds?; + # List of deployment IDs (mutually exclusive with projectIds and deployedProductIds) + IdString[] deploymentIds?; + # List of deployed product IDs (mutually exclusive with projectIds and deploymentIds) + IdString[] deployedProductIds?; + |} filters?; + # Pagination details + Pagination pagination?; +|}; + +# Instance metadata. +public type InstanceMetadata record {| + # ID + IdString id; + # Core count + int? coreCount; + # Number of updates + int? updates; + # JDK version + string? jdkVersion; + # Deployment-specific metadata + map? deploymentMetadata; + # Created date and time + string createdOn; + # Updated date and time + string updatedOn; + # Custom created date and time + string? customCreatedOn; + # Custom updated date and time + string? customUpdatedOn; + json...; +|}; + +# Instance data. +public type Instance record {| + # ID + IdString id; + # Instance name + string instance; + # Associated project information + ReferenceTableItem? project; + # Associated deployment information + ReferenceTableItem? deployment; + # Associated product information + ReferenceTableItem? product; + # Associated deployed product information + ReferenceTableItem? deployedProduct; + # Created date and time + string createdOn; + # Updated date and time + string updatedOn; + # Instance metadata + InstanceMetadata? metadata; + json...; +|}; + +# Instances response. +public type InstancesResponse record {| + # List of instances + Instance[] instances; + # Total records count + int totalRecords; + *Pagination; |}; # Deployment data. diff --git a/apps/customer-portal/backend/modules/types/types.bal b/apps/customer-portal/backend/modules/types/types.bal index 1310b4626d..3cffeab065 100644 --- a/apps/customer-portal/backend/modules/types/types.bal +++ b/apps/customer-portal/backend/modules/types/types.bal @@ -569,11 +569,6 @@ public type AttachmentUpdatePayload record {| # Request payload for searching deployments. public type DeploymentSearchPayload record {| - # Filter criteria - record {| - # Consumtion based filters - entity:ConsumptionFilter consumption?; - |} filters?; # Pagination details entity:Pagination pagination?; |}; @@ -613,11 +608,6 @@ public type DeploymentsResponse record {| # Deployed product search payload public type DeployedProductSearchPayload record {| - # Filters - record { - # Consumtion based filters - entity:ConsumptionFilter consumption?; - } filters?; # Pagination details entity:Pagination pagination?; |}; @@ -652,8 +642,51 @@ public type DeployedProduct record {| string? endOfLifeOn; # Instances of the deployed product int instanceCount?; - # Details of the instances - entity:Instance[]? instances?; +|}; + +# Instance search filters. +public type InstanceSearchPayload record {| + # Filter criteria + record {| + # Start date of consumption + entity:Date startDate?; + # End date of consumption + entity:Date endDate?; + |} filters?; + # Pagination details + entity:Pagination pagination?; +|}; + +# Instance data. +public type Instance record {| + # ID + entity:IdString id; + # Instance name + string instance; + # Associated project information + ReferenceItem? project; + # Associated deployment information + ReferenceItem? deployment; + # Associated product information + ReferenceItem? product; + # Associated deployed product information + ReferenceItem? deployedProduct; + # Created date and time + string createdOn; + # Updated date and time + string updatedOn; + # Instance metadata + entity:InstanceMetadata? metadata; + json...; +|}; + +# Instances response. +public type InstancesResponse record {| + # List of instances + Instance[] instances; + # Total records count + int totalRecords; + *entity:Pagination; |}; # Deployed products response. diff --git a/apps/customer-portal/backend/openapi.yaml b/apps/customer-portal/backend/openapi.yaml index b40ff804ff..0b9c1752a1 100644 --- a/apps/customer-portal/backend/openapi.yaml +++ b/apps/customer-portal/backend/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: Service Openapi Yaml - version: 0.1.0 + version: 1.0.0-rc.2 servers: - url: "{server}:{port}/" variables: @@ -272,6 +272,39 @@ paths: description: InternalServerError "403": description: Forbidden + /projects/{id}/instances/search: + post: + summary: Search instances of a project. + operationId: postProjectsIdInstancesSearch + parameters: + - name: id + in: path + description: ID of the project + required: true + schema: + $ref: '#/components/schemas/IdString' + requestBody: + description: Payload for searching instances of the project + content: + application/json: + schema: + $ref: '#/components/schemas/InstanceSearchPayload' + required: true + responses: + "200": + description: Ok + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorPayload' + "401": + description: Unauthorized + "500": + description: InternalServerError + "403": + description: Forbidden /deployments/{id}/attachments: get: summary: Get attachments for a specific deployment. @@ -392,6 +425,39 @@ paths: description: InternalServerError "403": description: Forbidden + /deployments/{id}/instances/search: + post: + summary: Search instances of a deployment. + operationId: postDeploymentsIdInstancesSearch + parameters: + - name: id + in: path + description: ID of the deployment + required: true + schema: + $ref: '#/components/schemas/IdString' + requestBody: + description: Payload for searching instances of the deployment + content: + application/json: + schema: + $ref: '#/components/schemas/InstanceSearchPayload' + required: true + responses: + "200": + description: Ok + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorPayload' + "401": + description: Unauthorized + "500": + description: InternalServerError + "403": + description: Forbidden /projects/{id}/stats: get: summary: Get overall project statistics by ID. @@ -1354,6 +1420,39 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorPayload' + /deployments/products/{id}/instances/search: + post: + summary: Search instances for a specific deployed product with filters and pagination. + operationId: postDeploymentsProductsIdInstancesSearch + parameters: + - name: id + in: path + description: ID of the deployed product + required: true + schema: + $ref: '#/components/schemas/IdString' + requestBody: + description: Instance search request body + content: + application/json: + schema: + $ref: '#/components/schemas/InstanceSearchPayload' + required: true + responses: + "200": + description: Ok + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorPayload' + "401": + description: Unauthorized + "500": + description: InternalServerError + "403": + description: Forbidden /catalogs/{catalogId}/items/{itemId}: get: summary: Get catalog item variables by catalog ID and item ID. @@ -2360,10 +2459,12 @@ components: type: string description: Allowed domain list of the account nullable: true + default: "" classification: type: string description: Account classification nullable: true + default: "" isPartner: type: boolean description: Whether the account is a partner or not @@ -3330,18 +3431,6 @@ components: limit: type: integer format: int64 - ConsumptionFilter: - type: object - properties: - include: - type: boolean - description: Indicates whether to filter based on consumption (true to filter) - startDate: - $ref: '#/components/schemas/Date' - endDate: - $ref: '#/components/schemas/Date' - additionalProperties: false - description: Consumption filter. Contact: required: - email @@ -3766,12 +3855,6 @@ components: DeployedProductSearchPayload: type: object properties: - filters: - type: object - properties: - consumption: - $ref: '#/components/schemas/ConsumptionFilter' - description: Filters pagination: $ref: '#/components/schemas/Pagination' additionalProperties: false @@ -3826,13 +3909,6 @@ components: DeploymentSearchPayload: type: object properties: - filters: - type: object - properties: - consumption: - $ref: '#/components/schemas/ConsumptionFilter' - additionalProperties: false - description: Filter criteria pagination: $ref: '#/components/schemas/Pagination' additionalProperties: false @@ -3923,6 +3999,22 @@ components: description: User who created additionalProperties: false description: Inline attachment. + InstanceSearchPayload: + type: object + properties: + filters: + type: object + properties: + startDate: + $ref: '#/components/schemas/Date' + endDate: + $ref: '#/components/schemas/Date' + additionalProperties: false + description: Filter criteria + pagination: + $ref: '#/components/schemas/Pagination' + additionalProperties: false + description: Instance search filters. IntegrationUser: required: - email diff --git a/apps/customer-portal/backend/service.bal b/apps/customer-portal/backend/service.bal index b388dfa672..cf3937ce7e 100644 --- a/apps/customer-portal/backend/service.bal +++ b/apps/customer-portal/backend/service.bal @@ -463,12 +463,7 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { entity:DeploymentsResponse|error deploymentsResponse = entity:searchDeployments(userInfo.idToken, { filters: { - projectIds: [id], - consumption: { - include: payload.filters?.consumption?.include, - startDate: payload.filters?.consumption?.startDate, - endDate: payload.filters?.consumption?.endDate - } + projectIds: [id] }, pagination: payload.pagination }); @@ -610,6 +605,69 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { return response.deployment; } + # Search instances of a project. + # + # + id - ID of the project + # + payload - Payload for searching instances of the project + # + return - Instances response or error response + resource function post projects/[entity:IdString id]/instances/search(http:RequestContext ctx, + types:InstanceSearchPayload payload) + returns http:Ok|http:BadRequest|http:Unauthorized|http:Forbidden|http:InternalServerError { + + authorization:UserInfoPayload|error userInfo = ctx.getWithType(authorization:HEADER_USER_INFO); + if userInfo is error { + return { + body: { + message: ERR_MSG_USER_INFO_HEADER_NOT_FOUND + } + }; + } + entity:InstancesResponse|error instances = entity:searchInstances(userInfo.idToken, + { + filters: {projectIds: [id]}, + pagination: payload.pagination + }); + if instances is error { + if getStatusCode(instances) == http:STATUS_FORBIDDEN { + log:printWarn(string `User: ${ + userInfo.userId} is forbidden to search instances for project with ID: ${id}!`); + return { + body: { + message: "You're not authorized to search instances for the project. " + + "Please check your access permissions or contact support." + } + }; + } + if getStatusCode(instances) == http:STATUS_UNAUTHORIZED { + log:printWarn(string `User: ${userInfo.userId} is not authorized to access the customer portal!`); + return { + body: { + message: ERR_MSG_UNAUTHORIZED_ACCESS + } + }; + } + if getStatusCode(instances) == http:STATUS_BAD_REQUEST { + string customError = "Invalid request parameters for searching instances for the project."; + log:printWarn(customError, instances); + return { + body: { + message: customError + } + }; + } + + string customError = "Failed to search instances for the project."; + log:printError(customError, instances); + return { + body: { + message: customError + } + }; + } + + return {body: mapInstancesResponse(instances)}; + } + # Get attachments for a specific deployment. # # + id - ID of the deployment @@ -801,6 +859,69 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { return response.attachment; } + # Search instances of a deployment. + # + # + id - ID of the deployment + # + payload - Payload for searching instances of the deployment + # + return - Instances response or error response + resource function post deployments/[entity:IdString id]/instances/search(http:RequestContext ctx, + types:InstanceSearchPayload payload) + returns http:Ok|http:BadRequest|http:Unauthorized|http:Forbidden|http:InternalServerError { + + authorization:UserInfoPayload|error userInfo = ctx.getWithType(authorization:HEADER_USER_INFO); + if userInfo is error { + return { + body: { + message: ERR_MSG_USER_INFO_HEADER_NOT_FOUND + } + }; + } + entity:InstancesResponse|error instances = entity:searchInstances(userInfo.idToken, + { + filters: {deploymentIds: [id]}, + pagination: payload.pagination + }); + if instances is error { + if getStatusCode(instances) == http:STATUS_FORBIDDEN { + log:printWarn(string `User: ${ + userInfo.userId} is forbidden to search instances for deployment with ID: ${id}!`); + return { + body: { + message: "You're not authorized to search instances for the deployment. " + + "Please check your access permissions or contact support." + } + }; + } + if getStatusCode(instances) == http:STATUS_UNAUTHORIZED { + log:printWarn(string `User: ${userInfo.userId} is not authorized to access the customer portal!`); + return { + body: { + message: ERR_MSG_UNAUTHORIZED_ACCESS + } + }; + } + if getStatusCode(instances) == http:STATUS_BAD_REQUEST { + string customError = "Invalid request parameters for searching instances for the deployment."; + log:printWarn(customError, instances); + return { + body: { + message: customError + } + }; + } + + string customError = "Failed to search instances for the deployment."; + log:printError(customError, instances); + return { + body: { + message: customError + } + }; + } + + return {body: mapInstancesResponse(instances)}; + } + # Get overall project statistics by ID. # # + id - ID of the project @@ -2247,12 +2368,6 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { entity:DeployedProductsResponse|error productsResponse = entity:searchDeployedProducts(userInfo.idToken, { deploymentId: id, - filters: { - consumption: { - startDate: payload.filters?.consumption?.startDate, - endDate: payload.filters?.consumption?.endDate - } - }, pagination: payload.pagination }); if productsResponse is error { @@ -2471,6 +2586,70 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { return {body: mapCatalogSearchResponse(searchResponse)}; } + # Search instances for a specific deployed product with filters and pagination. + # + # + id - ID of the deployed product + # + payload - Instance search request body + # + return - Paginated instances or error + resource function post deployments/products/[entity:IdString id]/instances/search(http:RequestContext ctx, + types:InstanceSearchPayload payload) + returns http:Ok|http:BadRequest|http:Unauthorized|http:Forbidden|http:InternalServerError { + + authorization:UserInfoPayload|error userInfo = ctx.getWithType(authorization:HEADER_USER_INFO); + if userInfo is error { + return { + body: { + message: ERR_MSG_USER_INFO_HEADER_NOT_FOUND + } + }; + } + + entity:InstancesResponse|error instances = entity:searchInstances(userInfo.idToken, + { + filters: {deployedProductIds: [id]}, + pagination: payload.pagination + }); + if instances is error { + if getStatusCode(instances) == http:STATUS_FORBIDDEN { + log:printWarn(string `User: ${ + userInfo.userId} is forbidden to search instances for deployed product with ID: ${id}!`); + return { + body: { + message: "You're not authorized to search instances for the deployed product. " + + "Please check your access permissions or contact support." + } + }; + } + if getStatusCode(instances) == http:STATUS_UNAUTHORIZED { + log:printWarn(string `User: ${userInfo.userId} is not authorized to access the customer portal!`); + return { + body: { + message: ERR_MSG_UNAUTHORIZED_ACCESS + } + }; + } + if getStatusCode(instances) == http:STATUS_BAD_REQUEST { + string customError = "Invalid request parameters for searching instances for the deployed product."; + log:printWarn(customError, instances); + return { + body: { + message: customError + } + }; + } + + string customError = "Failed to search instances for the deployed product."; + log:printError(customError, instances); + return { + body: { + message: customError + } + }; + } + + return {body: mapInstancesResponse(instances)}; + } + # Get catalog item variables by catalog ID and item ID. # # + catalogId - ID of the catalog diff --git a/apps/customer-portal/backend/utils.bal b/apps/customer-portal/backend/utils.bal index 8759a4e8a3..baa37a4549 100644 --- a/apps/customer-portal/backend/utils.bal +++ b/apps/customer-portal/backend/utils.bal @@ -277,7 +277,6 @@ public isolated function mapDeployedProducts(entity:DeployedProductsResponse res let entity:ReferenceTableItem? deployment = product.deployment let entity:ReferenceTableItem? version = product.version let entity:ReferenceTableItem? category = product.category - let entity:Instance[]? instances = product?.instances select { id: product.id, createdOn: product.createdOn, @@ -296,19 +295,7 @@ public isolated function mapDeployedProducts(entity:DeployedProductsResponse res deployment: deployment != () ? {id: deployment.id, label: deployment.name} : (), version: version != () ? {id: version.id, label: version.name} : (), category: category != () ? {id: category.id, label: category.name} : (), - instanceCount: product.instanceCount, - instances: instances != () ? from entity:Instance instance in instances - select { - id: instance.id, - instance: instance.instance, - coreUsageCount: instance.coreUsageCount, - updates: instance.updates, - jdkVersion: instance.jdkVersion, - createdOn: instance.createdOn, - updatedOn: instance.updatedOn, - customCreatedOn: instance.customCreatedOn, - customUpdatedOn: instance.customUpdatedOn - } : () + instanceCount: product.instanceCount }; return { @@ -926,3 +913,28 @@ public isolated function mapUsageStats(entity:ProjectStatsResponse response) ret instanceCount: response.instanceCount }; } + +# Map instances response to the desired structure. +# +# + response - Instances response from the entity service +# + return - Mapped instances response +public isolated function mapInstancesResponse(entity:InstancesResponse response) returns types:InstancesResponse { + types:Instance[] instances = from entity:Instance instance in response.instances + let entity:ReferenceTableItem? project = instance.project + let entity:ReferenceTableItem? deployedProduct = instance.deployedProduct + let entity:ReferenceTableItem? deployment = instance.deployment + let entity:ReferenceTableItem? product = instance.product + select { + id: instance.id, + instance: instance.instance, + createdOn: instance.createdOn, + updatedOn: instance.updatedOn, + project: project != () ? {id: project.id, label: project.name} : (), + deployedProduct: deployedProduct != () ? {id: deployedProduct.id, label: deployedProduct.name} : (), + deployment: deployment != () ? {id: deployment.id, label: deployment.name} : (), + product: product != () ? {id: product.id, label: product.name} : (), + metadata: instance.metadata + }; + + return {instances, totalRecords: response.totalRecords, 'limit: response.'limit, offset: response.offset}; +} From 4680432c0debe4f1676686628cdc2bc41e73b5d5 Mon Sep 17 00:00:00 2001 From: Rashmika998 Date: Fri, 3 Apr 2026 10:45:11 +0530 Subject: [PATCH 2/5] remove instance count --- apps/customer-portal/backend/modules/entity/types.bal | 2 -- apps/customer-portal/backend/modules/types/types.bal | 2 -- apps/customer-portal/backend/utils.bal | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/customer-portal/backend/modules/entity/types.bal b/apps/customer-portal/backend/modules/entity/types.bal index 63b56728ac..e93338d209 100644 --- a/apps/customer-portal/backend/modules/entity/types.bal +++ b/apps/customer-portal/backend/modules/entity/types.bal @@ -880,8 +880,6 @@ public type DeployedProduct record {| string? releasedOn; # End of life date of the product string? endOfLifeOn; - # Instances of the deployed product - int instanceCount?; json...; |}; diff --git a/apps/customer-portal/backend/modules/types/types.bal b/apps/customer-portal/backend/modules/types/types.bal index 3cffeab065..d51aa735bf 100644 --- a/apps/customer-portal/backend/modules/types/types.bal +++ b/apps/customer-portal/backend/modules/types/types.bal @@ -640,8 +640,6 @@ public type DeployedProduct record {| string? releasedOn; # End of life date of the product string? endOfLifeOn; - # Instances of the deployed product - int instanceCount?; |}; # Instance search filters. diff --git a/apps/customer-portal/backend/utils.bal b/apps/customer-portal/backend/utils.bal index baa37a4549..d0b35c5c80 100644 --- a/apps/customer-portal/backend/utils.bal +++ b/apps/customer-portal/backend/utils.bal @@ -294,8 +294,7 @@ public isolated function mapDeployedProducts(entity:DeployedProductsResponse res } : (), deployment: deployment != () ? {id: deployment.id, label: deployment.name} : (), version: version != () ? {id: version.id, label: version.name} : (), - category: category != () ? {id: category.id, label: category.name} : (), - instanceCount: product.instanceCount + category: category != () ? {id: category.id, label: category.name} : () }; return { From 5a4719535cfb4687b29adbea2954df686144a553 Mon Sep 17 00:00:00 2001 From: Rashmika998 Date: Fri, 3 Apr 2026 10:47:04 +0530 Subject: [PATCH 3/5] update openapi.yaml --- apps/customer-portal/backend/openapi.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/customer-portal/backend/openapi.yaml b/apps/customer-portal/backend/openapi.yaml index 0b9c1752a1..17201dda0d 100644 --- a/apps/customer-portal/backend/openapi.yaml +++ b/apps/customer-portal/backend/openapi.yaml @@ -2459,12 +2459,10 @@ components: type: string description: Allowed domain list of the account nullable: true - default: "" classification: type: string description: Account classification nullable: true - default: "" isPartner: type: boolean description: Whether the account is a partner or not From 88c02777d12159ba20c7ad68d6ccabe3817d9eea Mon Sep 17 00:00:00 2001 From: Rashmika998 Date: Fri, 3 Apr 2026 11:06:54 +0530 Subject: [PATCH 4/5] update filter payload --- .../backend/modules/entity/types.bal | 1 + apps/customer-portal/backend/service.bal | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/customer-portal/backend/modules/entity/types.bal b/apps/customer-portal/backend/modules/entity/types.bal index e93338d209..c4a066cb1b 100644 --- a/apps/customer-portal/backend/modules/entity/types.bal +++ b/apps/customer-portal/backend/modules/entity/types.bal @@ -1048,6 +1048,7 @@ public type InstancesResponse record {| # Total records count int totalRecords; *Pagination; + json...; |}; # Deployment data. diff --git a/apps/customer-portal/backend/service.bal b/apps/customer-portal/backend/service.bal index cf3937ce7e..2efe8969fc 100644 --- a/apps/customer-portal/backend/service.bal +++ b/apps/customer-portal/backend/service.bal @@ -624,7 +624,11 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { } entity:InstancesResponse|error instances = entity:searchInstances(userInfo.idToken, { - filters: {projectIds: [id]}, + filters: { + projectIds: [id], + startDate: payload.filters?.startDate, + endDate: payload.filters?.endDate + }, pagination: payload.pagination }); if instances is error { @@ -878,7 +882,11 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { } entity:InstancesResponse|error instances = entity:searchInstances(userInfo.idToken, { - filters: {deploymentIds: [id]}, + filters: { + deploymentIds: [id], + startDate: payload.filters?.startDate, + endDate: payload.filters?.endDate + }, pagination: payload.pagination }); if instances is error { @@ -2606,7 +2614,11 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { entity:InstancesResponse|error instances = entity:searchInstances(userInfo.idToken, { - filters: {deployedProductIds: [id]}, + filters: { + deployedProductIds: [id], + startDate: payload.filters?.startDate, + endDate: payload.filters?.endDate + }, pagination: payload.pagination }); if instances is error { From be85f4659553fe37fecf23228bba95fcc812d191 Mon Sep 17 00:00:00 2001 From: Rashmika998 Date: Fri, 3 Apr 2026 12:07:02 +0530 Subject: [PATCH 5/5] remove unused fields --- apps/customer-portal/backend/modules/entity/types.bal | 4 ---- apps/customer-portal/backend/modules/types/types.bal | 4 ---- apps/customer-portal/backend/utils.bal | 4 +--- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/apps/customer-portal/backend/modules/entity/types.bal b/apps/customer-portal/backend/modules/entity/types.bal index c4a066cb1b..af307da5d1 100644 --- a/apps/customer-portal/backend/modules/entity/types.bal +++ b/apps/customer-portal/backend/modules/entity/types.bal @@ -1069,10 +1069,6 @@ public type Deployment record {| ReferenceTableItem? project; # Type ChoiceListItem? 'type; - # Count of deployed products associated with the deployment - int deployedProductCount?; - # Count of instances associated with the deployment - int instanceCount?; json...; |}; diff --git a/apps/customer-portal/backend/modules/types/types.bal b/apps/customer-portal/backend/modules/types/types.bal index d51aa735bf..fcbde2fdb8 100644 --- a/apps/customer-portal/backend/modules/types/types.bal +++ b/apps/customer-portal/backend/modules/types/types.bal @@ -591,10 +591,6 @@ public type Deployment record {| ReferenceItem? project; # Type ReferenceItem? 'type; - # Count of deployed products associated with the deployment - int deployedProductCount?; - # Count of instances associated with the deployment - int instanceCount?; |}; # Deployments response. diff --git a/apps/customer-portal/backend/utils.bal b/apps/customer-portal/backend/utils.bal index d0b35c5c80..c504d5c2ba 100644 --- a/apps/customer-portal/backend/utils.bal +++ b/apps/customer-portal/backend/utils.bal @@ -258,9 +258,7 @@ public isolated function mapDeployments(entity:DeploymentsResponse response) ret description: deployment.description, url: deployment.url, project: project != () ? {id: project.id, label: project.name} : (), - 'type: 'type != () ? {id: 'type.id.toString(), label: 'type.label} : (), - deployedProductCount: deployment.deployedProductCount, - instanceCount: deployment.instanceCount + 'type: 'type != () ? {id: 'type.id.toString(), label: 'type.label} : () }; return {deployments, totalRecords: response.totalRecords, offset: response.offset, 'limit: response.'limit}; }