This commit is contained in:
syuilo
2018-06-18 09:54:53 +09:00
parent a766faeae9
commit 80e5645a84
150 changed files with 305 additions and 2334 deletions

View File

@ -1,13 +1,11 @@
/**
* Module dependencies
*/
import $ from 'cafy'; import ID from '../../../../cafy-id';
import Note, { pack } from '../../../../models/note';
import Note, { pack, INote } from '../../../../models/note';
import { ILocalUser } from '../../../../models/user';
/**
* Show conversation of a note
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');
@ -29,10 +27,10 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
return rej('note not found');
}
const conversation = [];
const conversation: INote[] = [];
let i = 0;
async function get(id) {
async function get(id: any) {
i++;
const p = await Note.findOne({ _id: id });