forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreputation.controller.ts
More file actions
37 lines (30 loc) · 1.03 KB
/
Copy pathreputation.controller.ts
File metadata and controls
37 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Controller, Get, Param, Req } from "@nestjs/common";
import type { Request } from "express";
import { ReputationService } from "./reputation.service";
interface AuthRequest extends Request {
user: { walletAddress: string };
}
@Controller("reputation")
export class ReputationController {
constructor(private readonly service: ReputationService) {}
@Get(":walletAddress")
async getReputation(@Param("walletAddress") walletAddress: string) {
return this.service.getReputation(walletAddress);
}
@Get("my-score")
async myScore(@Req() req: AuthRequest) {
return this.service.getReputation(req.user.walletAddress);
}
@Get(":walletAddress/history")
async history(@Param("walletAddress") walletAddress: string) {
return this.service.getHistory(walletAddress);
}
@Get("leaderboard/trusted-payers")
async leaderboard() {
return this.service.leaderboard();
}
@Get("badge/:walletAddress")
async badge(@Param("walletAddress") walletAddress: string) {
return this.service.getBadge(walletAddress);
}
}