This commit is contained in:
Aya Morisawa 2017-02-27 16:50:36 +09:00
parent 3148be7792
commit 7bf27dc4ed
5 changed files with 261 additions and 266 deletions

View File

@ -15,8 +15,7 @@ import Post from '../../models/post';
* @return {Promise<object>} * @return {Promise<object>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'post_id' parameter // Get 'post_id' parameter
let postId = params.post_id; let postId = params.post_id;
if (postId === undefined || postId === null) { if (postId === undefined || postId === null) {
@ -32,7 +31,7 @@ module.exports = (params, user) =>
return rej('post not found'); return rej('post not found');
} }
// Check arleady favorited // Check already favorited
const exist = await Favorite.findOne({ const exist = await Favorite.findOne({
post_id: post._id, post_id: post._id,
user_id: user._id user_id: user._id

View File

@ -15,8 +15,7 @@ import Post from '../../models/post';
* @return {Promise<object>} * @return {Promise<object>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'post_id' parameter // Get 'post_id' parameter
let postId = params.post_id; let postId = params.post_id;
if (postId === undefined || postId === null) { if (postId === undefined || postId === null) {

View File

@ -17,8 +17,7 @@ import notify from '../../../common/notify';
* @return {Promise<object>} * @return {Promise<object>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'post_id' parameter // Get 'post_id' parameter
let postId = params.post_id; let postId = params.post_id;
if (postId === undefined || postId === null) { if (postId === undefined || postId === null) {

View File

@ -17,8 +17,7 @@ import User from '../../../models/user';
* @return {Promise<object>} * @return {Promise<object>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'post_id' parameter // Get 'post_id' parameter
let postId = params.post_id; let postId = params.post_id;
if (postId === undefined || postId === null) { if (postId === undefined || postId === null) {

View File

@ -16,8 +16,7 @@ import notify from '../../../common/notify';
* @return {Promise<object>} * @return {Promise<object>}
*/ */
module.exports = (params, user) => module.exports = (params, user) =>
new Promise(async (res, rej) => new Promise(async (res, rej) => {
{
// Get 'post_id' parameter // Get 'post_id' parameter
const postId = params.post_id; const postId = params.post_id;
if (postId === undefined || postId === null) { if (postId === undefined || postId === null) {