<commit_before>/// <reference path="../../../../typings/bundle.d.ts" />

import APIResponse = require('../../api-response');
import Application = require('../../../models/application');
import User = require('../../../models/user');
import Notice = require('../../../models/notice');

var authorize = require('../../auth');

function api(req: any, res: APIResponse) {
	authorize(req, res,(user: User, app: Application) => {
		if (req.body.notice_id == null) {
			res.apiError(400, 'notice_id parameter is required :(');
			return;
		}
		var noticeId = req.body.notice_id;

		Notice.find(noticeId,(notice: Notice) => {
			if (notice.userId !== user.id) {
				res.apiError(400, '');
				return;
			}
			notice.destroy(() => {
				res.apiRender({
					status: 'success'
				});
			});
		});
	});
}

module.exports = api;<commit_msg>Add error message<commit_after>/// <reference path="../../../../typings/bundle.d.ts" />

import APIResponse = require('../../api-response');
import Application = require('../../../models/application');
import User = require('../../../models/user');
import Notice = require('../../../models/notice');

var authorize = require('../../auth');

function api(req: any, res: APIResponse) {
	authorize(req, res,(user: User, app: Application) => {
		if (req.body.notice_id == null) {
			res.apiError(400, 'notice_id parameter is required :(');
			return;
		}
		var noticeId = req.body.notice_id;

		Notice.find(noticeId,(notice: Notice) => {
			if (notice.userId !== user.id) {
				res.apiError(400, 'Cannot delete The Notification, if it not Addressed to itself');
				return;
			}
			notice.destroy(() => {
				res.apiRender({
					status: 'success'
				});
			});
		});
	});
}

module.exports = api;
{'fraction_non_alphanumeric': 0.2257690075449797, 'fraction_numerical': 0.006964596633778294, 'mean_word_length': 2.990740740740741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '900576', 'n_tokens_mistral': 620, 'n_tokens_neox': 537, 'n_words': 118}