mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-19 07:58:46 -05:00
Merge branch 'develop' into feat/monitor-service-ts
This commit is contained in:
@@ -18,7 +18,11 @@ import { useSelector } from "react-redux";
|
||||
import { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useFetchChecksTeam, useFetchChecksByMonitor, useResolveIncident } from "@/Hooks/checkHooks.js";
|
||||
import {
|
||||
useFetchChecksTeam,
|
||||
useFetchChecksByMonitor,
|
||||
useResolveIncident,
|
||||
} from "@/Hooks/checkHooks.js";
|
||||
import { Button, Typography, useTheme } from "@mui/material";
|
||||
import { lighten } from "@mui/material/styles";
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ import { Box, Button } from "@mui/material";
|
||||
//Utils
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useFetchMonitorsByTeamId } from "@/Hooks/monitorHooks.js";
|
||||
import { useFetchChecksSummaryByTeamId, useAcknowledgeChecks } from "@/Hooks/checkHooks.js";
|
||||
import {
|
||||
useFetchChecksSummaryByTeamId,
|
||||
useAcknowledgeChecks,
|
||||
} from "@/Hooks/checkHooks.js";
|
||||
import { useState, useEffect } from "react";
|
||||
import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -15,7 +15,7 @@ services:
|
||||
depends_on:
|
||||
- mongodb
|
||||
mongodb:
|
||||
image: mongo:4.4.18
|
||||
image: mongo:4.4.30
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
ports:
|
||||
|
||||
@@ -19,10 +19,10 @@ const backupAndDropExistingCollection = async () => {
|
||||
return false;
|
||||
}
|
||||
|
||||
await db.collection(CHECKS_COLLECTION).aggregate([
|
||||
{ $match: {} },
|
||||
{ $out: BACKUP_COLLECTION },
|
||||
]).toArray();
|
||||
await db
|
||||
.collection(CHECKS_COLLECTION)
|
||||
.aggregate([{ $match: {} }, { $out: BACKUP_COLLECTION }])
|
||||
.toArray();
|
||||
await db.collection(CHECKS_COLLECTION).drop();
|
||||
return true;
|
||||
};
|
||||
@@ -40,12 +40,14 @@ const createTimeSeriesCollection = async () => {
|
||||
});
|
||||
}
|
||||
|
||||
await db.collection(CHECKS_COLLECTION).createIndexes([
|
||||
{ key: { updatedAt: 1 } },
|
||||
{ key: { "metadata.monitorId": 1, updatedAt: 1 } },
|
||||
{ key: { "metadata.monitorId": 1, updatedAt: -1 } },
|
||||
{ key: { "metadata.teamId": 1, updatedAt: -1 } },
|
||||
]);
|
||||
await db
|
||||
.collection(CHECKS_COLLECTION)
|
||||
.createIndexes([
|
||||
{ key: { updatedAt: 1 } },
|
||||
{ key: { "metadata.monitorId": 1, updatedAt: 1 } },
|
||||
{ key: { "metadata.monitorId": 1, updatedAt: -1 } },
|
||||
{ key: { "metadata.teamId": 1, updatedAt: -1 } },
|
||||
]);
|
||||
};
|
||||
|
||||
const migrateBackupData = async () => {
|
||||
|
||||
@@ -32,11 +32,7 @@ const runMigrations = async (logger?: { info: Function; error: Function }) => {
|
||||
logger?.info({ message: `Completed ${migration.name}`, service: "Migrations" });
|
||||
} catch (error) {
|
||||
const err = error as Error;
|
||||
await MigrationModel.findOneAndUpdate(
|
||||
{ name: migration.name },
|
||||
{ status: "failed", error: err?.message },
|
||||
{ upsert: true }
|
||||
);
|
||||
await MigrationModel.findOneAndUpdate({ name: migration.name }, { status: "failed", error: err?.message }, { upsert: true });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { Schema, model, Types } from "mongoose";
|
||||
import {
|
||||
MonitorTypes,
|
||||
type MonitorType,
|
||||
} from "@/types/monitor.js";
|
||||
import { MonitorTypes, type MonitorType } from "@/types/monitor.js";
|
||||
import type {
|
||||
Check,
|
||||
CheckAudits,
|
||||
@@ -25,10 +22,7 @@ type CheckMetadataDocument = Omit<CheckMetadata, "monitorId" | "teamId"> & {
|
||||
type: MonitorType;
|
||||
};
|
||||
|
||||
type CheckDocumentBase = Omit<
|
||||
Check,
|
||||
"id" | "metadata" | "expiry" | "ackAt" | "createdAt" | "updatedAt"
|
||||
> & {
|
||||
type CheckDocumentBase = Omit<Check, "id" | "metadata" | "expiry" | "ackAt" | "createdAt" | "updatedAt"> & {
|
||||
metadata: CheckMetadataDocument;
|
||||
expiry: Date;
|
||||
ackAt?: Date | null;
|
||||
|
||||
Reference in New Issue
Block a user