Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjulian committed Jul 20, 2023
1 parent 74235d1 commit da1e576
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/auth/auth.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class AuthResolver {
async login(@Args('data') { email, password }: LoginInput) {
const { accessToken, refreshToken } = await this.auth.login(
email.toLowerCase(),
password
password,
);

return {
Expand Down
6 changes: 3 additions & 3 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export class AuthService {
private readonly jwtService: JwtService,
private readonly prisma: PrismaService,
private readonly passwordService: PasswordService,
private readonly configService: ConfigService
private readonly configService: ConfigService,
) {}

async createUser(payload: SignupInput): Promise<Token> {
const hashedPassword = await this.passwordService.hashPassword(
payload.password
payload.password,
);

try {
Expand Down Expand Up @@ -60,7 +60,7 @@ export class AuthService {

const passwordValid = await this.passwordService.validatePassword(
password,
user.password
user.password,
);

if (!passwordValid) {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { JwtDto } from './dto/jwt.dto';
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor(
private readonly authService: AuthService,
readonly configService: ConfigService
readonly configService: ConfigService,
) {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
Expand Down
2 changes: 1 addition & 1 deletion src/common/decorators/user.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { GqlExecutionContext } from '@nestjs/graphql';

export const UserEntity = createParamDecorator(
(data: unknown, ctx: ExecutionContext) =>
GqlExecutionContext.create(ctx).getContext().req.user
GqlExecutionContext.create(ctx).getContext().req.user,
);
6 changes: 3 additions & 3 deletions src/posts/posts.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class PostsResolver {
@Mutation(() => Post)
async createPost(
@UserEntity() user: User,
@Args('data') data: CreatePostInput
@Args('data') data: CreatePostInput,
) {
const newPost = this.prisma.post.create({
data: {
Expand All @@ -61,7 +61,7 @@ export class PostsResolver {
type: () => PostOrder,
nullable: true,
})
orderBy: PostOrder
orderBy: PostOrder,
) {
const a = await findManyCursorConnection(
(args) =>
Expand All @@ -81,7 +81,7 @@ export class PostsResolver {
title: { contains: query || '' },
},
}),
{ first, last, before, after }
{ first, last, before, after },
);
return a;
}
Expand Down
8 changes: 4 additions & 4 deletions src/users/users.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { UpdateUserInput } from './dto/update-user.input';
export class UsersResolver {
constructor(
private usersService: UsersService,
private prisma: PrismaService
private prisma: PrismaService,
) {}

@Query(() => User)
Expand All @@ -32,7 +32,7 @@ export class UsersResolver {
@Mutation(() => User)
async updateUser(
@UserEntity() user: User,
@Args('data') newUserData: UpdateUserInput
@Args('data') newUserData: UpdateUserInput,
) {
return this.usersService.updateUser(user.id, newUserData);
}
Expand All @@ -41,12 +41,12 @@ export class UsersResolver {
@Mutation(() => User)
async changePassword(
@UserEntity() user: User,
@Args('data') changePassword: ChangePasswordInput
@Args('data') changePassword: ChangePasswordInput,
) {
return this.usersService.changePassword(
user.id,
user.password,
changePassword
changePassword,
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { UpdateUserInput } from './dto/update-user.input';
export class UsersService {
constructor(
private prisma: PrismaService,
private passwordService: PasswordService
private passwordService: PasswordService,
) {}

updateUser(userId: string, newUserData: UpdateUserInput) {
Expand All @@ -23,19 +23,19 @@ export class UsersService {
async changePassword(
userId: string,
userPassword: string,
changePassword: ChangePasswordInput
changePassword: ChangePasswordInput,
) {
const passwordValid = await this.passwordService.validatePassword(
changePassword.oldPassword,
userPassword
userPassword,
);

if (!passwordValid) {
throw new BadRequestException('Invalid password');
}

const hashedPassword = await this.passwordService.hashPassword(
changePassword.newPassword
changePassword.newPassword,
);

return this.prisma.user.update({
Expand Down

0 comments on commit da1e576

Please sign in to comment.