Skip to content

Commit

Permalink
fix:update password bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadeera3784 committed Jun 15, 2024
1 parent 8810639 commit 498bf17
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion apps/backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function bootstrap() {
),
}),
);
app.use(helmet({contentSecurityPolicy: false}));
app.use(helmet({ contentSecurityPolicy: false }));
app.use(morgan('dev'));
app.use(requestIp.mw());
app.enableShutdownHooks();
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/modules/analytic/analytic.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { UserModule } from '../user/user.module';
MongooseModule.forFeature([
{ name: Analytic.name, schema: AnalyticSchema },
]),
UserModule
UserModule,
],
providers: [
JwtService,
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/modules/app/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export * from './cache.service';
export * from './email.service';
export * from './utility.service';
export * from './request-parser.service';
export * from './model.service';
export * from './model.service';
20 changes: 9 additions & 11 deletions apps/backend/src/modules/app/services/model.service.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { Injectable } from "@nestjs/common";
import { Injectable } from '@nestjs/common';

@Injectable()
export abstract class ModelService <T> {
export abstract class ModelService<T> {
protected abstract getAll(): Promise<T[]>;

protected abstract getAll(): Promise<T[]>;
protected abstract create(input: any): Promise<T>;

protected abstract create(input: any): Promise<T>;

protected abstract getById(id: string): Promise<T | null>;

protected abstract update(id: string, updateInput: any): Promise<T | null>;

protected abstract delete(id: string): Promise<{ deletedCount?: number }>;

protected abstract getById(id: string): Promise<T | null>;

protected abstract update(id: string, updateInput: any): Promise<T | null>;

protected abstract delete(id: string): Promise<{ deletedCount?: number }>;
}
2 changes: 1 addition & 1 deletion apps/backend/src/modules/category/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './category.interface';
export * from './category.interface';
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { LocationStatusEnum } from '../enums';
import { ModelService } from '../../app/services';

@Injectable()
export class LocationService extends ModelService<Location>{
export class LocationService extends ModelService<Location> {
constructor(
@InjectModel(Location.name) private readonly locationModel: Model<Location>,
private configService: ConfigService,
Expand Down
4 changes: 1 addition & 3 deletions apps/backend/src/modules/user/services/user.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import * as bcrypt from 'bcrypt';
import * as moment from 'moment';
import { ConfigService } from '@nestjs/config';

Expand Down Expand Up @@ -88,11 +87,10 @@ export class UserService extends ModelService<User> {
}

public async updatePassword(id: string, password: string) {
const newPassword = await bcrypt.hash(password, 10);
return await this.userModel.findByIdAndUpdate(
{ _id: id },
{
password: newPassword,
password: password,
},
);
}
Expand Down

0 comments on commit 498bf17

Please sign in to comment.