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
8 changes: 8 additions & 0 deletions apps/customer-portal/backend/modules/entity/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ public type CaseResponse record {|
# Email address
string? email;
}? csManager;
# Case closed date and time
string? closedOn?;
# User who closed the case
ReferenceTableItem? closedBy?;
# Close notes for the case closure
string? closeNotes?;
# Indicates if the case is auto closed
boolean? hasAutoClosed?;
Comment thread
Rashmika998 marked this conversation as resolved.
json...;
|};

Expand Down
51 changes: 0 additions & 51 deletions apps/customer-portal/backend/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -867,36 +867,6 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) {
};
}

// Verify case validation for the user
entity:CaseResponse|error caseDetails = entity:getCase(userInfo.idToken, id);
if caseDetails is error {
if getStatusCode(caseDetails) == http:STATUS_UNAUTHORIZED {
log:printWarn(string `User: ${userInfo.userId} is not authorized to access the customer portal!`);
return <http:Unauthorized>{
body: {
message: ERR_MSG_UNAUTHORIZED_ACCESS
}
};
}

if getStatusCode(caseDetails) == http:STATUS_FORBIDDEN {
logForbiddenCaseAccess(id, userInfo.userId);
return <http:Forbidden>{
body: {
message: ERR_MSG_CASE_ACCESS_FORBIDDEN
}
};
}

string customError = "Failed to retrieve case details.";
log:printError(customError, caseDetails);
return <http:InternalServerError>{
body: {
message: customError
}
};
}

entity:CommentsResponse|error commentsResponse = entity:getComments(userInfo.idToken, id, 'limit, offset);
if commentsResponse is error {
string customError = "Failed to retrieve comments.";
Expand Down Expand Up @@ -936,27 +906,6 @@ service http:InterceptableService / on new http:Listener(9090, listenerConf) {
};
}

// Verify case validation for the user
entity:CaseResponse|error caseDetails = entity:getCase(userInfo.idToken, id);
if caseDetails is error {
if getStatusCode(caseDetails) == http:STATUS_FORBIDDEN {
logForbiddenCaseAccess(id, userInfo.userId);
return <http:Forbidden>{
body: {
message: ERR_MSG_CASE_ACCESS_FORBIDDEN
}
};
}

string customError = "Failed to retrieve case details.";
log:printError(customError, caseDetails);
return <http:InternalServerError>{
body: {
message: customError
}
};
}

entity:AttachmentsResponse|error attachmentResponse =
entity:getAttachments(userInfo.idToken, id, 'limit, offset);
if attachmentResponse is error {
Expand Down