Commit 6de9ff8f authored by les's avatar les
Browse files

[fix] comments/resources

parent fbdd0bc2
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
......
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment