mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
feat: fedi stats api
This commit is contained in:
parent
71e13bd61f
commit
6ce01287e4
1 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
const { APUser, Instance, Resource } = require('../models/models')
|
||||
const { APUser, Instance, Resource, Event } = require('../models/models')
|
||||
const { getActor, unfollowActor, followActor, getNodeInfo, getInstance } = require('../../federation/helpers')
|
||||
const axios = require('axios')
|
||||
const get = require('lodash/get')
|
||||
|
@ -69,6 +69,13 @@ const instancesController = {
|
|||
return res.json(instance)
|
||||
},
|
||||
|
||||
// get following
|
||||
async stats (req, res) {
|
||||
const n_followers = await APUser.count({ where: { follower: true }, include: [Instance]})
|
||||
const n_events = await Event.count({ where: { ap_id: { [Sequelize.Op.not]: null } } })
|
||||
const n_resources = await Resource.count()
|
||||
return res.json({ n_followers, n_events, n_resources })
|
||||
},
|
||||
|
||||
async removeTrust (req, res) {
|
||||
let ap_id = req.query.ap_id
|
||||
|
|
Loading…
Reference in a new issue