@merkl/api 0.10.317 → 0.10.319
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/src/eden/index.d.ts +236 -2
- package/dist/src/index.d.ts +94 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +74 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +10 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +6 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +20 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +6 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.js +6 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +20 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.js +7 -1
- package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +5 -0
- package/dist/src/modules/v4/programPayload/programPayload.service.js +10 -0
- package/dist/src/modules/v4/router.d.ts +94 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -608,7 +608,64 @@ declare const eden: {
|
|
608
608
|
sum: string;
|
609
609
|
};
|
610
610
|
}>>;
|
611
|
-
}) & {
|
611
|
+
}) & {
|
612
|
+
max: ((params: {
|
613
|
+
field: string | number;
|
614
|
+
}) => {
|
615
|
+
get: (options: {
|
616
|
+
headers?: Record<string, unknown> | undefined;
|
617
|
+
query: {
|
618
|
+
sort?: string | undefined;
|
619
|
+
name?: string | undefined;
|
620
|
+
tokens?: string | undefined;
|
621
|
+
status?: string | undefined;
|
622
|
+
items?: number | undefined;
|
623
|
+
tags?: string | undefined;
|
624
|
+
page?: number | undefined;
|
625
|
+
chainId?: string | undefined;
|
626
|
+
action?: string | undefined;
|
627
|
+
creatorAddress?: string | undefined;
|
628
|
+
mainProtocolId?: string | undefined;
|
629
|
+
order?: string | undefined;
|
630
|
+
test?: boolean | undefined;
|
631
|
+
minimumTvl?: number | undefined;
|
632
|
+
};
|
633
|
+
fetch?: RequestInit | undefined;
|
634
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
635
|
+
200: {
|
636
|
+
max: string;
|
637
|
+
};
|
638
|
+
}>>;
|
639
|
+
}) & {};
|
640
|
+
min: ((params: {
|
641
|
+
field: string | number;
|
642
|
+
}) => {
|
643
|
+
get: (options: {
|
644
|
+
headers?: Record<string, unknown> | undefined;
|
645
|
+
query: {
|
646
|
+
sort?: string | undefined;
|
647
|
+
name?: string | undefined;
|
648
|
+
tokens?: string | undefined;
|
649
|
+
status?: string | undefined;
|
650
|
+
items?: number | undefined;
|
651
|
+
tags?: string | undefined;
|
652
|
+
page?: number | undefined;
|
653
|
+
chainId?: string | undefined;
|
654
|
+
action?: string | undefined;
|
655
|
+
creatorAddress?: string | undefined;
|
656
|
+
mainProtocolId?: string | undefined;
|
657
|
+
order?: string | undefined;
|
658
|
+
test?: boolean | undefined;
|
659
|
+
minimumTvl?: number | undefined;
|
660
|
+
};
|
661
|
+
fetch?: RequestInit | undefined;
|
662
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
663
|
+
200: {
|
664
|
+
min: string;
|
665
|
+
};
|
666
|
+
}>>;
|
667
|
+
}) & {};
|
668
|
+
};
|
612
669
|
};
|
613
670
|
campaigns: {
|
614
671
|
engine: {
|
@@ -2294,6 +2351,19 @@ declare const eden: {
|
|
2294
2351
|
200: any;
|
2295
2352
|
}>>;
|
2296
2353
|
};
|
2354
|
+
"template-config": ((params: {
|
2355
|
+
campaignType: string | number;
|
2356
|
+
}) => {
|
2357
|
+
get: (options?: {
|
2358
|
+
headers?: Record<string, unknown> | undefined;
|
2359
|
+
query?: Record<string, unknown> | undefined;
|
2360
|
+
fetch?: RequestInit | undefined;
|
2361
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
2362
|
+
200: {
|
2363
|
+
[x: string]: string;
|
2364
|
+
};
|
2365
|
+
}>>;
|
2366
|
+
}) & {};
|
2297
2367
|
campaignData: {
|
2298
2368
|
get: (options: {
|
2299
2369
|
headers?: Record<string, unknown> | undefined;
|
@@ -3699,6 +3769,80 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3699
3769
|
};
|
3700
3770
|
};
|
3701
3771
|
};
|
3772
|
+
} & {
|
3773
|
+
opportunities: {
|
3774
|
+
aggregate: {
|
3775
|
+
max: {
|
3776
|
+
":field": {
|
3777
|
+
get: {
|
3778
|
+
body: unknown;
|
3779
|
+
params: {
|
3780
|
+
field: never;
|
3781
|
+
};
|
3782
|
+
query: {
|
3783
|
+
sort?: string | undefined;
|
3784
|
+
name?: string | undefined;
|
3785
|
+
tokens?: string | undefined;
|
3786
|
+
status?: string | undefined;
|
3787
|
+
items?: number | undefined;
|
3788
|
+
tags?: string | undefined;
|
3789
|
+
page?: number | undefined;
|
3790
|
+
chainId?: string | undefined;
|
3791
|
+
action?: string | undefined;
|
3792
|
+
creatorAddress?: string | undefined;
|
3793
|
+
mainProtocolId?: string | undefined;
|
3794
|
+
order?: string | undefined;
|
3795
|
+
test?: boolean | undefined;
|
3796
|
+
minimumTvl?: number | undefined;
|
3797
|
+
};
|
3798
|
+
headers: unknown;
|
3799
|
+
response: {
|
3800
|
+
200: {
|
3801
|
+
max: string;
|
3802
|
+
};
|
3803
|
+
};
|
3804
|
+
};
|
3805
|
+
};
|
3806
|
+
};
|
3807
|
+
};
|
3808
|
+
};
|
3809
|
+
} & {
|
3810
|
+
opportunities: {
|
3811
|
+
aggregate: {
|
3812
|
+
min: {
|
3813
|
+
":field": {
|
3814
|
+
get: {
|
3815
|
+
body: unknown;
|
3816
|
+
params: {
|
3817
|
+
field: never;
|
3818
|
+
};
|
3819
|
+
query: {
|
3820
|
+
sort?: string | undefined;
|
3821
|
+
name?: string | undefined;
|
3822
|
+
tokens?: string | undefined;
|
3823
|
+
status?: string | undefined;
|
3824
|
+
items?: number | undefined;
|
3825
|
+
tags?: string | undefined;
|
3826
|
+
page?: number | undefined;
|
3827
|
+
chainId?: string | undefined;
|
3828
|
+
action?: string | undefined;
|
3829
|
+
creatorAddress?: string | undefined;
|
3830
|
+
mainProtocolId?: string | undefined;
|
3831
|
+
order?: string | undefined;
|
3832
|
+
test?: boolean | undefined;
|
3833
|
+
minimumTvl?: number | undefined;
|
3834
|
+
};
|
3835
|
+
headers: unknown;
|
3836
|
+
response: {
|
3837
|
+
200: {
|
3838
|
+
min: string;
|
3839
|
+
};
|
3840
|
+
};
|
3841
|
+
};
|
3842
|
+
};
|
3843
|
+
};
|
3844
|
+
};
|
3845
|
+
};
|
3702
3846
|
} & {
|
3703
3847
|
opportunities: {
|
3704
3848
|
":id": {
|
@@ -5866,6 +6010,26 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
5866
6010
|
};
|
5867
6011
|
};
|
5868
6012
|
};
|
6013
|
+
} & {
|
6014
|
+
"program-payload": {
|
6015
|
+
"template-config": {
|
6016
|
+
":campaignType": {
|
6017
|
+
get: {
|
6018
|
+
body: unknown;
|
6019
|
+
params: {
|
6020
|
+
campaignType: number;
|
6021
|
+
};
|
6022
|
+
query: unknown;
|
6023
|
+
headers: unknown;
|
6024
|
+
response: {
|
6025
|
+
200: {
|
6026
|
+
[x: string]: string;
|
6027
|
+
};
|
6028
|
+
};
|
6029
|
+
};
|
6030
|
+
};
|
6031
|
+
};
|
6032
|
+
};
|
5869
6033
|
} & {
|
5870
6034
|
"program-payload": {
|
5871
6035
|
campaignData: {
|
@@ -7403,7 +7567,64 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7403
7567
|
sum: string;
|
7404
7568
|
};
|
7405
7569
|
}>>;
|
7406
|
-
}) & {
|
7570
|
+
}) & {
|
7571
|
+
max: ((params: {
|
7572
|
+
field: string | number;
|
7573
|
+
}) => {
|
7574
|
+
get: (options: {
|
7575
|
+
headers?: Record<string, unknown> | undefined;
|
7576
|
+
query: {
|
7577
|
+
sort?: string | undefined;
|
7578
|
+
name?: string | undefined;
|
7579
|
+
tokens?: string | undefined;
|
7580
|
+
status?: string | undefined;
|
7581
|
+
items?: number | undefined;
|
7582
|
+
tags?: string | undefined;
|
7583
|
+
page?: number | undefined;
|
7584
|
+
chainId?: string | undefined;
|
7585
|
+
action?: string | undefined;
|
7586
|
+
creatorAddress?: string | undefined;
|
7587
|
+
mainProtocolId?: string | undefined;
|
7588
|
+
order?: string | undefined;
|
7589
|
+
test?: boolean | undefined;
|
7590
|
+
minimumTvl?: number | undefined;
|
7591
|
+
};
|
7592
|
+
fetch?: RequestInit | undefined;
|
7593
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7594
|
+
200: {
|
7595
|
+
max: string;
|
7596
|
+
};
|
7597
|
+
}>>;
|
7598
|
+
}) & {};
|
7599
|
+
min: ((params: {
|
7600
|
+
field: string | number;
|
7601
|
+
}) => {
|
7602
|
+
get: (options: {
|
7603
|
+
headers?: Record<string, unknown> | undefined;
|
7604
|
+
query: {
|
7605
|
+
sort?: string | undefined;
|
7606
|
+
name?: string | undefined;
|
7607
|
+
tokens?: string | undefined;
|
7608
|
+
status?: string | undefined;
|
7609
|
+
items?: number | undefined;
|
7610
|
+
tags?: string | undefined;
|
7611
|
+
page?: number | undefined;
|
7612
|
+
chainId?: string | undefined;
|
7613
|
+
action?: string | undefined;
|
7614
|
+
creatorAddress?: string | undefined;
|
7615
|
+
mainProtocolId?: string | undefined;
|
7616
|
+
order?: string | undefined;
|
7617
|
+
test?: boolean | undefined;
|
7618
|
+
minimumTvl?: number | undefined;
|
7619
|
+
};
|
7620
|
+
fetch?: RequestInit | undefined;
|
7621
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7622
|
+
200: {
|
7623
|
+
min: string;
|
7624
|
+
};
|
7625
|
+
}>>;
|
7626
|
+
}) & {};
|
7627
|
+
};
|
7407
7628
|
};
|
7408
7629
|
campaigns: {
|
7409
7630
|
engine: {
|
@@ -9089,6 +9310,19 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9089
9310
|
200: any;
|
9090
9311
|
}>>;
|
9091
9312
|
};
|
9313
|
+
"template-config": ((params: {
|
9314
|
+
campaignType: string | number;
|
9315
|
+
}) => {
|
9316
|
+
get: (options?: {
|
9317
|
+
headers?: Record<string, unknown> | undefined;
|
9318
|
+
query?: Record<string, unknown> | undefined;
|
9319
|
+
fetch?: RequestInit | undefined;
|
9320
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
9321
|
+
200: {
|
9322
|
+
[x: string]: string;
|
9323
|
+
};
|
9324
|
+
}>>;
|
9325
|
+
}) & {};
|
9092
9326
|
campaignData: {
|
9093
9327
|
get: (options: {
|
9094
9328
|
headers?: Record<string, unknown> | undefined;
|
package/dist/src/index.d.ts
CHANGED
@@ -678,6 +678,80 @@ declare const app: Elysia<"", false, {
|
|
678
678
|
};
|
679
679
|
};
|
680
680
|
};
|
681
|
+
} & {
|
682
|
+
opportunities: {
|
683
|
+
aggregate: {
|
684
|
+
max: {
|
685
|
+
":field": {
|
686
|
+
get: {
|
687
|
+
body: unknown;
|
688
|
+
params: {
|
689
|
+
field: never;
|
690
|
+
};
|
691
|
+
query: {
|
692
|
+
sort?: string | undefined;
|
693
|
+
name?: string | undefined;
|
694
|
+
tokens?: string | undefined;
|
695
|
+
status?: string | undefined;
|
696
|
+
items?: number | undefined;
|
697
|
+
tags?: string | undefined;
|
698
|
+
page?: number | undefined;
|
699
|
+
chainId?: string | undefined;
|
700
|
+
action?: string | undefined;
|
701
|
+
creatorAddress?: string | undefined;
|
702
|
+
mainProtocolId?: string | undefined;
|
703
|
+
order?: string | undefined;
|
704
|
+
test?: boolean | undefined;
|
705
|
+
minimumTvl?: number | undefined;
|
706
|
+
};
|
707
|
+
headers: unknown;
|
708
|
+
response: {
|
709
|
+
200: {
|
710
|
+
max: string;
|
711
|
+
};
|
712
|
+
};
|
713
|
+
};
|
714
|
+
};
|
715
|
+
};
|
716
|
+
};
|
717
|
+
};
|
718
|
+
} & {
|
719
|
+
opportunities: {
|
720
|
+
aggregate: {
|
721
|
+
min: {
|
722
|
+
":field": {
|
723
|
+
get: {
|
724
|
+
body: unknown;
|
725
|
+
params: {
|
726
|
+
field: never;
|
727
|
+
};
|
728
|
+
query: {
|
729
|
+
sort?: string | undefined;
|
730
|
+
name?: string | undefined;
|
731
|
+
tokens?: string | undefined;
|
732
|
+
status?: string | undefined;
|
733
|
+
items?: number | undefined;
|
734
|
+
tags?: string | undefined;
|
735
|
+
page?: number | undefined;
|
736
|
+
chainId?: string | undefined;
|
737
|
+
action?: string | undefined;
|
738
|
+
creatorAddress?: string | undefined;
|
739
|
+
mainProtocolId?: string | undefined;
|
740
|
+
order?: string | undefined;
|
741
|
+
test?: boolean | undefined;
|
742
|
+
minimumTvl?: number | undefined;
|
743
|
+
};
|
744
|
+
headers: unknown;
|
745
|
+
response: {
|
746
|
+
200: {
|
747
|
+
min: string;
|
748
|
+
};
|
749
|
+
};
|
750
|
+
};
|
751
|
+
};
|
752
|
+
};
|
753
|
+
};
|
754
|
+
};
|
681
755
|
} & {
|
682
756
|
opportunities: {
|
683
757
|
":id": {
|
@@ -2845,6 +2919,26 @@ declare const app: Elysia<"", false, {
|
|
2845
2919
|
};
|
2846
2920
|
};
|
2847
2921
|
};
|
2922
|
+
} & {
|
2923
|
+
"program-payload": {
|
2924
|
+
"template-config": {
|
2925
|
+
":campaignType": {
|
2926
|
+
get: {
|
2927
|
+
body: unknown;
|
2928
|
+
params: {
|
2929
|
+
campaignType: number;
|
2930
|
+
};
|
2931
|
+
query: unknown;
|
2932
|
+
headers: unknown;
|
2933
|
+
response: {
|
2934
|
+
200: {
|
2935
|
+
[x: string]: string;
|
2936
|
+
};
|
2937
|
+
};
|
2938
|
+
};
|
2939
|
+
};
|
2940
|
+
};
|
2941
|
+
};
|
2848
2942
|
} & {
|
2849
2943
|
"program-payload": {
|
2850
2944
|
campaignData: {
|
@@ -547,6 +547,80 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
547
547
|
};
|
548
548
|
};
|
549
549
|
};
|
550
|
+
} & {
|
551
|
+
opportunities: {
|
552
|
+
aggregate: {
|
553
|
+
max: {
|
554
|
+
":field": {
|
555
|
+
get: {
|
556
|
+
body: unknown;
|
557
|
+
params: {
|
558
|
+
field: never;
|
559
|
+
};
|
560
|
+
query: {
|
561
|
+
sort?: string | undefined;
|
562
|
+
name?: string | undefined;
|
563
|
+
tokens?: string | undefined;
|
564
|
+
status?: string | undefined;
|
565
|
+
items?: number | undefined;
|
566
|
+
tags?: string | undefined;
|
567
|
+
page?: number | undefined;
|
568
|
+
chainId?: string | undefined;
|
569
|
+
action?: string | undefined;
|
570
|
+
creatorAddress?: string | undefined;
|
571
|
+
mainProtocolId?: string | undefined;
|
572
|
+
order?: string | undefined;
|
573
|
+
test?: boolean | undefined;
|
574
|
+
minimumTvl?: number | undefined;
|
575
|
+
};
|
576
|
+
headers: unknown;
|
577
|
+
response: {
|
578
|
+
200: {
|
579
|
+
max: string;
|
580
|
+
};
|
581
|
+
};
|
582
|
+
};
|
583
|
+
};
|
584
|
+
};
|
585
|
+
};
|
586
|
+
};
|
587
|
+
} & {
|
588
|
+
opportunities: {
|
589
|
+
aggregate: {
|
590
|
+
min: {
|
591
|
+
":field": {
|
592
|
+
get: {
|
593
|
+
body: unknown;
|
594
|
+
params: {
|
595
|
+
field: never;
|
596
|
+
};
|
597
|
+
query: {
|
598
|
+
sort?: string | undefined;
|
599
|
+
name?: string | undefined;
|
600
|
+
tokens?: string | undefined;
|
601
|
+
status?: string | undefined;
|
602
|
+
items?: number | undefined;
|
603
|
+
tags?: string | undefined;
|
604
|
+
page?: number | undefined;
|
605
|
+
chainId?: string | undefined;
|
606
|
+
action?: string | undefined;
|
607
|
+
creatorAddress?: string | undefined;
|
608
|
+
mainProtocolId?: string | undefined;
|
609
|
+
order?: string | undefined;
|
610
|
+
test?: boolean | undefined;
|
611
|
+
minimumTvl?: number | undefined;
|
612
|
+
};
|
613
|
+
headers: unknown;
|
614
|
+
response: {
|
615
|
+
200: {
|
616
|
+
min: string;
|
617
|
+
};
|
618
|
+
};
|
619
|
+
};
|
620
|
+
};
|
621
|
+
};
|
622
|
+
};
|
623
|
+
};
|
550
624
|
} & {
|
551
625
|
opportunities: {
|
552
626
|
":id": {
|
@@ -131,6 +131,16 @@ export const OpportunityController = new Elysia({
|
|
131
131
|
.get("/aggregate/:field", async ({ query, params }) => await OpportunityService.aggregate(query, params.field), {
|
132
132
|
params: OpportunityAggregateFieldDto,
|
133
133
|
query: GetOpportunitiesQueryDto,
|
134
|
+
})
|
135
|
+
// ─── Get Aggregate Fields ────────────────────────────────────────────
|
136
|
+
.get("/aggregate/max/:field", async ({ query, params }) => await OpportunityService.aggregateMax(query, params.field), {
|
137
|
+
params: OpportunityAggregateFieldDto,
|
138
|
+
query: GetOpportunitiesQueryDto,
|
139
|
+
})
|
140
|
+
// ─── Get Aggregate Fields ────────────────────────────────────────────
|
141
|
+
.get("/aggregate/min/:field", async ({ query, params }) => await OpportunityService.aggregateMin(query, params.field), {
|
142
|
+
params: OpportunityAggregateFieldDto,
|
143
|
+
query: GetOpportunitiesQueryDto,
|
134
144
|
})
|
135
145
|
// ─── Update An Opportunity ───────────────────────────────────────────
|
136
146
|
.patch("/:id", async ({ params, body }) => await OpportunityService.update(params.id, body), {
|
@@ -344,7 +344,7 @@ export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
|
|
344
344
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
345
345
|
}>;
|
346
346
|
export declare const OpportunityAggregateFieldDto: import("@sinclair/typebox").TObject<{
|
347
|
-
field: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"dailyRewards">[]>;
|
347
|
+
field: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"tvl" | "apr" | "dailyRewards">[]>;
|
348
348
|
}>;
|
349
349
|
export declare const OpportunityIdDto: import("@sinclair/typebox").TObject<{
|
350
350
|
id: import("@sinclair/typebox").TString;
|
@@ -87,7 +87,7 @@ export const CreateOpportunityDto = t.Object({
|
|
87
87
|
tags: t.Optional(t.Array(t.String())),
|
88
88
|
});
|
89
89
|
export const OpportunityAggregateFieldDto = t.Object({
|
90
|
-
field: t.Union(["dailyRewards"].map(v => t.Literal(v))),
|
90
|
+
field: t.Union(["dailyRewards", "tvl", "apr"].map(v => t.Literal(v))),
|
91
91
|
});
|
92
92
|
export const OpportunityIdDto = t.Object({ id: t.String() });
|
93
93
|
export const UpdateOpportunityDto = t.Object({
|
@@ -902,6 +902,12 @@ export declare abstract class OpportunityRepository {
|
|
902
902
|
static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
|
903
903
|
sum: string;
|
904
904
|
}>;
|
905
|
+
static aggregateMin(field: keyof Prisma.OpportunityMinAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
|
906
|
+
min: string;
|
907
|
+
}>;
|
908
|
+
static aggregateMax(field: keyof Prisma.OpportunityMaxAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
|
909
|
+
max: string;
|
910
|
+
}>;
|
905
911
|
static update(id: string, data: UpdateOpportunityModel): Promise<{
|
906
912
|
name: string;
|
907
913
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
@@ -382,6 +382,26 @@ export class OpportunityRepository {
|
|
382
382
|
});
|
383
383
|
return { sum: result._sum[field] ?? null };
|
384
384
|
}
|
385
|
+
static async aggregateMin(field, query) {
|
386
|
+
const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
|
387
|
+
const result = await apiDbClient.opportunity.aggregate({
|
388
|
+
_min: {
|
389
|
+
[field]: true,
|
390
|
+
},
|
391
|
+
...args,
|
392
|
+
});
|
393
|
+
return { min: result._min[field] ?? null };
|
394
|
+
}
|
395
|
+
static async aggregateMax(field, query) {
|
396
|
+
const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
|
397
|
+
const result = await apiDbClient.opportunity.aggregate({
|
398
|
+
_max: {
|
399
|
+
[field]: true,
|
400
|
+
},
|
401
|
+
...args,
|
402
|
+
});
|
403
|
+
return { max: result._max[field] ?? null };
|
404
|
+
}
|
385
405
|
static async update(id, data) {
|
386
406
|
return await apiDbClient.opportunity.update({ where: { id }, data });
|
387
407
|
}
|
@@ -451,6 +451,12 @@ export declare abstract class OpportunityService {
|
|
451
451
|
static aggregate(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunitySumAggregateInputType): Promise<{
|
452
452
|
sum: string;
|
453
453
|
}>;
|
454
|
+
static aggregateMin(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunityMinAggregateInputType): Promise<{
|
455
|
+
min: string;
|
456
|
+
}>;
|
457
|
+
static aggregateMax(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunityMaxAggregateInputType): Promise<{
|
458
|
+
max: string;
|
459
|
+
}>;
|
454
460
|
static update(id: string, data: UpdateOpportunityModel): Promise<{
|
455
461
|
name: string;
|
456
462
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
@@ -266,6 +266,12 @@ export class OpportunityService {
|
|
266
266
|
static aggregate(query, field) {
|
267
267
|
return OpportunityRepository.aggregateSum(field, query);
|
268
268
|
}
|
269
|
+
static aggregateMin(query, field) {
|
270
|
+
return OpportunityRepository.aggregateMin(field, query);
|
271
|
+
}
|
272
|
+
static aggregateMax(query, field) {
|
273
|
+
return OpportunityRepository.aggregateMax(field, query);
|
274
|
+
}
|
269
275
|
static async update(id, data) {
|
270
276
|
return await OpportunityRepository.update(id, data);
|
271
277
|
}
|
@@ -67,6 +67,26 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
|
|
67
67
|
};
|
68
68
|
};
|
69
69
|
};
|
70
|
+
} & {
|
71
|
+
"program-payload": {
|
72
|
+
"template-config": {
|
73
|
+
":campaignType": {
|
74
|
+
get: {
|
75
|
+
body: unknown;
|
76
|
+
params: {
|
77
|
+
campaignType: number;
|
78
|
+
};
|
79
|
+
query: unknown;
|
80
|
+
headers: unknown;
|
81
|
+
response: {
|
82
|
+
200: {
|
83
|
+
[x: string]: string;
|
84
|
+
};
|
85
|
+
};
|
86
|
+
};
|
87
|
+
};
|
88
|
+
};
|
89
|
+
};
|
70
90
|
} & {
|
71
91
|
"program-payload": {
|
72
92
|
campaignData: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
|
-
import Elysia from "elysia";
|
2
|
+
import Elysia, { t } from "elysia";
|
3
3
|
import { throwOnUnsupportedChainId } from "src/utils/throw";
|
4
4
|
import { CampaignAmountsInputDto, CampaignPayloadInputDto, ProgramPayloadInputDto, SinglePayloadInputDto, } from "./programPayload.model";
|
5
5
|
import { ProgramPayloadService } from "./programPayload.service";
|
@@ -26,6 +26,12 @@ export const ProgramPayloadController = new Elysia({ prefix: "/program-payload",
|
|
26
26
|
throwOnUnsupportedChainId(query.distributionChainId);
|
27
27
|
},
|
28
28
|
detail: { description: "Generate the configuration for a specific hardcoded campaign from a program" },
|
29
|
+
})
|
30
|
+
.get("/template-config/:campaignType", async ({ params }) => {
|
31
|
+
return ProgramPayloadService.buildConfigTemplate(params);
|
32
|
+
}, {
|
33
|
+
params: t.Object({ campaignType: t.Number() }),
|
34
|
+
detail: { description: "Generate the template configuration with expected types for a specific campaign" },
|
29
35
|
})
|
30
36
|
.get("/campaignData", async ({ query }) => {
|
31
37
|
return ProgramPayloadService.buildCampaignData(query);
|
@@ -2,6 +2,11 @@ import { type Campaign, ChainId, type campaignConfig } from "@sdk";
|
|
2
2
|
import type { CampaignParametersStruct } from "libs/sdk/src/generated/CampaignCreator";
|
3
3
|
import { type CampaignAmountsInputModel, type CampaignPayloadInputModel, type ProgramPayloadInputModel, type SinglePayloadInputDtoModel, type approvalTransaction, type createCampaignTransaction, type safePayload } from "./programPayload.model";
|
4
4
|
export declare class ProgramPayloadService {
|
5
|
+
static buildConfigTemplate(params: {
|
6
|
+
campaignType: number;
|
7
|
+
}): {
|
8
|
+
[key: string]: string;
|
9
|
+
};
|
5
10
|
static buildConfig(query: CampaignPayloadInputModel): campaignConfig<Campaign>;
|
6
11
|
/** building payload for a single campaign */
|
7
12
|
static buildCampaignData(query: CampaignPayloadInputModel): {
|
@@ -4,6 +4,16 @@ import { safeTemplate, } from "./programPayload.model";
|
|
4
4
|
import { MerklInterfaceCampaigns, zkSyncCampaignAmounts } from "./programPayload.repository";
|
5
5
|
export class ProgramPayloadService {
|
6
6
|
// ─── ProgramPayload ──────────────────────────────────────────────────────────
|
7
|
+
static buildConfigTemplate(params) {
|
8
|
+
class CampaignConfig extends CampaignTypeConfigResourceMapping[params.campaignType] {
|
9
|
+
}
|
10
|
+
const parsedConfig = new CampaignConfig();
|
11
|
+
const configTemplate = {};
|
12
|
+
for (const [key, value] of Object.entries(parsedConfig)) {
|
13
|
+
configTemplate[key] = typeof value;
|
14
|
+
}
|
15
|
+
return configTemplate;
|
16
|
+
}
|
7
17
|
static buildConfig(query) {
|
8
18
|
const campaign = query.campaign;
|
9
19
|
const startTimestamp = query.startTimestamp;
|