Clean up
This commit is contained in:
parent
5e3372e932
commit
26c9d8ff6f
|
@ -2,7 +2,7 @@ import * as mongo from 'mongodb';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
import isObjectId from '../misc/is-objectid';
|
import isObjectId from '../misc/is-objectid';
|
||||||
const deepcopy = require('deepcopy');
|
const deepcopy = require('deepcopy');
|
||||||
import { pack as packUser } from './user';
|
import { pack as packUser, IUser } from './user';
|
||||||
|
|
||||||
const Blocking = db.get<IBlocking>('blocking');
|
const Blocking = db.get<IBlocking>('blocking');
|
||||||
Blocking.createIndex('blockerId');
|
Blocking.createIndex('blockerId');
|
||||||
|
@ -21,7 +21,7 @@ export const packMany = async (
|
||||||
blockings: (string | mongo.ObjectID | IBlocking)[],
|
blockings: (string | mongo.ObjectID | IBlocking)[],
|
||||||
me?: string | mongo.ObjectID | IUser
|
me?: string | mongo.ObjectID | IUser
|
||||||
) => {
|
) => {
|
||||||
return (await Promise.all(blockings.map(x => pack(x, me)))).filter(x => x != null);
|
return (await Promise.all(blockings.map(x => pack(x, me))));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const pack = (
|
export const pack = (
|
||||||
|
|
|
@ -79,7 +79,7 @@ export const packMany = async (
|
||||||
detail: boolean
|
detail: boolean
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
return (await Promise.all(files.map(f => pack(f, options)))).filter(x => x != null);
|
return (await Promise.all(files.map(f => pack(f, options))));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ export const packMany = async (
|
||||||
favorites: any[],
|
favorites: any[],
|
||||||
me: any
|
me: any
|
||||||
) => {
|
) => {
|
||||||
return (await Promise.all(favorites.map(f => pack(f, me)))).filter(x => x != null);
|
return (await Promise.all(favorites.map(f => pack(f, me))));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as mongo from 'mongodb';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
import isObjectId from '../misc/is-objectid';
|
import isObjectId from '../misc/is-objectid';
|
||||||
const deepcopy = require('deepcopy');
|
const deepcopy = require('deepcopy');
|
||||||
import { pack as packUser } from './user';
|
import { pack as packUser, IUser } from './user';
|
||||||
|
|
||||||
const Mute = db.get<IMute>('mute');
|
const Mute = db.get<IMute>('mute');
|
||||||
Mute.createIndex('muterId');
|
Mute.createIndex('muterId');
|
||||||
|
@ -21,7 +21,7 @@ export const packMany = async (
|
||||||
mutes: (string | mongo.ObjectID | IMute)[],
|
mutes: (string | mongo.ObjectID | IMute)[],
|
||||||
me?: string | mongo.ObjectID | IUser
|
me?: string | mongo.ObjectID | IUser
|
||||||
) => {
|
) => {
|
||||||
return (await Promise.all(mutes.map(x => pack(x, me)))).filter(x => x != null);
|
return (await Promise.all(mutes.map(x => pack(x, me))));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const pack = (
|
export const pack = (
|
||||||
|
|
|
@ -172,7 +172,7 @@ export const packMany = async (
|
||||||
skipHide?: boolean;
|
skipHide?: boolean;
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
return (await Promise.all(notes.map(n => pack(n, me, options)))).filter(x => x != null);
|
return (await Promise.all(notes.map(n => pack(n, me, options))));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,7 +54,7 @@ export interface INotification {
|
||||||
export const packMany = async (
|
export const packMany = async (
|
||||||
notifications: any[]
|
notifications: any[]
|
||||||
) => {
|
) => {
|
||||||
return (await Promise.all(notifications.map(n => pack(n)))).filter(x => x != null);
|
return (await Promise.all(notifications.map(n => pack(n))));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue