diff --git a/apps/customer-portal/backend/modules/entity/types.bal b/apps/customer-portal/backend/modules/entity/types.bal index 95bc4df83d..00999b2824 100644 --- a/apps/customer-portal/backend/modules/entity/types.bal +++ b/apps/customer-portal/backend/modules/entity/types.bal @@ -244,6 +244,8 @@ public type Case record {| string number; # Created date and time string createdOn; + # Created by (User email) + string createdBy; # Case title string? title; # Case description @@ -254,6 +256,10 @@ public type Case record {| ChoiceListItem? state; # Severity information ChoiceListItem? severity; + # Catalog information (if the case is a service request) + ReferenceTableItem? catalog; + # Catalog item information (if the case is a service request) + ReferenceTableItem? catalogItem; json...; |}; @@ -428,8 +434,8 @@ public type ProjectMetadataResponse record {| # Project statistics response. public type ProjectStatsResponse record {| - # Total time logged - decimal totalTimeLogged?; + # Total hours logged + decimal totalHours?; # Billable hours decimal billableHours?; # SLA status @@ -1166,6 +1172,8 @@ public type ConversationSearchPayload record {| int[] stateKeys?; # Search query for conversations string searchQuery?; + # Conversations created by logged in user + boolean createdByMe?; } filters?; # Sort configuration record { diff --git a/apps/customer-portal/backend/modules/types/types.bal b/apps/customer-portal/backend/modules/types/types.bal index b6177f2498..7fc6f50ab6 100644 --- a/apps/customer-portal/backend/modules/types/types.bal +++ b/apps/customer-portal/backend/modules/types/types.bal @@ -67,6 +67,8 @@ public type Case record {| string number; # Created date and time string createdOn; + # Created by (User email) + string createdBy; # Case title string? title; # Case description @@ -77,6 +79,10 @@ public type Case record {| ReferenceItem? severity; # State of the case ReferenceItem? status; + # Catalog information (if the case is a service request) + ReferenceItem? catalog; + # Catalog item information (if the case is a service request) + ReferenceItem? catalogItem; |}; # Case information. @@ -286,8 +292,8 @@ public type ProjectStats record {| # Recent activity details. public type RecentActivity record {| - # Total time logged - decimal totalTimeLogged?; + # Total hours + decimal totalHours?; # Billable hours decimal billableHours?; # Last deployment date @@ -976,6 +982,8 @@ public type ConversationSearchPayload record {| int[] stateKeys?; # Search query for conversations string searchQuery?; + # Conversations created by logged in user + boolean createdByMe?; } filters?; # Sort configuration record { diff --git a/apps/customer-portal/backend/service.bal b/apps/customer-portal/backend/service.bal index 510156a037..5a7a14ac0c 100644 --- a/apps/customer-portal/backend/service.bal +++ b/apps/customer-portal/backend/service.bal @@ -633,8 +633,8 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { slaStatus: projectActivityStats is entity:ProjectStatsResponse ? projectActivityStats.slaStatus : () }, recentActivity: { - totalTimeLogged: - projectActivityStats is entity:ProjectStatsResponse ? projectActivityStats.totalTimeLogged : (), + totalHours: + projectActivityStats is entity:ProjectStatsResponse ? projectActivityStats.totalHours : (), billableHours: projectActivityStats is entity:ProjectStatsResponse ? projectActivityStats.billableHours : (), lastDeploymentOn: @@ -1095,7 +1095,8 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) { filters: { projectIds: [id], stateKeys: payload.filters?.stateKeys, - searchQuery: payload.filters?.searchQuery + searchQuery: payload.filters?.searchQuery, + createdByMe: payload.filters?.createdByMe }, sortBy: payload.sortBy, pagination: payload.pagination diff --git a/apps/customer-portal/backend/utils.bal b/apps/customer-portal/backend/utils.bal index 9863e75995..f3635feac8 100644 --- a/apps/customer-portal/backend/utils.bal +++ b/apps/customer-portal/backend/utils.bal @@ -56,12 +56,15 @@ public isolated function searchCases(string idToken, string projectId, types:Cas let entity:ReferenceTableItem? conversation = case.conversation let entity:ChoiceListItem? severity = case.severity let entity:ChoiceListItem? state = case.state + let entity:ReferenceTableItem? catalog = case.catalog + let entity:ReferenceTableItem? catalogItem = case.catalogItem select { id: case.id, internalId: case.internalId, number: case.number, title: case.title, createdOn: case.createdOn, + createdBy: case.createdBy, description: case.description, project: project != () ? {id: project.id, label: project.name} : (), 'type: 'type != () ? {id: 'type.id, label: 'type.name} : (), @@ -72,7 +75,9 @@ public isolated function searchCases(string idToken, string projectId, types:Cas parentCase: parentCase != () ? {id: parentCase.id, label: parentCase.name} : (), conversation: conversation != () ? {id: conversation.id, label: conversation.name} : (), severity: severity != () ? {id: severity.id.toString(), label: severity.label} : (), - status: state != () ? {id: state.id.toString(), label: state.label} : () + status: state != () ? {id: state.id.toString(), label: state.label} : (), + catalog: catalog != () ? {id: catalog.id, label: catalog.name} : (), + catalogItem: catalogItem != () ? {id: catalogItem.id, label: catalogItem.name} : () }; return { @@ -494,6 +499,8 @@ public isolated function mapCaseResponse(entity:CaseResponse response) returns t entity:ReferenceTableItem? conversation = response.conversation; entity:ChoiceListItem? severity = response.severity; entity:ChoiceListItem? state = response.state; + entity:ReferenceTableItem? catalog = response.catalog; + entity:ReferenceTableItem? catalogItem = response.catalogItem; return { id: response.id, @@ -502,6 +509,7 @@ public isolated function mapCaseResponse(entity:CaseResponse response) returns t title: response.title, description: response.description, createdOn: response.createdOn, + createdBy: response.createdBy, slaResponseTime: response.slaResponseTime, project: project != () ? {id: project.id, label: project.name} : (), 'type: caseType != () ? {id: caseType.id, label: caseType.name} : (), @@ -511,6 +519,8 @@ public isolated function mapCaseResponse(entity:CaseResponse response) returns t conversation: conversation != () ? {id: conversation.id, label: conversation.name} : (), severity: severity != () ? {id: severity.id.toString(), label: severity.label} : (), status: state != () ? {id: state.id.toString(), label: state.label} : (), + catalog: catalog != () ? {id: catalog.id, label: catalog.name} : (), + catalogItem: catalogItem != () ? {id: catalogItem.id, label: catalogItem.name} : (), updatedOn: response.updatedOn, deployedProduct: response.deployedProduct != () ? { id: response.deployedProduct?.id ?: "",