Skip to content

Commit

Permalink
lint fix all server files
Browse files Browse the repository at this point in the history
  • Loading branch information
thatkookooguy committed Oct 25, 2024
1 parent ae4ead6 commit ded974d
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 33 deletions.
7 changes: 4 additions & 3 deletions server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { SystemsModule } from './systems/systems.module';
import { TasksModule } from './tasks/tasks.module';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { EventsModule } from './events/events.module';

@Module({
imports: [
Expand Down Expand Up @@ -53,7 +54,8 @@ import { AppService } from './app.service';
ShieldsModule,
HealthModule,
SystemsModule,
TasksModule
TasksModule,
EventsModule
],
controllers: [ AppController ],
providers: [
Expand All @@ -70,8 +72,7 @@ import { AppService } from './app.service';
useClass: DbExceptionFilter
},
AppService,
SmeeService,
EventsGateway
SmeeService
]
})
export class AppModule {
Expand Down
3 changes: 2 additions & 1 deletion server/src/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { configService, Logger, SmeeService } from '@kb-config';
import { Injectable } from '@nestjs/common';

import { configService, Logger, SmeeService } from '@kb-config';


@Injectable()
export class AppService {
Expand Down
2 changes: 1 addition & 1 deletion server/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Module } from '@nestjs/common';

import { configService, Logger } from '@kb-config';
import { UsersModule } from '@kb-users';

import { BitbucketModule } from './bitbucket/bitbucket.module';
import { GithubModule } from './github/github.module';
import { GitlabModule } from './gitlab/gitlab.module';
import { AuthController } from './auth.controller';
import { configService, Logger } from '@kb-config';

const logger = new Logger('AuthModule');

Expand Down
2 changes: 1 addition & 1 deletion server/src/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';

import { ConfigService, IConfigServiceOptions } from '@kibibit/configit';

import { AchievibitConfig } from './achievibit.config';
import { Logger } from './logger/logger';
import { AchievibitConfig } from './achievibit.config';

const ENV_DEFAULT = 'development';

Expand Down
2 changes: 1 addition & 1 deletion server/src/config/smee/smee.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { noop } from 'lodash';
import SmeeClient from 'smee-client';

import { BeforeApplicationShutdown, Injectable } from '@nestjs/common';

import { configService, Logger } from '@kb-config';
import { noop } from 'lodash';

@Injectable()
export class SmeeService implements BeforeApplicationShutdown {
Expand Down
10 changes: 5 additions & 5 deletions server/src/systems/github/github.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class GithubService {
auth: token
});

const { data } = await installationOctokit.request(`GET /installation/repositories`, {
const { data } = await installationOctokit.request('GET /installation/repositories', {
headers: {
'X-GitHub-Api-Version': '2022-11-28',
accept: 'application/vnd.github+json',
Expand All @@ -70,17 +70,17 @@ export class GithubService {
authStrategy: createAppAuth,
auth: {
appId: configService.config.GITHUB_APP_ID,
privateKey: this.privateKey,
},
privateKey: this.privateKey
}
});

return await octokit.request('GET /app/installations', {
headers: {
'X-GitHub-Api-Version': '2022-11-28',
accept: 'application/vnd.github+json',
per_page: 100
}
})
});
}

private generateGithubAppJwt(): string {
Expand Down
6 changes: 4 additions & 2 deletions server/src/tasks/tasks.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { TasksService } from './tasks.service';

import { SystemsModule } from '@kb-systems';

import { TasksService } from './tasks.service';

@Module({
imports: [
ScheduleModule.forRoot(),
SystemsModule
],
providers: [TasksService]
providers: [ TasksService ]
})
export class TasksModule {}
3 changes: 2 additions & 1 deletion server/src/tasks/tasks.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Test, TestingModule } from '@nestjs/testing';

import { TasksService } from './tasks.service';

describe('TasksService', () => {
let service: TasksService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [TasksService],
providers: [ TasksService ]
}).compile();

service = module.get<TasksService>(TasksService);
Expand Down
33 changes: 17 additions & 16 deletions server/src/tasks/tasks.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { bgBlue, bgYellow } from 'colors';
import { pad } from 'lodash';

import { Injectable } from '@nestjs/common';

import { Logger } from '@kb-config';
import { GithubService } from '@kb-systems';
import { Injectable } from '@nestjs/common';
import { Cron, CronExpression, Interval, Timeout } from '@nestjs/schedule';
import { bgBlue, bgCyan, rainbow, bgYellow } from 'colors';
import { pad } from 'lodash';

@Injectable()
export class TasksService {
Expand All @@ -29,21 +30,21 @@ export class TasksService {
logger: Logger = this.logger
) {
try {
const installations = await this.githubService.getAppInstallations();
const installations = await this.githubService.getAppInstallations();

if (installations?.data?.length === 0) {
logger.verbose('No installations found');
return;
}
if (installations?.data?.length === 0) {
logger.verbose('No installations found');
return;
}

for (const installation of installations.data) {
const installationReposLean = await this.syncGithubAppInstallation(
installation,
logger
);
}
for (const installation of installations.data) {
const installationReposLean = await this.syncGithubAppInstallation(
installation,
logger
);
}

return installations;
return installations;
} catch (error) {
this.logger.error(error);
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/webhooks/engines/github.event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ export class GitHubEvent {
get isPullRequestReviewComment() {
return this.eventType === 'pull_request_review_comment';
}
}
}
2 changes: 1 addition & 1 deletion server/src/webhooks/webhooks.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Post, UseGuards, Headers } from '@nestjs/common';
import { Body, Controller, Headers, Post, UseGuards } from '@nestjs/common';
import { ApiBody, ApiExcludeEndpoint, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger';

import { configService, Logger } from '@kb-config';
Expand Down
1 change: 1 addition & 0 deletions server/src/webhooks/webhooks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as crypto from 'crypto';
import { Injectable } from '@nestjs/common';

import { configService, Logger } from '@kb-config';

import { GitHubEvent } from './engines/github.event';

@Injectable()
Expand Down

0 comments on commit ded974d

Please sign in to comment.