Skip to content

Commit

Permalink
SBERDOMA-192 fix client removal from ticket on save
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoviazin committed Aug 5, 2021
1 parent 3d6aec6 commit f534d4c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions apps/condo/domains/ticket/utils/clientSchema/Ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,10 @@ function convertToGQLInput (state: ITicketFormState): TicketUpdateInput {
const result = { dv: 1, sender }
for (const attr of Object.keys(state)) {
const attrId = get(state[attr], 'id')
if (RELATIONS.includes(attr)) {
if (state[attr]) {
result[attr] = { connect: { id: (attrId || state[attr]) } }
// TODO(zuch): make this optional as not sure if contact on null should be disconnected
} else if (DISCONNECT_ON_NULL.includes(attr)) {
result[attr] = { disconnectAll: true }
} else {
result[attr] = state[attr]
}
result[attr] = (RELATIONS.includes(attr) && state[attr]) ? { connect: { id: (attrId || state[attr]) } } : state[attr]
// TODO(zuch): need better logic here (contact can be ocasionally deleted from ticket)
if (RELATIONS.includes(attr) && !state[attr] && !attrId && DISCONNECT_ON_NULL.includes(attr)) {
result[attr] = { disconnectAll: true }
}
}
return result
Expand Down

0 comments on commit f534d4c

Please sign in to comment.