Skip to content

Commit 42be5d0

Browse files
committed
update MongoClientWrapper to TS and update import/export
1 parent 25092dc commit 42be5d0

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

chronos_npm_package/controllers/alert.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ import nodemailer from 'nodemailer';
33

44
// const alert = {};
55

6+
interface SlackSettings {
7+
webhook: any; // possibly 'string'?
8+
}
9+
10+
interface EmailSettings {
11+
emails: string;
12+
emailHost: string;
13+
emailPort: string | number;
14+
user: string;
15+
password: string;
16+
}
17+
18+
interface Alert {
19+
sendSlack: (code: number, message: string, slackSettings: SlackSettings) => void;
20+
sendEmail: (code: number, message: string, emailSettings: EmailSettings) => void;
21+
}
622

723
/**
824
* Sends slack notifications to the provided slackurl with the status code

chronos_npm_package/wrappers/MongoClientWrapper.js renamed to chronos_npm_package/wrappers/MongoClientWrapper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const mongoose = require('mongoose');
2-
const grpc = require('@grpc/grpc-js');
3-
const ComModel = require('../models/CommunicationModel.ts');
1+
import mongoose from 'mongoose';
2+
import grpc from '@grpc/grpc-js';
3+
import ComModel from '../models/CommunicationModel';
44

55
async function connect(URI) {
66
try {
@@ -60,4 +60,4 @@ class ClientWrapper {
6060
}
6161
}
6262

63-
module.exports = ClientWrapper;
63+
export default ClientWrapper;

0 commit comments

Comments
 (0)