summaryrefslogtreecommitdiff
path: root/src/api/endpoints/users
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-02 08:21:30 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-02 08:21:30 +0900
commit718060dc855e09f270b8e19c089ed3c3743665e0 (patch)
tree334ea8c7dcd04153da311cf6073407f6f14eb423 /src/api/endpoints/users
parentwip (diff)
downloadsharkey-718060dc855e09f270b8e19c089ed3c3743665e0.tar.gz
sharkey-718060dc855e09f270b8e19c089ed3c3743665e0.tar.bz2
sharkey-718060dc855e09f270b8e19c089ed3c3743665e0.zip
wip
Diffstat (limited to 'src/api/endpoints/users')
-rw-r--r--src/api/endpoints/users/followers.ts4
-rw-r--r--src/api/endpoints/users/following.ts4
-rw-r--r--src/api/endpoints/users/get_frequently_replied_users.ts4
-rw-r--r--src/api/endpoints/users/posts.ts4
-rw-r--r--src/api/endpoints/users/recommendation.ts4
-rw-r--r--src/api/endpoints/users/search.ts4
-rw-r--r--src/api/endpoints/users/search_by_username.ts4
-rw-r--r--src/api/endpoints/users/show.ts4
8 files changed, 16 insertions, 16 deletions
diff --git a/src/api/endpoints/users/followers.ts b/src/api/endpoints/users/followers.ts
index 4905323ba5..b0fb83c683 100644
--- a/src/api/endpoints/users/followers.ts
+++ b/src/api/endpoints/users/followers.ts
@@ -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({
diff --git a/src/api/endpoints/users/following.ts b/src/api/endpoints/users/following.ts
index dc2ff49bbe..8e88431e92 100644
--- a/src/api/endpoints/users/following.ts
+++ b/src/api/endpoints/users/following.ts
@@ -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({
diff --git a/src/api/endpoints/users/get_frequently_replied_users.ts b/src/api/endpoints/users/get_frequently_replied_users.ts
index a8add623d4..3cbc761322 100644
--- a/src/api/endpoints/users/get_frequently_replied_users.ts
+++ b/src/api/endpoints/users/get_frequently_replied_users.ts
@@ -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
})));
diff --git a/src/api/endpoints/users/posts.ts b/src/api/endpoints/users/posts.ts
index 0d8384a43d..1f3db3cf79 100644
--- a/src/api/endpoints/users/posts.ts
+++ b/src/api/endpoints/users/posts.ts
@@ -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)
)));
});
diff --git a/src/api/endpoints/users/recommendation.ts b/src/api/endpoints/users/recommendation.ts
index 731d68a7b1..b80fd63ce7 100644
--- a/src/api/endpoints/users/recommendation.ts
+++ b/src/api/endpoints/users/recommendation.ts
@@ -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 }))));
});
diff --git a/src/api/endpoints/users/search.ts b/src/api/endpoints/users/search.ts
index 73a5db47e2..213038403b 100644
--- a/src/api/endpoints/users/search.ts
+++ b/src/api/endpoints/users/search.ts
@@ -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 }))));
});
}
diff --git a/src/api/endpoints/users/search_by_username.ts b/src/api/endpoints/users/search_by_username.ts
index 7f2f42f0a6..63e206b1f2 100644
--- a/src/api/endpoints/users/search_by_username.ts
+++ b/src/api/endpoints/users/search_by_username.ts
@@ -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 }))));
});
diff --git a/src/api/endpoints/users/show.ts b/src/api/endpoints/users/show.ts
index 8e74b0fe3f..a51cb619d4 100644
--- a/src/api/endpoints/users/show.ts
+++ b/src/api/endpoints/users/show.ts
@@ -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
}));
});