@merkl/api 0.21.4 → 0.21.6
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.
- package/dist/database/api/.generated/edge.js +2 -2
- package/dist/database/api/.generated/index.js +2 -2
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +1 -0
- package/dist/src/eden/index.d.ts +1110 -581
- package/dist/src/engine/deprecated/dynamicData/implementations/EventBased.js +2 -11
- package/dist/src/engine/deprecated/dynamicData/utils/getCompV2ForksVaults.js +10 -3
- package/dist/src/engine/implementations/MultiLog/tvl.js +33 -0
- package/dist/src/index.d.ts +448 -261
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +11 -2
- package/dist/src/modules/v4/campaign/campaign.controller.js +3 -3
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +44 -3
- package/dist/src/modules/v4/campaign/campaign.repository.js +46 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +36 -2
- package/dist/src/modules/v4/campaign/campaign.service.js +20 -8
- package/dist/src/modules/v4/creator/creator.controller.d.ts +236 -34
- package/dist/src/modules/v4/creator/creator.controller.js +28 -21
- package/dist/src/modules/v4/creator/creator.model.d.ts +29 -5
- package/dist/src/modules/v4/creator/creator.model.js +21 -1
- package/dist/src/modules/v4/creator/creator.repository.d.ts +52 -6
- package/dist/src/modules/v4/creator/creator.repository.js +16 -13
- package/dist/src/modules/v4/creator/creator.service.d.ts +161 -14
- package/dist/src/modules/v4/creator/creator.service.js +49 -11
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +4 -3
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +14 -1
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +68 -7
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +240 -12
- package/dist/src/modules/v4/router.d.ts +448 -261
- package/dist/src/modules/v4/user/user.controller.d.ts +177 -192
- package/dist/src/modules/v4/user/user.controller.js +38 -56
- package/dist/src/modules/v4/user/user.model.d.ts +1 -1
- package/dist/src/modules/v4/user/user.model.js +1 -1
- package/dist/src/modules/v4/user/user.repository.d.ts +1 -1
- package/dist/src/modules/v4/user/user.repository.js +1 -1
- package/dist/src/modules/v4/user/user.service.d.ts +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +3 -2
@@ -14,37 +14,163 @@ export declare const UserController: Elysia<"/users", false, {
|
|
14
14
|
macroFn: {};
|
15
15
|
}, {
|
16
16
|
users: {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
":address": {
|
18
|
+
rewards: {
|
19
|
+
get: {
|
20
|
+
body: unknown;
|
21
|
+
params: {
|
22
|
+
address: string;
|
23
|
+
};
|
24
|
+
query: {
|
25
|
+
test?: boolean | undefined;
|
26
|
+
reloadChainId?: number | undefined;
|
27
|
+
claimableOnly?: boolean | undefined;
|
28
|
+
chainId: number[];
|
29
|
+
};
|
30
|
+
headers: unknown;
|
31
|
+
response: {
|
32
|
+
200: (Omit<{
|
33
|
+
chain: import("@db/api").Chain;
|
34
|
+
rewards: Awaited<ReturnType<(typeof RewardService)["format"]>>;
|
35
|
+
}, "rewards"> & {
|
36
|
+
rewards: (Omit<{
|
37
|
+
token: {
|
38
|
+
symbol: string;
|
39
|
+
name: string | null;
|
40
|
+
id: string;
|
41
|
+
icon: string;
|
42
|
+
address: string;
|
43
|
+
chainId: number;
|
44
|
+
decimals: number;
|
45
|
+
displaySymbol: string;
|
46
|
+
verified: boolean;
|
47
|
+
isTest: boolean;
|
48
|
+
isPoint: boolean;
|
49
|
+
isPreTGE: boolean;
|
50
|
+
isNative: boolean;
|
51
|
+
price: number | null;
|
52
|
+
};
|
53
|
+
breakdowns: {
|
54
|
+
campaignId: string;
|
55
|
+
subCampaignId: string | undefined;
|
56
|
+
opportunity: {
|
57
|
+
Chain: {
|
58
|
+
name: string;
|
59
|
+
id: number;
|
60
|
+
icon: string;
|
61
|
+
};
|
62
|
+
Tokens: {
|
63
|
+
symbol: string;
|
64
|
+
name: string | null;
|
65
|
+
id: string;
|
66
|
+
icon: string;
|
67
|
+
address: string;
|
68
|
+
chainId: number;
|
69
|
+
decimals: number;
|
70
|
+
displaySymbol: string;
|
71
|
+
verified: boolean;
|
72
|
+
isTest: boolean;
|
73
|
+
isPoint: boolean;
|
74
|
+
isPreTGE: boolean;
|
75
|
+
isNative: boolean;
|
76
|
+
price: number | null;
|
77
|
+
}[];
|
78
|
+
Protocols: {
|
79
|
+
url: string;
|
80
|
+
name: string;
|
81
|
+
description: string;
|
82
|
+
id: string;
|
83
|
+
tags: string[];
|
84
|
+
icon: string;
|
85
|
+
}[];
|
86
|
+
MainProtocol: {
|
87
|
+
url: string;
|
88
|
+
name: string;
|
89
|
+
description: string;
|
90
|
+
id: string;
|
91
|
+
tags: string[];
|
92
|
+
icon: string;
|
93
|
+
} | null;
|
94
|
+
} & {
|
95
|
+
status: import("@db/api").$Enums.Status;
|
96
|
+
type: string;
|
97
|
+
name: string;
|
98
|
+
description: string;
|
99
|
+
id: string;
|
100
|
+
tags: string[];
|
101
|
+
identifier: string;
|
102
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
103
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
104
|
+
chainId: number;
|
105
|
+
howToSteps: string[];
|
106
|
+
depositUrl: string | null;
|
107
|
+
explorerAddress: string | null;
|
108
|
+
mainProtocolId: string | null;
|
109
|
+
tvl: number;
|
110
|
+
apr: number;
|
111
|
+
dailyRewards: number;
|
112
|
+
lastCampaignCreatedAt: Date;
|
113
|
+
};
|
114
|
+
reason: string;
|
115
|
+
pending: string;
|
116
|
+
amount: string;
|
117
|
+
claimed: string;
|
118
|
+
}[];
|
119
|
+
claimed: bigint;
|
120
|
+
amount: bigint;
|
121
|
+
pending: bigint;
|
122
|
+
root: string;
|
123
|
+
recipient: string;
|
124
|
+
proofs: string[];
|
125
|
+
}, "breakdowns"> & {
|
126
|
+
breakdowns: {
|
127
|
+
campaignId: string;
|
128
|
+
subCampaignId: string | undefined;
|
129
|
+
reason: string;
|
130
|
+
pending: string;
|
131
|
+
amount: string;
|
132
|
+
claimed: string;
|
133
|
+
}[];
|
134
|
+
})[];
|
135
|
+
})[];
|
136
|
+
};
|
26
137
|
};
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
138
|
+
};
|
139
|
+
};
|
140
|
+
};
|
141
|
+
} & {
|
142
|
+
users: {
|
143
|
+
":address": {
|
144
|
+
terms: {
|
145
|
+
get: {
|
146
|
+
body: unknown;
|
147
|
+
params: {
|
31
148
|
address: string;
|
32
|
-
|
33
|
-
|
149
|
+
};
|
150
|
+
query: {
|
151
|
+
chainId: number;
|
152
|
+
};
|
153
|
+
headers: unknown;
|
154
|
+
response: {
|
155
|
+
200: boolean;
|
156
|
+
};
|
34
157
|
};
|
35
158
|
};
|
36
159
|
};
|
37
160
|
};
|
38
161
|
} & {
|
39
162
|
users: {
|
40
|
-
|
163
|
+
index: {
|
41
164
|
get: {
|
42
165
|
body: unknown;
|
43
166
|
params: {};
|
44
|
-
query:
|
45
|
-
|
46
|
-
|
167
|
+
query: {
|
168
|
+
items?: number | undefined;
|
169
|
+
tags?: string[] | undefined;
|
170
|
+
page?: number | undefined;
|
171
|
+
address?: string | undefined;
|
47
172
|
};
|
173
|
+
headers: unknown;
|
48
174
|
response: {
|
49
175
|
200: {
|
50
176
|
tags: string[];
|
@@ -70,30 +196,6 @@ export declare const UserController: Elysia<"/users", false, {
|
|
70
196
|
tags: string[];
|
71
197
|
address: string;
|
72
198
|
creatorId: string | null;
|
73
|
-
} | null;
|
74
|
-
};
|
75
|
-
};
|
76
|
-
};
|
77
|
-
};
|
78
|
-
} & {
|
79
|
-
users: {
|
80
|
-
":address": {
|
81
|
-
creator: {
|
82
|
-
get: {
|
83
|
-
body: unknown;
|
84
|
-
params: {
|
85
|
-
address: string;
|
86
|
-
};
|
87
|
-
query: unknown;
|
88
|
-
headers: unknown;
|
89
|
-
response: {
|
90
|
-
200: {
|
91
|
-
name: string;
|
92
|
-
id: string;
|
93
|
-
addresses: string[];
|
94
|
-
icon?: string | undefined;
|
95
|
-
rebateFee?: number | undefined;
|
96
|
-
} | null;
|
97
199
|
};
|
98
200
|
};
|
99
201
|
};
|
@@ -226,132 +328,6 @@ export declare const UserController: Elysia<"/users", false, {
|
|
226
328
|
};
|
227
329
|
};
|
228
330
|
};
|
229
|
-
} & {
|
230
|
-
users: {
|
231
|
-
":address": {
|
232
|
-
rewards: {
|
233
|
-
get: {
|
234
|
-
body: unknown;
|
235
|
-
params: {
|
236
|
-
address: string;
|
237
|
-
};
|
238
|
-
query: {
|
239
|
-
test?: boolean | undefined;
|
240
|
-
reloadChainId?: number | undefined;
|
241
|
-
claimableOnly?: boolean | undefined;
|
242
|
-
chainId: number[];
|
243
|
-
};
|
244
|
-
headers: unknown;
|
245
|
-
response: {
|
246
|
-
200: (Omit<{
|
247
|
-
chain: import("@db/api").Chain;
|
248
|
-
rewards: Awaited<ReturnType<(typeof RewardService)["format"]>>;
|
249
|
-
}, "rewards"> & {
|
250
|
-
rewards: (Omit<{
|
251
|
-
token: {
|
252
|
-
symbol: string;
|
253
|
-
name: string | null;
|
254
|
-
id: string;
|
255
|
-
icon: string;
|
256
|
-
address: string;
|
257
|
-
chainId: number;
|
258
|
-
decimals: number;
|
259
|
-
displaySymbol: string;
|
260
|
-
verified: boolean;
|
261
|
-
isTest: boolean;
|
262
|
-
isPoint: boolean;
|
263
|
-
isPreTGE: boolean;
|
264
|
-
isNative: boolean;
|
265
|
-
price: number | null;
|
266
|
-
};
|
267
|
-
breakdowns: {
|
268
|
-
campaignId: string;
|
269
|
-
subCampaignId: string | undefined;
|
270
|
-
opportunity: {
|
271
|
-
Chain: {
|
272
|
-
name: string;
|
273
|
-
id: number;
|
274
|
-
icon: string;
|
275
|
-
};
|
276
|
-
Tokens: {
|
277
|
-
symbol: string;
|
278
|
-
name: string | null;
|
279
|
-
id: string;
|
280
|
-
icon: string;
|
281
|
-
address: string;
|
282
|
-
chainId: number;
|
283
|
-
decimals: number;
|
284
|
-
displaySymbol: string;
|
285
|
-
verified: boolean;
|
286
|
-
isTest: boolean;
|
287
|
-
isPoint: boolean;
|
288
|
-
isPreTGE: boolean;
|
289
|
-
isNative: boolean;
|
290
|
-
price: number | null;
|
291
|
-
}[];
|
292
|
-
Protocols: {
|
293
|
-
url: string;
|
294
|
-
name: string;
|
295
|
-
description: string;
|
296
|
-
id: string;
|
297
|
-
tags: string[];
|
298
|
-
icon: string;
|
299
|
-
}[];
|
300
|
-
MainProtocol: {
|
301
|
-
url: string;
|
302
|
-
name: string;
|
303
|
-
description: string;
|
304
|
-
id: string;
|
305
|
-
tags: string[];
|
306
|
-
icon: string;
|
307
|
-
} | null;
|
308
|
-
} & {
|
309
|
-
status: import("@db/api").$Enums.Status;
|
310
|
-
type: string;
|
311
|
-
name: string;
|
312
|
-
description: string;
|
313
|
-
id: string;
|
314
|
-
tags: string[];
|
315
|
-
identifier: string;
|
316
|
-
action: import("@db/api").$Enums.OpportunityAction;
|
317
|
-
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
318
|
-
chainId: number;
|
319
|
-
howToSteps: string[];
|
320
|
-
depositUrl: string | null;
|
321
|
-
explorerAddress: string | null;
|
322
|
-
mainProtocolId: string | null;
|
323
|
-
tvl: number;
|
324
|
-
apr: number;
|
325
|
-
dailyRewards: number;
|
326
|
-
lastCampaignCreatedAt: Date;
|
327
|
-
};
|
328
|
-
reason: string;
|
329
|
-
pending: string;
|
330
|
-
amount: string;
|
331
|
-
claimed: string;
|
332
|
-
}[];
|
333
|
-
claimed: bigint;
|
334
|
-
amount: bigint;
|
335
|
-
pending: bigint;
|
336
|
-
root: string;
|
337
|
-
recipient: string;
|
338
|
-
proofs: string[];
|
339
|
-
}, "breakdowns"> & {
|
340
|
-
breakdowns: {
|
341
|
-
campaignId: string;
|
342
|
-
subCampaignId: string | undefined;
|
343
|
-
reason: string;
|
344
|
-
pending: string;
|
345
|
-
amount: string;
|
346
|
-
claimed: string;
|
347
|
-
}[];
|
348
|
-
})[];
|
349
|
-
})[];
|
350
|
-
};
|
351
|
-
};
|
352
|
-
};
|
353
|
-
};
|
354
|
-
};
|
355
331
|
} & {
|
356
332
|
users: {
|
357
333
|
index: {
|
@@ -377,8 +353,8 @@ export declare const UserController: Elysia<"/users", false, {
|
|
377
353
|
};
|
378
354
|
} & {
|
379
355
|
users: {
|
380
|
-
|
381
|
-
|
356
|
+
tags: {
|
357
|
+
get: {
|
382
358
|
body: unknown;
|
383
359
|
params: {};
|
384
360
|
query: unknown;
|
@@ -386,27 +362,11 @@ export declare const UserController: Elysia<"/users", false, {
|
|
386
362
|
authorization: string;
|
387
363
|
};
|
388
364
|
response: {
|
389
|
-
200:
|
390
|
-
|
391
|
-
};
|
392
|
-
};
|
393
|
-
};
|
394
|
-
} & {
|
395
|
-
users: {
|
396
|
-
":address": {
|
397
|
-
terms: {
|
398
|
-
get: {
|
399
|
-
body: unknown;
|
400
|
-
params: {
|
365
|
+
200: {
|
366
|
+
tags: string[];
|
401
367
|
address: string;
|
402
|
-
|
403
|
-
|
404
|
-
chainId: number;
|
405
|
-
};
|
406
|
-
headers: unknown;
|
407
|
-
response: {
|
408
|
-
200: boolean;
|
409
|
-
};
|
368
|
+
creatorId: string | null;
|
369
|
+
}[];
|
410
370
|
};
|
411
371
|
};
|
412
372
|
};
|
@@ -437,6 +397,22 @@ export declare const UserController: Elysia<"/users", false, {
|
|
437
397
|
};
|
438
398
|
};
|
439
399
|
};
|
400
|
+
} & {
|
401
|
+
users: {
|
402
|
+
sync: {
|
403
|
+
post: {
|
404
|
+
body: unknown;
|
405
|
+
params: {};
|
406
|
+
query: unknown;
|
407
|
+
headers: {
|
408
|
+
authorization: string;
|
409
|
+
};
|
410
|
+
response: {
|
411
|
+
200: void;
|
412
|
+
};
|
413
|
+
};
|
414
|
+
};
|
415
|
+
};
|
440
416
|
}, {
|
441
417
|
derive: {};
|
442
418
|
resolve: {};
|
@@ -444,5 +420,14 @@ export declare const UserController: Elysia<"/users", false, {
|
|
444
420
|
}, {
|
445
421
|
derive: {};
|
446
422
|
resolve: {};
|
447
|
-
schema: {
|
423
|
+
schema: {
|
424
|
+
body: unknown;
|
425
|
+
headers: {
|
426
|
+
authorization: string;
|
427
|
+
};
|
428
|
+
query: unknown;
|
429
|
+
params: unknown;
|
430
|
+
cookie: unknown;
|
431
|
+
response: {};
|
432
|
+
};
|
448
433
|
}>;
|
@@ -1,45 +1,10 @@
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "@/guards/BackOffice.guard";
|
2
|
-
import { CreatorService } from "@/modules/v4/creator/creator.service";
|
3
2
|
import { RewardService } from "@/modules/v4/reward/reward.service";
|
4
3
|
import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "@/utils/throw";
|
5
4
|
import { Elysia, t } from "elysia";
|
6
|
-
import { CheckTerms, GetManyUserQuery, OptionalChainIdDto,
|
5
|
+
import { CheckTerms, GetManyUserQuery, OptionalChainIdDto, UserDto, UserRewardRouteDto, UserRewardsResourceDto, UserTagsDto, UserUniqueDto, } from "./user.model";
|
7
6
|
import { UserService } from "./user.service";
|
8
|
-
// ─── Users Controller ────────────────────────────────────────────────────────
|
9
7
|
export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["Users"] } })
|
10
|
-
// ─── Get Many Users ──────────────────────────────────────────────────
|
11
|
-
.get("/", async ({ query }) => await UserService.findMany(query), { query: GetManyUserQuery, detail: { hide: true } })
|
12
|
-
// ─── Get All Tagged Users ─────────────────────────────────────────────
|
13
|
-
.get("/tags", async () => await UserService.findManyWithTags(), {
|
14
|
-
headers: AuthorizationHeadersDto,
|
15
|
-
beforeHandle: BackOfficeGuard,
|
16
|
-
detail: { hide: true },
|
17
|
-
})
|
18
|
-
// ─── Get A User By Address ───────────────────────────────────────────
|
19
|
-
.get("/:address", async ({ params }) => await UserService.findUnique(params.address), {
|
20
|
-
detail: { hide: true },
|
21
|
-
})
|
22
|
-
.get("/:address/creator", async ({ params: { address } }) => {
|
23
|
-
const [creator] = await CreatorService.findMany({ address });
|
24
|
-
return creator ? CreatorService.format(creator) : null;
|
25
|
-
})
|
26
|
-
// ─── Get User's Rewards With Breakdown And Details for our FE ────────
|
27
|
-
.get("/:address/rewards/breakdowns", async ({ params, query }) => {
|
28
|
-
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null, !!query.test ? query.test : false, !!query.claimableOnly);
|
29
|
-
return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
|
30
|
-
}, {
|
31
|
-
params: UserUniqueDto,
|
32
|
-
query: OptionalChainIdDto,
|
33
|
-
beforeHandle: ({ params, query }) => {
|
34
|
-
params.address = throwOnInvalidRequiredAddress(params.address);
|
35
|
-
if (!!query.reloadChainId)
|
36
|
-
throwOnUnsupportedChainId(query.reloadChainId);
|
37
|
-
for (const chainId of query?.chainIds ?? []) {
|
38
|
-
throwOnUnsupportedChainId(chainId);
|
39
|
-
}
|
40
|
-
},
|
41
|
-
detail: { hide: true },
|
42
|
-
})
|
43
8
|
// ─── Get User's Rewards With Breakdown ──────────────────────────────
|
44
9
|
.get("/:address/rewards", async ({ params, query }) => {
|
45
10
|
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId, !!query.reloadChainId ? query.reloadChainId : null, !!query.test ? query.test : false, !!query.claimableOnly);
|
@@ -62,22 +27,6 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
62
27
|
},
|
63
28
|
response: t.Array(UserRewardsResourceDto),
|
64
29
|
detail: { description: "Get the rewards associated to a user on a given chain." },
|
65
|
-
})
|
66
|
-
// ─── Create A User ───────────────────────────────────────────────────
|
67
|
-
.post("/", async ({ body }) => await UserService.create(body), {
|
68
|
-
headers: AuthorizationHeadersDto,
|
69
|
-
body: UserDto,
|
70
|
-
beforeHandle: BackOfficeGuard,
|
71
|
-
detail: { hide: true },
|
72
|
-
})
|
73
|
-
// ─── Sync Creator Tags with Engine DB ─────────────────────────────────
|
74
|
-
.post("/sync", async () => {
|
75
|
-
await UserService.syncTags();
|
76
|
-
await UserService.syncOpportunityTags();
|
77
|
-
}, {
|
78
|
-
headers: AuthorizationHeadersDto,
|
79
|
-
beforeHandle: BackOfficeGuard,
|
80
|
-
detail: { hide: true },
|
81
30
|
})
|
82
31
|
// ─── Check if user has signed terms ─────────────────────────────────
|
83
32
|
.get("/:address/terms", async ({ query, params }) => await UserService.checkTerms(params?.address, query?.chainId), {
|
@@ -86,11 +35,44 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
86
35
|
description: "Check if a user address has signed Merkl's terms.",
|
87
36
|
},
|
88
37
|
})
|
38
|
+
.guard({ detail: { hide: true } })
|
39
|
+
// ─── Get Many Users ──────────────────────────────────────────────────
|
40
|
+
.get("/", async ({ query }) => await UserService.findMany(query), { query: GetManyUserQuery })
|
41
|
+
// ─── Get A User By Address ───────────────────────────────────────────
|
42
|
+
.get("/:address", async ({ params }) => await UserService.findUnique(params.address))
|
43
|
+
// ─── Get User's Rewards With Breakdown And Details for our FE ────────
|
44
|
+
.get("/:address/rewards/breakdowns", async ({ params, query }) => {
|
45
|
+
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null, !!query.test ? query.test : false, !!query.claimableOnly);
|
46
|
+
return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
|
47
|
+
}, {
|
48
|
+
params: UserUniqueDto,
|
49
|
+
query: OptionalChainIdDto,
|
50
|
+
beforeHandle: ({ params, query }) => {
|
51
|
+
params.address = throwOnInvalidRequiredAddress(params.address);
|
52
|
+
if (!!query.reloadChainId)
|
53
|
+
throwOnUnsupportedChainId(query.reloadChainId);
|
54
|
+
for (const chainId of query?.chainIds ?? []) {
|
55
|
+
throwOnUnsupportedChainId(chainId);
|
56
|
+
}
|
57
|
+
},
|
58
|
+
})
|
59
|
+
.guard({
|
60
|
+
headers: AuthorizationHeadersDto,
|
61
|
+
beforeHandle: BackOfficeGuard,
|
62
|
+
})
|
63
|
+
// ─── Create A User ───────────────────────────────────────────────────
|
64
|
+
.post("/", async ({ body }) => await UserService.create(body), {
|
65
|
+
body: UserDto,
|
66
|
+
})
|
67
|
+
// ─── Get All Tagged Users ─────────────────────────────────────────────
|
68
|
+
.get("/tags", async () => await UserService.findManyWithTags())
|
89
69
|
// ─── Update User's Tags ──────────────────────────────────────────────
|
90
70
|
.patch("/:address/tags", async ({ params, body }) => UserService.updateTags(params.address, body.tags), {
|
91
|
-
headers: AuthorizationHeadersDto,
|
92
71
|
params: UserUniqueDto,
|
93
|
-
body:
|
94
|
-
|
95
|
-
|
72
|
+
body: UserTagsDto,
|
73
|
+
})
|
74
|
+
// ─── Sync Creator Tags With Engine Db ────────────────────────────────
|
75
|
+
.post("/sync", async () => {
|
76
|
+
await UserService.syncTags();
|
77
|
+
await UserService.syncOpportunityTags();
|
96
78
|
});
|
@@ -66,7 +66,7 @@ export declare const GetManyUserQuery: import("@sinclair/typebox").TObject<{
|
|
66
66
|
export declare const CheckTerms: import("@sinclair/typebox").TObject<{
|
67
67
|
chainId: import("@sinclair/typebox").TNumber;
|
68
68
|
}>;
|
69
|
-
export declare const
|
69
|
+
export declare const UserTagsDto: import("@sinclair/typebox").TObject<{
|
70
70
|
tags: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
71
71
|
}>;
|
72
72
|
export type UserUniqueModel = typeof UserUniqueDto.static;
|
@@ -2,7 +2,7 @@ import { apiDbClient } from "@db";
|
|
2
2
|
// ─── Users Repository ────────────────────────────────────────────────────────
|
3
3
|
export class UserRepository {
|
4
4
|
static async findUnique(address) {
|
5
|
-
return await apiDbClient.user.
|
5
|
+
return await apiDbClient.user.findUniqueOrThrow({ where: { address } });
|
6
6
|
}
|
7
7
|
static async findMany(query) {
|
8
8
|
const { page: _page, items: _items, ...filters } = query;
|