Skip to content

Commit

Permalink
handle undefined lastClientCalled
Browse files Browse the repository at this point in the history
  • Loading branch information
hofstede-matheus committed Oct 11, 2023
1 parent 5a7b929 commit 91aeaae
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/modules/desk/presentation/http/controllers/DeskController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,18 @@ export class DeskController {
if (result.isLeft()) throw toPresentationError(result.value);

return {
lastClientCalled: result.value.client ?? {
id: result.value.client.id,
name: result.value.client.name,
organizationId: result.value.client.organizationId,
registrationId: result.value.client.registrationId,
createdAt: result.value.client.createdAt,
updatedAt: result.value.client.updatedAt,
calledDate: result.value.client.calledDate,
attendedByUserId: result.value.client.attendedByUserId,
},
lastClientCalled: result.value.client
? {
id: result.value.client.id,
name: result.value.client.name,
organizationId: result.value.client.organizationId,
registrationId: result.value.client.registrationId,
createdAt: result.value.client.createdAt,
updatedAt: result.value.client.updatedAt,
calledDate: result.value.client.calledDate,
attendedByUserId: result.value.client.attendedByUserId,
}
: undefined,
desk: {
id: result.value.desk.id,
name: result.value.desk.name,
Expand Down

0 comments on commit 91aeaae

Please sign in to comment.