2 files changed
+5
-6
No files matched your search
@@ -50,7 +50,7 @@ class StatusPageController {
|
|||||||
await createStatusPageBodyValidation.validateAsync(req.body);
|
await createStatusPageBodyValidation.validateAsync(req.body);
|
||||||
await imageValidation.validateAsync(req.file);
|
await imageValidation.validateAsync(req.file);
|
||||||
const teamId = requireTeamId(req?.user?.teamId);
|
const teamId = requireTeamId(req?.user?.teamId);
|
||||||
const statusPageId = req.params.id;
|
const statusPageId = req.params.id as string;
|
||||||
if (!statusPageId) {
|
if (!statusPageId) {
|
||||||
throw new AppError({ message: "Status page ID is required", status: 400 });
|
throw new AppError({ message: "Status page ID is required", status: 400 });
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ class StatusPageController {
|
|||||||
throw new AppError({ message: "Status page URL is required", status: 400 });
|
throw new AppError({ message: "Status page URL is required", status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusPage = await this.statusPageService.getStatusPageByUrl(req.params.url);
|
const statusPage = await this.statusPageService.getStatusPageByUrl(req.params.url as string);
|
||||||
const settings = await this.settingsService.getDBSettings();
|
const settings = await this.settingsService.getDBSettings();
|
||||||
const showURL = settings.showURL;
|
const showURL = settings.showURL;
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ class StatusPageController {
|
|||||||
|
|
||||||
deleteStatusPage = async (req: Request, res: Response, next: NextFunction) => {
|
deleteStatusPage = async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
const statusPageId = req.params.id;
|
const statusPageId = req.params.id as string;
|
||||||
if (!statusPageId) {
|
if (!statusPageId) {
|
||||||
throw new AppError({ message: "Status page ID is required", status: 400 });
|
throw new AppError({ message: "Status page ID is required", status: 400 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { BulkWriteResult } from "mongodb";
|
|
||||||
|
|
||||||
const CHECKS_COLLECTION = "checks";
|
const CHECKS_COLLECTION = "checks";
|
||||||
const BACKUP_COLLECTION = "checks_backup";
|
const BACKUP_COLLECTION = "checks_backup";
|
||||||
@@ -144,14 +143,14 @@ const migrateBackupData = async (backedUp: boolean): Promise<MigrationStats> =>
|
|||||||
operations.push({ insertOne: { document: { ...rest, metadata } } });
|
operations.push({ insertOne: { document: { ...rest, metadata } } });
|
||||||
|
|
||||||
if (operations.length >= BATCH_SIZE) {
|
if (operations.length >= BATCH_SIZE) {
|
||||||
const result: BulkWriteResult = await target.bulkWrite(operations, { ordered: false });
|
const result = await target.bulkWrite(operations, { ordered: false });
|
||||||
stats.totalMigrated += result.insertedCount;
|
stats.totalMigrated += result.insertedCount;
|
||||||
operations.length = 0;
|
operations.length = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operations.length) {
|
if (operations.length) {
|
||||||
const result: BulkWriteResult = await target.bulkWrite(operations, { ordered: false });
|
const result = await target.bulkWrite(operations, { ordered: false });
|
||||||
stats.totalMigrated += result.insertedCount;
|
stats.totalMigrated += result.insertedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user