Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
HttpStatus,
} from '@nestjs/common';
import { Response } from 'express';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';

Check warning on line 18 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

'ApiQuery' is defined but never used

Check warning on line 18 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

'ApiOperation' is defined but never used
import { CurrentUser } from '../auth/decorators/current-user.decorator';
import { Roles } from '../auth/decorators/roles.decorator';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
Expand All @@ -38,6 +39,7 @@
} from './dto/admin.dto';
import { RestoreBackupDto, UpdateBackupScheduleDto } from '../backup/dto/backup.dto';

@ApiTags('Admin')
@Controller('admin')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.ADMIN)
Expand All @@ -49,17 +51,17 @@
) {}

@Get('dashboard')
getDashboard() {

Check warning on line 54 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

Missing return type on function

Check warning on line 54 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

Missing return type on function
return this.adminService.getDashboard();
}

@Get('backups')
listBackups() {

Check warning on line 59 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

Missing return type on function

Check warning on line 59 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

Missing return type on function
return this.adminService.listBackups();
}

@Get('backups/status')
getBackupStatus() {

Check warning on line 64 in src/admin/admin.controller.ts

View workflow job for this annotation

GitHub Actions / lint

Missing return type on function
return this.adminService.getBackupStatus();
}

Expand Down
14 changes: 7 additions & 7 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1310,13 +1310,13 @@ export class AuthService {
take: passwordHistoryLimit,
});

for (const historyEntry of recentPasswords) {
const isReused = await comparePassword(data.newPassword, historyEntry.passwordHash);
if (isReused) {
throw new BadRequestException(
`Password reuse is not allowed for the last ${passwordHistoryLimit} passwords`,
);
}
const reuseResults = await Promise.all(
recentPasswords.map((entry) => comparePassword(data.newPassword, entry.passwordHash)),
);
if (reuseResults.some(Boolean)) {
throw new BadRequestException(
`Password reuse is not allowed for the last ${passwordHistoryLimit} passwords`,
);
}

const newPasswordHash = await hashPassword(data.newPassword, this.bcryptRounds);
Expand Down
2 changes: 2 additions & 0 deletions src/properties/properties.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import {
import { CreateAmenityDto, UpdateAmenityDto } from './dto/amenity.dto';
import { PropertyReportService } from './report/property-report.service';
import { Response } from 'express';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';

@ApiTags('Properties')
@Controller('properties')
export class PropertiesController {
constructor(
Expand Down
Loading