Add v1 audit log backend models and wiring to push secrets

This commit is contained in:
Tuan Dang
2022-12-27 12:12:39 -05:00
parent 019e90dc77
commit 9497a26eb2
26 changed files with 459 additions and 272 deletions
-30
View File
@@ -1,30 +0,0 @@
import { Request, Response } from 'express';
import * as Sentry from '@sentry/node';
import {
Log
} from '../models';
export const getLogs = async (req: Request, res: Response) => {
// get logs
console.log('getLogs');
let logs;
try {
const { workspaceId } = req.params;
logs = await Log.find({
workspace: workspaceId
});
} catch (err) {
Sentry.setUser({ email: req.user.email });
Sentry.captureException(err);
return res.status(400).send({
message: 'Failed to get audit logs'
});
}
return res.status(200).send({
logs
});
}
+1 -3
View File
@@ -14,7 +14,6 @@ import * as stripeController from './stripeController';
import * as userActionController from './userActionController';
import * as userController from './userController';
import * as workspaceController from './workspaceController';
import * as logController from './logController';
export {
authController,
@@ -32,6 +31,5 @@ export {
stripeController,
userActionController,
userController,
workspaceController,
logController
workspaceController
};
@@ -389,7 +389,9 @@ export const pushWorkspaceSecrets = async (req: Request, res: Response) => {
userId: req.user._id,
workspaceId,
environment,
secrets
secrets,
channel: channel ? channel : 'cli',
ipAddress: req.ip
});
await pushKeys({