Fix bug
This commit is contained in:
parent
1d6b2bd969
commit
160185b108
@ -1,15 +1,20 @@
|
|||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import Note from '../../../../models/note';
|
import Note from '../../../../models/note';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
requireAdmin: true
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aggregate notes
|
* Aggregate notes
|
||||||
*/
|
*/
|
||||||
export default (params: any) => new Promise(async (res, rej) => {
|
export default (params: any) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
|
||||||
const [limit = 365, limitErr] = $.num.optional.range(1, 365).get(params.limit);
|
|
||||||
if (limitErr) return rej('invalid limit param');
|
|
||||||
|
|
||||||
const query = [{
|
const query = [{
|
||||||
|
createdAt: {
|
||||||
|
$gt: new Date(new Date().setFullYear(new Date().getFullYear() - 1))
|
||||||
|
}
|
||||||
|
}, {
|
||||||
$project: {
|
$project: {
|
||||||
renoteId: '$renoteId',
|
renoteId: '$renoteId',
|
||||||
replyId: '$replyId',
|
replyId: '$replyId',
|
||||||
@ -84,7 +89,7 @@ export default (params: any) => new Promise(async (res, rej) => {
|
|||||||
|
|
||||||
const graph = [];
|
const graph = [];
|
||||||
|
|
||||||
for (let i = 0; i < limit; i++) {
|
for (let i = 0; i < 365; i++) {
|
||||||
const day = new Date(new Date().setDate(new Date().getDate() - i));
|
const day = new Date(new Date().setDate(new Date().getDate() - i));
|
||||||
|
|
||||||
const data = datas.filter((d: any) =>
|
const data = datas.filter((d: any) =>
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import User from '../../../../models/user';
|
import User from '../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
requireAdmin: true
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aggregate users
|
* Aggregate users
|
||||||
*/
|
*/
|
||||||
export default (params: any) => new Promise(async (res, rej) => {
|
export default (params: any) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
|
||||||
const [limit = 365, limitErr] = $.num.optional.range(1, 365).get(params.limit);
|
|
||||||
if (limitErr) return rej('invalid limit param');
|
|
||||||
|
|
||||||
const query = [{
|
const query = [{
|
||||||
|
createdAt: {
|
||||||
|
$gt: new Date(new Date().setFullYear(new Date().getFullYear() - 1))
|
||||||
|
}
|
||||||
|
}, {
|
||||||
$project: {
|
$project: {
|
||||||
host: '$host',
|
host: '$host',
|
||||||
createdAt: { $add: ['$createdAt', 9 * 60 * 60 * 1000] } // Convert into JST
|
createdAt: { $add: ['$createdAt', 9 * 60 * 60 * 1000] } // Convert into JST
|
||||||
@ -64,7 +69,7 @@ export default (params: any) => new Promise(async (res, rej) => {
|
|||||||
|
|
||||||
const graph = [];
|
const graph = [];
|
||||||
|
|
||||||
for (let i = 0; i < limit; i++) {
|
for (let i = 0; i < 365; i++) {
|
||||||
const day = new Date(new Date().setDate(new Date().getDate() - i));
|
const day = new Date(new Date().setDate(new Date().getDate() - i));
|
||||||
|
|
||||||
const data = datas.filter((d: any) =>
|
const data = datas.filter((d: any) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user