Skip to content

Commit

Permalink
refactor: ♻️ linting auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CourtHive committed Apr 18, 2024
1 parent cb750c9 commit 6bb5d64
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/query/matchUps/roundRobinTally/getGroupOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ function groupSubSort({ participantResults, disableHeadToHead, participantIds, m
report.push(result.report);

// return false if a rule has successfully broken the tie
return result.order ? false : true;
return !result.order;
});

if (result.order) return { order: result.order, report };
Expand Down
4 changes: 2 additions & 2 deletions src/server/app.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ describe('AppService', () => {
app = await Test.createTestingModule({
imports: [AuthModule, UsersModule],
controllers: [AppController],
providers: [AppService]
providers: [AppService],
}).compile();
});

describe('getHello', () => {
it('should return "Factory server"', () => {
const appController = app.get(AppController);
expect(appController.factoryService()).toStrictEqual({
message: 'Factory server'
message: 'Factory server',
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/server/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import { Module } from '@nestjs/common';
JwtModule.register({
signOptions: { expiresIn: process.env.JWT_VALIDITY || '1d' },
secret: process.env.JWT_SECRET,
global: true
})
global: true,
}),
],
providers: [
AuthService,
{
provide: APP_GUARD,
useClass: AuthGuard
}
useClass: AuthGuard,
},
],
controllers: [AuthController],
exports: [AuthService]
exports: [AuthService],
})
export class AuthModule {}
4 changes: 2 additions & 2 deletions src/server/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { JwtService } from '@nestjs/jwt';
export class AuthService {
constructor(
private usersService: UsersService,
private jwtService: JwtService
private jwtService: JwtService,
) {}

async signIn(email: string, pass: string) {
Expand All @@ -16,7 +16,7 @@ export class AuthService {
}
const payload = { email: user.email, sub: user.userId, roles: user.roles };
return {
token: await this.jwtService.signAsync(payload)
token: await this.jwtService.signAsync(payload),
};
}
}
6 changes: 3 additions & 3 deletions src/server/auth/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { CanActivate, ExecutionContext, Injectable, UnauthorizedException } from
export class AuthGuard implements CanActivate {
constructor(
private jwtService: JwtService,
private reflector: Reflector
private reflector: Reflector,
) {}

async canActivate(context: ExecutionContext): Promise<boolean> {
const isPublic = this.reflector.getAllAndOverride<boolean>(IS_PUBLIC_KEY, [
context.getHandler(),
context.getClass()
context.getClass(),
]);
if (isPublic) {
return true;
Expand All @@ -27,7 +27,7 @@ export class AuthGuard implements CanActivate {

try {
const payload = await this.jwtService.verifyAsync(token, {
secret: process.env.JWT_SECRET
secret: process.env.JWT_SECRET,
});
// assign payload to the request object for access in route handlers
request['user'] = payload;
Expand Down
2 changes: 1 addition & 1 deletion src/server/config/app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const APPConfig = registerAs(ConfigKey.App, () => ({
env: Environment[process.env.NODE_ENV as keyof typeof Environment] || Environment.Development,
port: Number(process.env.APP_PORT) || 8383,
name: String(process.env.APP_NAME),
appName: process.env.APP_NAME
appName: process.env.APP_NAME,
}));
6 changes: 3 additions & 3 deletions src/server/config/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { Module } from '@nestjs/common';
ConfigModule.forRoot({
load: [...configurations],
validate: validateConfig,
isGlobal: true
})
]
isGlobal: true,
}),
],
})
export class ConfigsModule {}
2 changes: 1 addition & 1 deletion src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function bootstrap() {
app.enableCors({
methods: ['GET', 'POST'],
allowedHeaders: '*',
origin: '*'
origin: '*',
});

// await app.register(cookieParser);
Expand Down
2 changes: 1 addition & 1 deletion src/server/providers/factory/factory.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Module } from '@nestjs/common';

@Module({
providers: [FactoryService],
exports: [FactoryService]
exports: [FactoryService],
})
export class FactoryModule {}
2 changes: 1 addition & 1 deletion src/server/providers/users/users.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Module } from '@nestjs/common';

@Module({
providers: [UsersService],
exports: [UsersService]
exports: [UsersService],
})
export class UsersModule {}
2 changes: 1 addition & 1 deletion src/server/providers/users/users.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('UsersService', () => {

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

service = module.get<UsersService>(UsersService);
Expand Down
4 changes: 2 additions & 2 deletions src/server/providers/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export class UsersService {
userId: 1,
email: TEST_EMAIL,
password: TEST_PASSWORD,
roles: ['admin', 'client']
}
roles: ['admin', 'client'],
},
];

async findOne(email: string): Promise<User | undefined> {
Expand Down
2 changes: 1 addition & 1 deletion src/validators/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function validTimePeriod({ startTime = '', endTime = '' } = {}) {
const [endHour, endMinute] = endTime.split(':').map(getInt);

if (endHour < startHour) return false;
return startHour === endHour && endMinute < startMinute ? false : true;
return !(startHour === endHour && endMinute < startMinute);
}

export function startTimeSort(a, b) {
Expand Down
2 changes: 1 addition & 1 deletion src/validators/validateSchedulingProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function validateSchedulingProfile({ tournamentRecords, schedulingProfile
return validRound && validSegment;
});

return !validRounds ? false : true;
return !!validRounds;
});
});

Expand Down

0 comments on commit 6bb5d64

Please sign in to comment.