mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 12:39:59 +01:00
done
This commit is contained in:
parent
d7875cc0fe
commit
7a472760cd
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import Post from '../../../models/post';
|
import Post from '../../../models/post';
|
||||||
import Like from '../../../models/like';
|
import Like from '../../../models/like';
|
||||||
|
|
||||||
@ -17,14 +17,12 @@ module.exports = (params) =>
|
|||||||
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, postIdErr] = it(params.post_id).expect.id().required().qed();
|
||||||
if (postId === undefined || postId === null) {
|
if (postIdErr) return rej('invalid post_id param');
|
||||||
return rej('post_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup post
|
// Lookup post
|
||||||
const post = await Post.findOne({
|
const post = await Post.findOne({
|
||||||
_id: new mongo.ObjectID(postId)
|
_id: postId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (post === null) {
|
if (post === null) {
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import Post from '../../../models/post';
|
import Post from '../../../models/post';
|
||||||
import Like from '../../../models/like';
|
import Like from '../../../models/like';
|
||||||
|
|
||||||
@ -17,14 +17,12 @@ module.exports = (params) =>
|
|||||||
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, postIdErr] = it(params.post_id).expect.id().required().qed();
|
||||||
if (postId === undefined || postId === null) {
|
if (postIdErr) return rej('invalid post_id param');
|
||||||
return rej('post_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup post
|
// Lookup post
|
||||||
const post = await Post.findOne({
|
const post = await Post.findOne({
|
||||||
_id: new mongo.ObjectID(postId)
|
_id: postId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (post === null) {
|
if (post === null) {
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import Post from '../../../models/post';
|
import Post from '../../../models/post';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,14 +16,12 @@ module.exports = (params) =>
|
|||||||
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, postIdErr] = it(params.post_id).expect.id().required().qed();
|
||||||
if (postId === undefined || postId === null) {
|
if (postIdErr) return rej('invalid post_id param');
|
||||||
return rej('post_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup post
|
// Lookup post
|
||||||
const post = await Post.findOne({
|
const post = await Post.findOne({
|
||||||
_id: new mongo.ObjectID(postId)
|
_id: postId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (post === null) {
|
if (post === null) {
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import Post from '../../../models/post';
|
import Post from '../../../models/post';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,14 +16,12 @@ module.exports = (params) =>
|
|||||||
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, postIdErr] = it(params.post_id).expect.id().required().qed();
|
||||||
if (postId === undefined || postId === null) {
|
if (postIdErr) return rej('invalid post_id param');
|
||||||
return rej('post_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup post
|
// Lookup post
|
||||||
const post = await Post.findOne({
|
const post = await Post.findOne({
|
||||||
_id: new mongo.ObjectID(postId)
|
_id: postId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (post === null) {
|
if (post === null) {
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
import Following from '../../../models/following';
|
import Following from '../../../models/following';
|
||||||
|
|
||||||
@ -17,14 +17,12 @@ module.exports = (params) =>
|
|||||||
new Promise(async (res, rej) =>
|
new Promise(async (res, rej) =>
|
||||||
{
|
{
|
||||||
// Get 'user_id' parameter
|
// Get 'user_id' parameter
|
||||||
const userId = params.user_id;
|
const [userId, userIdErr] = it(params.user_id).expect.id().required().qed();
|
||||||
if (userId === undefined || userId === null) {
|
if (userIdErr) return rej('invalid user_id param');
|
||||||
return rej('user_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
_id: new mongo.ObjectID(userId)
|
_id: userId
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
_id: true
|
_id: true
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
import Following from '../../../models/following';
|
import Following from '../../../models/following';
|
||||||
|
|
||||||
@ -17,14 +17,12 @@ module.exports = (params) =>
|
|||||||
new Promise(async (res, rej) =>
|
new Promise(async (res, rej) =>
|
||||||
{
|
{
|
||||||
// Get 'user_id' parameter
|
// Get 'user_id' parameter
|
||||||
const userId = params.user_id;
|
const [userId, userIdErr] = it(params.user_id).expect.id().required().qed();
|
||||||
if (userId === undefined || userId === null) {
|
if (userIdErr) return rej('invalid user_id param');
|
||||||
return rej('user_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
_id: new mongo.ObjectID(userId)
|
_id: userId
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
_id: true
|
_id: true
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
import Like from '../../../models/like';
|
import Like from '../../../models/like';
|
||||||
|
|
||||||
@ -17,14 +17,12 @@ module.exports = (params) =>
|
|||||||
new Promise(async (res, rej) =>
|
new Promise(async (res, rej) =>
|
||||||
{
|
{
|
||||||
// Get 'user_id' parameter
|
// Get 'user_id' parameter
|
||||||
const userId = params.user_id;
|
const [userId, userIdErr] = it(params.user_id).expect.id().required().qed();
|
||||||
if (userId === undefined || userId === null) {
|
if (userIdErr) return rej('invalid user_id param');
|
||||||
return rej('user_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
_id: new mongo.ObjectID(userId)
|
_id: userId
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
_id: true
|
_id: true
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as mongo from 'mongodb';
|
import it from '../../../it';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
import Post from '../../../models/post';
|
import Post from '../../../models/post';
|
||||||
|
|
||||||
@ -17,14 +17,12 @@ module.exports = (params) =>
|
|||||||
new Promise(async (res, rej) =>
|
new Promise(async (res, rej) =>
|
||||||
{
|
{
|
||||||
// Get 'user_id' parameter
|
// Get 'user_id' parameter
|
||||||
const userId = params.user_id;
|
const [userId, userIdErr] = it(params.user_id).expect.id().required().qed();
|
||||||
if (userId === undefined || userId === null) {
|
if (userIdErr) return rej('invalid user_id param');
|
||||||
return rej('user_id is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
_id: new mongo.ObjectID(userId)
|
_id: userId
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
_id: true
|
_id: true
|
Loading…
Reference in New Issue
Block a user