Skip to content

Commit

Permalink
fix(core): cleanup unnecessary services
Browse files Browse the repository at this point in the history
  • Loading branch information
csuvajit committed Jun 24, 2024
1 parent 099c14f commit 886c812
Show file tree
Hide file tree
Showing 41 changed files with 32 additions and 1,207 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws-ecr-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
service: [service-auth, service-clans]
service: [service-auth]

runs-on: buildjet-4vcpu-ubuntu-2204-arm

Expand Down
5 changes: 2 additions & 3 deletions apps/service-auth/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CustomBotsEntity, PortalUsersEntity } from '@app/entities';
import { encrypt } from '@app/helper';
import { Inject, Injectable, UnauthorizedException } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import moment from 'moment';
import { Collection } from 'mongodb';
import { v4 as uuid } from 'uuid';

Expand Down Expand Up @@ -32,8 +31,8 @@ export class AuthService {
return {
userId: user.userId,
roles: user.roles,
expiresIn: moment().add(2, 'hours').toDate().getTime(),
accessToken: this.jwtService.sign(payload, { expiresIn: '2h' }),
// expiresIn: moment().add(2, 'hours').toDate().getTime(),
accessToken: this.jwtService.sign(payload),
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { ServiceRankingModule } from './service-ranking.module';
import { ServiceBackfillModule } from './service-backfill.module';

async function bootstrap() {
const app = await NestFactory.create(ServiceRankingModule);
const app = await NestFactory.create(ServiceBackfillModule);
const logger = new Logger('NestApplication');

const port = process.env.PORT || 8085;
Expand Down
12 changes: 12 additions & 0 deletions apps/service-backfill/src/service-backfill.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { BackfillService } from './service-backfill.service';

@Controller()
export class ServiceBackfillController {
constructor(private readonly serviceRankingService: BackfillService) {}

@Get()
getHello(): string {
return this.serviceRankingService.getHello();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { MongoDbModule } from '@app/mongodb';
import { RedisModule } from '@app/redis';
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { ServicePlayersController } from './service-players.controller';
import { PlayersService } from './service-players.service';
import { ServiceBackfillController } from './service-backfill.controller';
import { BackfillService } from './service-backfill.service';

@Module({
imports: [
Expand All @@ -13,7 +13,7 @@ import { PlayersService } from './service-players.service';
RedisModule,
ClashClientModule,
],
controllers: [ServicePlayersController],
providers: [PlayersService],
controllers: [ServiceBackfillController],
providers: [BackfillService],
})
export class ServicePlayersModule {}
export class ServiceBackfillModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ConfigService } from '@nestjs/config';
import { Collection, Db } from 'mongodb';

@Injectable()
export class RankingService {
export class BackfillService {
constructor(
private configService: ConfigService,
@Inject(Tokens.MONGODB) private db: Db,
Expand All @@ -25,7 +25,7 @@ export class RankingService {
return 'Hello World!';
}

private logger = new Logger(RankingService.name);
private logger = new Logger(BackfillService.name);
private cached = new Map<string, TrackedClanList>();
private pollingInterval = 1 * 60 * 1000; // 1 minute

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import request from 'supertest';
import { ServiceCapitalModule } from './../src/service-capital.module';
import { ServiceBackfillModule } from '../src/service-backfill.module';

describe('ServiceCapitalController (e2e)', () => {
describe('ServiceBackfillController (e2e)', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [ServiceCapitalModule],
imports: [ServiceBackfillModule],
}).compile();

app = moduleFixture.createNestApplication();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/service-clans"
"outDir": "../../dist/apps/service-backfill"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
Expand Down
14 changes: 0 additions & 14 deletions apps/service-capital/src/main.ts

This file was deleted.

23 changes: 0 additions & 23 deletions apps/service-capital/src/service-capital.controller.ts

This file was deleted.

19 changes: 0 additions & 19 deletions apps/service-capital/src/service-capital.module.ts

This file was deleted.

Loading

0 comments on commit 886c812

Please sign in to comment.