We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e8793f commit c7773f3Copy full SHA for c7773f3
src/db/mongo/pushes.ts
@@ -1,7 +1,7 @@
1
import { connect, findDocuments, findOneDocument } from './helper';
2
import { Action } from '../../proxy/actions';
3
import { toClass } from '../helper';
4
-import * as repo from './repo';
+import * as repo from './repo';
5
import { Push, PushQuery } from '../types';
6
7
const collectionName = 'pushes';
@@ -52,6 +52,9 @@ export const writeAudit = async (action: Action): Promise<Action> => {
52
const options = { upsert: true };
53
const collection = await connect(collectionName);
54
delete data._id;
55
+ if (typeof data.id !== 'string') {
56
+ throw new Error('Invalid id');
57
+ }
58
await collection.updateOne({ id: data.id }, { $set: data }, options);
59
return action;
60
};
0 commit comments