wip
This commit is contained in:
@ -1,15 +1,13 @@
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
|
||||
import Note from '../../../../../models/note';
|
||||
import create from '../../../../../services/note/reaction/create';
|
||||
import { validateReaction } from '../../../../../models/note-reaction';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
|
||||
/**
|
||||
* React to 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');
|
||||
|
@ -1,14 +1,12 @@
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
|
||||
import Reaction from '../../../../../models/note-reaction';
|
||||
import Note from '../../../../../models/note';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
|
||||
/**
|
||||
* Unreact to 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');
|
||||
@ -45,7 +43,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Send response
|
||||
res();
|
||||
|
||||
const dec = {};
|
||||
const dec: any = {};
|
||||
dec[`reactionCounts.${exist.reaction}`] = -1;
|
||||
|
||||
// Decrement reactions count
|
||||
|
Reference in New Issue
Block a user