[fix] comments/resources

This commit is contained in:
les 2019-12-04 11:58:47 +01:00
parent fbdd0bc27e
commit 6de9ff8f74
2 changed files with 10 additions and 5 deletions

View file

@ -1,8 +1,11 @@
All notable changes to this project will be documented in this file.
### unreleased
### 0.17.11
- [refactor] s/fed_user/ap_user
- [fedi] admin moderation
### 0.17.10
- [refactor] s/comment/resource/
- [refactor] remove `username` field
- [doc] about and federation

View file

@ -1,6 +1,6 @@
const express = require('express')
const router = express.Router()
const { event: Event, user: User, comment: Comment } = require('../api/models')
const { event: Event, user: User, resource: Resource } = require('../api/models')
const cors = require('cors')
const settingsController = require('../api/controller/settings')
const version = require('../../package.json').version
@ -50,6 +50,8 @@ router.get('/webfinger', (req, res) => {
router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
const usersCount = (await User.findAndCountAll()).count
const eventsCount = (await Event.findAndCountAll()).count
const resourcesCount = (await Resource.findAndCountAll()).count
const ret = {
metadata: {
nodeDescription: req.settings.description,
@ -64,7 +66,7 @@ router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
},
version: req.params.nodeinfo_version,
usage: {
localComments: 0,
localComments: resourcesCount,
localPosts: eventsCount,
users: {
total: usersCount
@ -81,7 +83,7 @@ router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
router.get('/x-nodeinfo2', async (req, res) => {
const usersCount = (await User.findAndCountAll()).count
const eventsCount = (await Event.findAndCountAll()).count
const commentsCount = (await Comment.findAndCountAll()).count
const resourcesCount = (await Resource.findAndCountAll()).count
const ret = {
version: '1.0',
@ -98,7 +100,7 @@ router.get('/x-nodeinfo2', async (req, res) => {
total: usersCount
},
localPosts: eventsCount,
localComments: commentsCount
localComments: resourcesCount
}
}
res.json(ret)