Skip to content

"Updation for frontend"#6

Open
kaushalya4s5s7 wants to merge 1 commit into
test/creditsfrom
feat-kc/borrow
Open

"Updation for frontend"#6
kaushalya4s5s7 wants to merge 1 commit into
test/creditsfrom
feat-kc/borrow

Conversation

@kaushalya4s5s7

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 7, 2026 07:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR makes frontend-related updates to improve the position synchronization behavior and transaction monitoring in the backend. The main focus is on preventing duplicate position creation errors and improving blockchain transaction polling.

  • Adds duplicate position check before creating a new position in the sync endpoint
  • Changes HTTP status code from CREATED to OK for the sync-position endpoint to better reflect idempotent behavior
  • Adds explicit polling interval configuration for blockchain transaction monitoring

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/backend/src/modules/solvency/controllers/solvency.controller.ts Added duplicate position check logic to prevent database errors when syncing positions, and changed HTTP status code from CREATED to OK for idempotent behavior
packages/backend/src/modules/blockchain/services/blockchain.service.ts Added explicit pollingInterval parameter (2 seconds) to transaction receipt waiting configuration
packages/backend/configs/approved_admins.json Added a new admin wallet address to the approved admins list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +228 to +234
if (existingPosition) {
return {
success: true,
message: 'Position already exists.',
position: existingPosition,
};
}

Copilot AI Jan 7, 2026

Copy link

Choose a reason for hiding this comment

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

The duplicate check logic has an issue. According to the service implementation, getPosition throws a NotFoundException when a position is not found. This means that if the position doesn't exist, the code will catch the exception at line 235, check if it's a NotFoundException at line 238, and then continue execution. However, the check at line 228 'if (existingPosition)' will never be reached when the position doesn't exist because an exception is thrown before the return statement. The early return at lines 229-233 will only execute when the position exists, which is the intended behavior, but the try-catch structure is confusing and could be simplified.

Suggested change
if (existingPosition) {
return {
success: true,
message: 'Position already exists.',
position: existingPosition,
};
}
return {
success: true,
message: 'Position already exists.',
position: existingPosition,
};

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@kaushalya4s5s7 look into these comments once

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.

3 participants