wip
This commit is contained in:
parent
9a282e37be
commit
718060dc85
61 changed files with 132 additions and 119 deletions
|
|
@ -4,7 +4,7 @@
|
|||
import $ from 'cafy';
|
||||
import User from '../../models/user';
|
||||
import Following from '../../models/following';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
import getFriends from '../../common/get-friends';
|
||||
|
||||
/**
|
||||
|
|
@ -82,7 +82,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
|
||||
// Serialize
|
||||
const users = await Promise.all(following.map(async f =>
|
||||
await serialize(f.follower_id, me, { detail: true })));
|
||||
await pack(f.follower_id, me, { detail: true })));
|
||||
|
||||
// Response
|
||||
res({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import $ from 'cafy';
|
||||
import User from '../../models/user';
|
||||
import Following from '../../models/following';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
import getFriends from '../../common/get-friends';
|
||||
|
||||
/**
|
||||
|
|
@ -82,7 +82,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
|
||||
// Serialize
|
||||
const users = await Promise.all(following.map(async f =>
|
||||
await serialize(f.followee_id, me, { detail: true })));
|
||||
await pack(f.followee_id, me, { detail: true })));
|
||||
|
||||
// Response
|
||||
res({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import $ from 'cafy';
|
||||
import Post from '../../models/post';
|
||||
import User from '../../models/user';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
|
||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||
// Get 'user_id' parameter
|
||||
|
|
@ -91,7 +91,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
|
||||
// Make replies object (includes weights)
|
||||
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
|
||||
user: await serialize(user, me, { detail: true }),
|
||||
user: await pack(user, me, { detail: true }),
|
||||
weight: repliedUsers[user] / peak
|
||||
})));
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import $ from 'cafy';
|
||||
import Post from '../../models/post';
|
||||
import User from '../../models/user';
|
||||
import serialize from '../../serializers/post';
|
||||
import { pack } from '../../models/post';
|
||||
|
||||
/**
|
||||
* Get posts of a user
|
||||
|
|
@ -124,6 +124,6 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
|
||||
// Serialize
|
||||
res(await Promise.all(posts.map(async (post) =>
|
||||
await serialize(post, me)
|
||||
await pack(post, me)
|
||||
)));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
const ms = require('ms');
|
||||
import $ from 'cafy';
|
||||
import User from '../../models/user';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
import getFriends from '../../common/get-friends';
|
||||
|
||||
/**
|
||||
|
|
@ -44,5 +44,5 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
|
||||
// Serialize
|
||||
res(await Promise.all(users.map(async user =>
|
||||
await serialize(user, me, { detail: true }))));
|
||||
await pack(user, me, { detail: true }))));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import * as mongo from 'mongodb';
|
||||
import $ from 'cafy';
|
||||
import User from '../../models/user';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
import config from '../../../conf';
|
||||
const escapeRegexp = require('escape-regexp');
|
||||
|
||||
|
|
@ -94,6 +94,6 @@ async function byElasticsearch(res, rej, me, query, offset, max) {
|
|||
|
||||
// Serialize
|
||||
res(await Promise.all(users.map(async user =>
|
||||
await serialize(user, me, { detail: true }))));
|
||||
await pack(user, me, { detail: true }))));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import $ from 'cafy';
|
||||
import User from '../../models/user';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
|
||||
/**
|
||||
* Search a user by username
|
||||
|
|
@ -35,5 +35,5 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
|
||||
// Serialize
|
||||
res(await Promise.all(users.map(async user =>
|
||||
await serialize(user, me, { detail: true }))));
|
||||
await pack(user, me, { detail: true }))));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import $ from 'cafy';
|
||||
import User from '../../models/user';
|
||||
import serialize from '../../serializers/user';
|
||||
import { pack } from '../../models/user';
|
||||
|
||||
/**
|
||||
* Show a user
|
||||
|
|
@ -41,7 +41,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
|||
}
|
||||
|
||||
// Send response
|
||||
res(await serialize(user, me, {
|
||||
res(await pack(user, me, {
|
||||
detail: true
|
||||
}));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue