Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02f70b4

Browse files
committed
Member count report
1 parentfc6706c commit02f70b4

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT
2+
COUNT(*)AS"user.count"
3+
FROMidentity.userAS"user"
4+
WHERE ("user".status) ILIKE'A'
5+
LIMIT500;

‎src/app.module.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AuthMiddleware } from "./auth/auth.middleware";
55
import{HealthModule}from"./health/health.module";
66

77
import{TopgearReportsModule}from"./reports/topgear/topgear-reports.module";
8+
import{TopcoderReportsModule}from"./reports/topcoder/topcoder-reports.module";
89
import{StatisticsModule}from"./statistics/statistics.module";
910
import{SfdcReportsModule}from"./reports/sfdc/sfdc-reports.module";
1011
import{ChallengesReportsModule}from"./reports/challenges/challenges-reports.module";
@@ -14,6 +15,7 @@ import { ChallengesReportsModule } from "./reports/challenges/challenges-reports
1415
ConfigModule.forRoot({isGlobal:true}),
1516
DbModule,
1617
TopgearReportsModule,
18+
TopcoderReportsModule,
1719
StatisticsModule,
1820
SfdcReportsModule,
1921
ChallengesReportsModule,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import{Controller,Get}from"@nestjs/common";
2+
import{ApiOperation,ApiTags}from"@nestjs/swagger";
3+
import{TopcoderReportsService}from"./topcoder-reports.service";
4+
5+
@ApiTags("Topcoder Reports")
6+
@Controller("/topcoder")
7+
exportclassTopcoderReportsController{
8+
constructor(privatereadonlyreports:TopcoderReportsService){}
9+
10+
@Get("/member-count")
11+
@ApiOperation({summary:"Total number of active members"})
12+
getMemberCount(){
13+
returnthis.reports.getMemberCount();
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import{Module}from"@nestjs/common";
2+
import{TopcoderReportsController}from"./topcoder-reports.controller";
3+
import{TopcoderReportsService}from"./topcoder-reports.service";
4+
import{SqlLoaderService}from"../../common/sql-loader.service";
5+
6+
@Module({
7+
controllers:[TopcoderReportsController],
8+
providers:[TopcoderReportsService,SqlLoaderService],
9+
})
10+
exportclassTopcoderReportsModule{}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import{Injectable}from"@nestjs/common";
2+
import{DbService}from"../../db/db.service";
3+
import{SqlLoaderService}from"../../common/sql-loader.service";
4+
5+
@Injectable()
6+
exportclassTopcoderReportsService{
7+
constructor(
8+
privatereadonlydb:DbService,
9+
privatereadonlysql:SqlLoaderService,
10+
){}
11+
12+
asyncgetMemberCount(){
13+
constquery=this.sql.load("reports/topcoder/member-count.sql");
14+
constrows=awaitthis.db.query<{"user.count":string|number}>(query);
15+
constvalue=rows?.[0]?.["user.count"];
16+
return{"user.count":Number(value??0)};
17+
}
18+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp