Update mongodb
This commit is contained in:
parent
d32b2a8ce5
commit
9427a756c9
31 changed files with 83 additions and 52 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import * as mongo from 'mongodb';
|
||||
const deepcopy = require('deepcopy');
|
||||
import db from '../db/mongodb';
|
||||
import isObjectId from '../misc/is-objectid';
|
||||
import { pack as packUser } from './user';
|
||||
|
||||
const FollowRequest = db.get<IFollowRequest>('followRequests');
|
||||
|
|
@ -34,7 +35,7 @@ export async function deleteFollowRequest(followRequest: string | mongo.ObjectID
|
|||
let f: IFollowRequest;
|
||||
|
||||
// Populate
|
||||
if (mongo.ObjectID.prototype.isPrototypeOf(followRequest)) {
|
||||
if (isObjectId(followRequest)) {
|
||||
f = await FollowRequest.findOne({
|
||||
_id: followRequest
|
||||
});
|
||||
|
|
@ -64,7 +65,7 @@ export const pack = (
|
|||
let _request: any;
|
||||
|
||||
// Populate the request if 'request' is ID
|
||||
if (mongo.ObjectID.prototype.isPrototypeOf(request)) {
|
||||
if (isObjectId(request)) {
|
||||
_request = await FollowRequest.findOne({
|
||||
_id: request
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue