Skip to content

fix: repair CreateDispute and UpdateDispute#237

Open
Nandgopal-R wants to merge 1 commit intodevfrom
fix/dispute
Open

fix: repair CreateDispute and UpdateDispute#237
Nandgopal-R wants to merge 1 commit intodevfrom
fix/dispute

Conversation

@Nandgopal-R
Copy link
Member

No description provided.

return
}

disputeCount, err := q.CheckDisputeExistsByTxnIdQuery(ctx, tx, txnId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dispute check must happen before we grabeventIdByTxnId

return
}

studentEmail, err := q.GetEmailByTxnIdQuery(ctx, tx, txnId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the dispute check is pushed to the top, the dispute creation flow can happen in a single shot with a sub-query that joins on student table, event table using transaction id and then runs the insert. No need to use separate queries.

pkg.Log.ErrorCtx(c, "[DISPUTE-ERROR]: Failed to check if dispute exists by transaction ID", err)
return
}
if disputeCount > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't send bad request ? Send conflict ? Will it cause issue with the frontend team ?

@IAmRiteshKoushik
Copy link
Member

@Nandgopal-R can we clean up the requested changes and then go for a merge ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants