Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/customer-portal/backend/modules/entity/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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...;
|};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 10 additions & 2 deletions apps/customer-portal/backend/modules/types/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions apps/customer-portal/backend/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion apps/customer-portal/backend/utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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} : (),
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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} : (),
Expand All @@ -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 ?: "",
Expand Down