@merkl/api 0.10.221 → 0.10.222

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.
@@ -69,11 +69,20 @@ export const OpportunityController = new Elysia({
69
69
  if (!params.id.includes("-"))
70
70
  return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id);
71
71
  const [chainId, type, identifier] = params.id.split("-");
72
- return await OpportunityService.getUniqueWithCampaignsOrThrow({
72
+ const oppWithCampaigns = await OpportunityService.getUniqueWithCampaignsOrThrow({
73
73
  chainId: +chainId,
74
74
  type: type,
75
75
  identifier,
76
76
  });
77
+ // Todo: need to be refactor Parsing issue
78
+ const campaignsFormatted = oppWithCampaigns.campaigns.map(campaign => {
79
+ if (!campaign.distributionChain)
80
+ return campaign;
81
+ const distributionChain = campaign.distributionChain;
82
+ const { Explorer } = distributionChain;
83
+ return { ...campaign, distributionChain: { ...campaign.distributionChain, explorers: Explorer } };
84
+ });
85
+ return { ...oppWithCampaigns, campaigns: campaignsFormatted };
77
86
  }
78
87
  catch (err) {
79
88
  if (err.code && err.code === "P2025")
@@ -98,7 +107,6 @@ export const OpportunityController = new Elysia({
98
107
  params: OpportunityAggregateFieldDto,
99
108
  query: GetOpportunitiesQueryDto,
100
109
  response: AggregationResourceDto,
101
- detail: { hide: true },
102
110
  })
103
111
  // ─── Update An Opportunity ───────────────────────────────────────────
104
112
  .patch("/:id", async ({ params, body }) => await OpportunityService.update(params.id, body), {
@@ -126,6 +126,13 @@ export declare abstract class OpportunityRepository {
126
126
  }>;
127
127
  static findUniqueOrThrowWithCampaigns(id: string): Promise<{
128
128
  Chain: {
129
+ Explorer: {
130
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
131
+ url: string;
132
+ id: string;
133
+ chainId: number;
134
+ }[];
135
+ } & {
129
136
  name: string;
130
137
  id: number;
131
138
  icon: string;
@@ -137,6 +144,13 @@ export declare abstract class OpportunityRepository {
137
144
  icon: string;
138
145
  };
139
146
  DistributionChain: {
147
+ Explorer: {
148
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
149
+ url: string;
150
+ id: string;
151
+ chainId: number;
152
+ }[];
153
+ } & {
140
154
  name: string;
141
155
  id: number;
142
156
  icon: string;
@@ -83,12 +83,20 @@ export class OpportunityRepository {
83
83
  const b = await apiDbClient.opportunity.findUniqueOrThrow({
84
84
  include: {
85
85
  ...OpportunityRepository.#getRecordInclusion(),
86
- Chain: true,
86
+ Chain: {
87
+ include: {
88
+ Explorer: true,
89
+ },
90
+ },
87
91
  Campaigns: {
88
92
  include: {
89
93
  RewardToken: true,
90
94
  ComputeChain: true,
91
- DistributionChain: true,
95
+ DistributionChain: {
96
+ include: {
97
+ Explorer: true,
98
+ },
99
+ },
92
100
  CampaignStatus: true, // [][0]
93
101
  },
94
102
  orderBy: {