Skip to content
Merged

Dev #21

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Injectable } from '@nestjs/common';
import { EmailService } from './email/email.service';

@Injectable()
export class AppService {
Expand Down
10 changes: 5 additions & 5 deletions src/auth/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ export class AuthGuard implements CanActivate {

if (!bearerToken)
throw new UnauthorizedException(
'please provide Bearer token in Authorization header.',
'Please provide Bearer token in Authorization header.',
);

const token = bearerToken.split(' ')[1];

if (!token)
throw new UnauthorizedException(
'auth token not found in Authorization header.',
'Auth token not found in Authorization header.',
);

const decodedToken = decodeJwtToken(
token,
this.configService.get('APP_KEY', { infer: true }),
) as any;

if (!decodedToken)
if (!decodedToken)
throw new UnauthorizedException(
'invalid auth token or token has expired, please login to get new token.',
'Invalid auth token or token has expired, please login to get new token.',
);

const sessionId = decodedToken?.sessionId;
Expand All @@ -55,7 +55,7 @@ export class AuthGuard implements CanActivate {
const authSession = await this.authSessionService.get(sessionId);

if (!authSession || authSession?.authTokenVersion != authTokenVersion) {
throw new UnauthorizedException('please login again.');
throw new UnauthorizedException('Please login again.');
}

request['user'] = {
Expand Down
10 changes: 5 additions & 5 deletions src/messenger/messenger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class MessengerService {

if (!onlyOne) {
throw new BadRequestException(
"only provide value for either 'send_at' or 'send_after', not both.",
"Only provide value for either 'send_at' or 'send_after', not both.",
);
}

Expand All @@ -64,7 +64,7 @@ export class MessengerService {

if (!savedMessage) {
throw new UnprocessableEntityException(
'failed to create message. please try again.',
'Failed to create message. Please try again.',
);
}

Expand All @@ -82,7 +82,7 @@ export class MessengerService {

if (!job) {
throw new UnprocessableEntityException(
'failed to add message. please try again',
'Failed to add message. Please try again',
);
}

Expand All @@ -98,15 +98,15 @@ export class MessengerService {
});

if (!message) {
throw new NotFoundException('message with id not found.');
throw new NotFoundException('Message with id not found.');
}

const user = await this.userRepository.findOneBy({
id: message.created_by,
});

if (!user) {
throw new NotFoundException('user not found.');
throw new NotFoundException('User not found.');
}

const recipientEmail = user.email;
Expand Down
4 changes: 2 additions & 2 deletions src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class UserService {
});

if (existingUser) {
throw new BadRequestException('user with this email already exists.');
throw new BadRequestException('User with this email already exists.');
}

const user = new User();
Expand All @@ -35,7 +35,7 @@ export class UserService {

if (!saved) {
throw new UnprocessableEntityException(
'failed to add user. please try again.',
'Failed to add user. Please try again.',
);
}

Expand Down
Loading