Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add afflaiteReferredMakerRebates field to response #2473

Merged
merged 1 commit into from
Oct 4, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,6 @@ function affiliateInfoCreateToResponseObject(
affiliateReferredTotalVolume: Number(info.referredTotalVolume),
affiliateReferredMakerFees: Number(info.totalReferredMakerFees),
affiliateReferredTakerFees: Number(info.totalReferredTakerFees),
affiliateReferredMakerRebates: Number(info.totalReferredMakerRebates),
};
}
10 changes: 7 additions & 3 deletions indexer/services/comlink/public/api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ fetch(`${baseURL}/affiliates/snapshot`,
"affiliateReferredNetProtocolEarnings": 0.1,
"affiliateReferredTotalVolume": 0.1,
"affiliateReferredMakerFees": 0.1,
"affiliateReferredTakerFees": 0.1
"affiliateReferredTakerFees": 0.1,
"affiliateReferredMakerRebates": 0.1
Comment on lines +658 to +659
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

New field affiliateReferredMakerRebates added to affiliate responses.

A new field affiliateReferredMakerRebates has been added to the AffiliateSnapshotResponseObject and is included in the example response for AffiliateSnapshotResponse.

Please ensure that:

  1. The purpose and meaning of this new field are clearly documented.
  2. Any relevant calculations or business logic related to this field are explained.
  3. The API versioning is updated if this change is not backward compatible.
  4. The change is reflected in all relevant sections of the documentation, including any schema definitions or data models.

Also applies to: 4252-4253, 4272-4272, 4294-4295

}
],
"total": 0.1,
Expand Down Expand Up @@ -4248,7 +4249,8 @@ This operation does not require authentication
"affiliateReferredNetProtocolEarnings": 0.1,
"affiliateReferredTotalVolume": 0.1,
"affiliateReferredMakerFees": 0.1,
"affiliateReferredTakerFees": 0.1
"affiliateReferredTakerFees": 0.1,
"affiliateReferredMakerRebates": 0.1
}

```
Expand All @@ -4267,6 +4269,7 @@ This operation does not require authentication
|affiliateReferredTotalVolume|number(double)|true|none|none|
|affiliateReferredMakerFees|number(double)|true|none|none|
|affiliateReferredTakerFees|number(double)|true|none|none|
|affiliateReferredMakerRebates|number(double)|true|none|none|

## AffiliateSnapshotResponse

Expand All @@ -4288,7 +4291,8 @@ This operation does not require authentication
"affiliateReferredNetProtocolEarnings": 0.1,
"affiliateReferredTotalVolume": 0.1,
"affiliateReferredMakerFees": 0.1,
"affiliateReferredTakerFees": 0.1
"affiliateReferredTakerFees": 0.1,
"affiliateReferredMakerRebates": 0.1
}
],
"total": 0.1,
Expand Down
7 changes: 6 additions & 1 deletion indexer/services/comlink/public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@
"affiliateReferredTakerFees": {
"type": "number",
"format": "double"
},
"affiliateReferredMakerRebates": {
"type": "number",
"format": "double"
}
},
"required": [
Expand All @@ -323,7 +327,8 @@
"affiliateReferredNetProtocolEarnings",
"affiliateReferredTotalVolume",
"affiliateReferredMakerFees",
"affiliateReferredTakerFees"
"affiliateReferredTakerFees",
"affiliateReferredMakerRebates"
],
"type": "object",
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class AffiliatesController extends Controller {
affiliateReferredTotalVolume: Number(info.referredTotalVolume),
affiliateReferredMakerFees: Number(info.totalReferredMakerFees),
affiliateReferredTakerFees: Number(info.totalReferredTakerFees),
affiliateReferredMakerRebates: Number(info.totalReferredMakerRebates),
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Missing AffiliateSnapshotResponseObject type definition

The type AffiliateSnapshotResponseObject is not defined in the codebase. Please add this type definition and include the new affiliateReferredMakerRebates field to ensure type consistency.

Additionally, ensure that unit tests properly assert the affiliateReferredMakerRebates field.

🔗 Analysis chain

Verify consistency across related files

While the change looks good, please ensure that:

  1. Any related type definitions or interfaces (e.g., AffiliateSnapshotResponseObject) are updated to include this new field.
  2. API documentation or OpenAPI/Swagger specifications are updated to reflect this change in the response structure.
  3. Any unit tests covering the getSnapshot method are updated to include assertions for this new field.

To check for related type definitions, you can run:

To check for API documentation updates:

To check for relevant test files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for AffiliateSnapshotResponseObject type definition
rg --type typescript "type AffiliateSnapshotResponseObject" -A 20

Length of output: 102


Script:

#!/bin/bash
# Search for API documentation mentioning affiliate snapshots
rg --type markdown "affiliate.*snapshot" -A 10

Length of output: 6638


Script:

#!/bin/bash
# Search for test files related to AffiliatesController
fd -e test.ts affiliates-controller

Length of output: 121


Script:

#!/bin/bash
# Corrected search for AffiliateSnapshotResponseObject type definition using file extensions
rg "type AffiliateSnapshotResponseObject" --glob "*.ts" -A 20

Length of output: 63


Script:

#!/bin/bash
# Search within test files for assertions related to affiliateReferredMakerRebates
rg "affiliateReferredMakerRebates" indexer/services/comlink/__tests__/controllers/api/v4/affiliates-controller.test.ts

Length of output: 193

}));

const response: AffiliateSnapshotResponse = {
Expand Down
1 change: 1 addition & 0 deletions indexer/services/comlink/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ export interface AffiliateSnapshotResponseObject {
affiliateReferredTotalVolume: number,
affiliateReferredMakerFees: number,
affiliateReferredTakerFees: number,
affiliateReferredMakerRebates: number,
}

export interface AffiliateTotalVolumeResponse {
Expand Down
Loading