@merkl/api 0.19.48 → 0.19.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,13 +103,13 @@ export const OpportunityController = new Elysia({
|
|
103
103
|
.get("/:id/campaigns", async ({ query, params }) => {
|
104
104
|
try {
|
105
105
|
if (!params.id.includes("-"))
|
106
|
-
return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id, query.test ?? false);
|
106
|
+
return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id, query.test ?? false, query.point ?? false);
|
107
107
|
const [chainId, type, identifier] = params.id.split("-");
|
108
108
|
return await OpportunityService.getUniqueWithCampaignsOrThrow({
|
109
109
|
chainId: +chainId,
|
110
110
|
type: type,
|
111
111
|
identifier,
|
112
|
-
}, query.test ?? false);
|
112
|
+
}, query.test ?? false, query.point ?? false);
|
113
113
|
}
|
114
114
|
catch (err) {
|
115
115
|
if (err.code && err.code === "P2025")
|
@@ -151,12 +151,12 @@ export class OpportunityService {
|
|
151
151
|
}
|
152
152
|
static async getUniqueWithCampaignsOrThrow(opportunityId, withTest = false, withPoints = false) {
|
153
153
|
const id = typeof opportunityId === "string" ? opportunityId : OpportunityService.hashId(opportunityId);
|
154
|
-
const opportunity = await OpportunityRepository.findUniqueOrThrow(id, withTest, withTest
|
154
|
+
const opportunity = await OpportunityRepository.findUniqueOrThrow(id, withTest, withTest ? withTest : withPoints, true);
|
155
155
|
return OpportunityService.formatResponse(opportunity);
|
156
156
|
}
|
157
157
|
static async getUniqueOrThrow(opportunityId, withTest = false, withPoints = false) {
|
158
158
|
const id = typeof opportunityId === "string" ? opportunityId : OpportunityService.hashId(opportunityId);
|
159
|
-
const opportunity = await OpportunityRepository.findUniqueOrThrow(id, withTest, withTest
|
159
|
+
const opportunity = await OpportunityRepository.findUniqueOrThrow(id, withTest, withTest ? withTest : withPoints);
|
160
160
|
return OpportunityService.formatResponse(opportunity);
|
161
161
|
}
|
162
162
|
/**
|