@merkl/api 0.10.250 → 0.10.251
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +3 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +2 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +9 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +1 -0
- package/dist/src/modules/v4/router.d.ts +1 -0
- package/dist/src/modules/v4/user/user.service.js +1 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -560,6 +560,7 @@ declare const eden: {
|
|
560
560
|
campaigns: {
|
561
561
|
index: {
|
562
562
|
post: (body: {
|
563
|
+
tags?: string[] | undefined;
|
563
564
|
identifier?: string | undefined;
|
564
565
|
subType?: number | undefined;
|
565
566
|
type: number;
|
@@ -3403,6 +3404,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3403
3404
|
index: {
|
3404
3405
|
post: {
|
3405
3406
|
body: {
|
3407
|
+
tags?: string[] | undefined;
|
3406
3408
|
identifier?: string | undefined;
|
3407
3409
|
subType?: number | undefined;
|
3408
3410
|
type: number;
|
@@ -6758,6 +6760,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6758
6760
|
campaigns: {
|
6759
6761
|
index: {
|
6760
6762
|
post: (body: {
|
6763
|
+
tags?: string[] | undefined;
|
6761
6764
|
identifier?: string | undefined;
|
6762
6765
|
subType?: number | undefined;
|
6763
6766
|
type: number;
|
package/dist/src/index.d.ts
CHANGED
@@ -100,6 +100,7 @@ export declare const CreateCampaignDto: import("@sinclair/typebox").TObject<{
|
|
100
100
|
startTimestamp: import("@sinclair/typebox").TString;
|
101
101
|
endTimestamp: import("@sinclair/typebox").TString;
|
102
102
|
params: import("@sinclair/typebox").TString;
|
103
|
+
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
103
104
|
}>;
|
104
105
|
export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
|
105
106
|
creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
@@ -61,6 +61,7 @@ export const CreateCampaignDto = t.Object({
|
|
61
61
|
startTimestamp: t.String(),
|
62
62
|
endTimestamp: t.String(),
|
63
63
|
params: t.String(),
|
64
|
+
tags: t.Optional(t.Array(t.String())),
|
64
65
|
});
|
65
66
|
export const GetCampaignQueryDto = t.Object({
|
66
67
|
creatorTag: t.Optional(t.String({ description: "Filter campaigns created by a user who has a specific tag" })),
|
@@ -106,6 +106,7 @@ export class CampaignRepository {
|
|
106
106
|
connect: metadata.mainProtocol && { id: metadata.mainProtocol },
|
107
107
|
},
|
108
108
|
depositUrl: !!params.url ? params.url : undefined,
|
109
|
+
tags: metadata.tags,
|
109
110
|
},
|
110
111
|
},
|
111
112
|
},
|
@@ -188,6 +189,7 @@ export class CampaignRepository {
|
|
188
189
|
id: campaignToOpp[campaign.id].mainProtocol,
|
189
190
|
},
|
190
191
|
},
|
192
|
+
tags: campaignToOpp[campaign.id].tags,
|
191
193
|
},
|
192
194
|
},
|
193
195
|
},
|
@@ -9,6 +9,7 @@ import { NETWORK_LABELS } from "@sdk";
|
|
9
9
|
import moment from "moment";
|
10
10
|
import { StatusService } from "../status";
|
11
11
|
import { TokenService } from "../token";
|
12
|
+
import { UserService } from "../user";
|
12
13
|
export class CampaignService {
|
13
14
|
static hashId(campaign) {
|
14
15
|
return Bun.hash(`${campaign.distributionChain}${campaign.campaignId}`).toString();
|
@@ -19,6 +20,10 @@ export class CampaignService {
|
|
19
20
|
id,
|
20
21
|
...campaign,
|
21
22
|
});
|
23
|
+
opportunityMetadata.tags = [
|
24
|
+
...((await UserService.findUnique(campaign.creator))?.tags ?? []),
|
25
|
+
...(campaign?.tags ?? []),
|
26
|
+
];
|
22
27
|
return await CampaignRepository.upsert({ id, ...campaign }, opportunityMetadata);
|
23
28
|
}
|
24
29
|
static async createMany(campaigns) {
|
@@ -33,6 +38,10 @@ export class CampaignService {
|
|
33
38
|
id,
|
34
39
|
...campaign,
|
35
40
|
});
|
41
|
+
oppMetadata.tags = [
|
42
|
+
...((await UserService.findUnique(campaign.creator))?.tags ?? []),
|
43
|
+
...(campaign?.tags ?? []),
|
44
|
+
];
|
36
45
|
campaignToOppMetadata[id] = oppMetadata;
|
37
46
|
campaignsToInsert.push({ id, ...campaign });
|
38
47
|
}
|
@@ -58,6 +58,7 @@ export class UserService {
|
|
58
58
|
for (const opportunity of opportunities) {
|
59
59
|
if (!user.tags.every(tag => opportunity.tags.includes(tag))) {
|
60
60
|
log.local(`updating tags for opportunity ${opportunity.id}: adding ${user.tags.join(",")}`);
|
61
|
+
log.local(`opportunity tags: ${opportunity.tags.join(",")}`);
|
61
62
|
await OpportunityService.update(opportunity.id, { tags: [...opportunity.tags, ...user.tags] });
|
62
63
|
}
|
63
64
|
}
|