Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
les
gancio
Commits
691684d9
Verified
Commit
691684d9
authored
Apr 26, 2021
by
les
Browse files
get all instances for admin in correct order
parent
fe97dda2
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/api/controller/instance.js
View file @
691684d9
const
APUser
=
require
(
'
../models/ap_user
'
)
const
Instance
=
require
(
'
../models/instance
'
)
const
Resource
=
require
(
'
../models/resource
'
)
// const { Op } = require('sequelize')
const
Sequelize
=
require
(
'
sequelize
'
)
const
instancesController
=
{
async
getAll
(
req
,
res
)
{
const
instances
=
await
Instance
.
findAll
({
raw
:
true
})
const
instances
=
await
Instance
.
findAll
({
attributes
:
[
'
domain
'
,
'
name
'
,
'
data
'
,
'
blocked
'
,
[
Sequelize
.
fn
(
'
COUNT
'
,
Sequelize
.
col
(
'
ap_users.ap_id
'
)),
'
users
'
]
],
order
:
[[
Sequelize
.
fn
(
'
COUNT
'
,
Sequelize
.
col
(
'
ap_users.ap_id
'
)),
'
DESC
'
]],
group
:
[
'
instance.domain
'
],
include
:
[{
model
:
APUser
,
attributes
:
[]
}]
})
return
res
.
json
(
instances
)
},
...
...
server/federation/ego.js
View file @
691684d9
...
...
@@ -9,6 +9,7 @@ module.exports = {
log
.
debug
(
`boost
${
match
[
1
]}
`
)
const
event
=
await
Event
.
findByPk
(
Number
(
match
[
1
]))
if
(
!
event
)
{
return
res
.
status
(
404
).
send
(
'
Event not found!
'
)
}
// TODO, has to be unique...
await
event
.
update
({
boost
:
[...
event
.
boost
,
req
.
body
.
actor
]
})
res
.
sendStatus
(
201
)
},
...
...
@@ -28,6 +29,7 @@ module.exports = {
const
event
=
await
Event
.
findByPk
(
Number
(
match
[
1
]))
log
.
debug
(
`
${
req
.
body
.
actor
}
bookmark
${
event
.
title
}
(
${
event
.
likes
.
length
}
)`
)
if
(
!
event
)
{
return
res
.
status
(
404
).
send
(
'
Event not found!
'
)
}
// TODO: has to be unique
await
event
.
update
({
likes
:
[...
event
.
likes
,
req
.
body
.
actor
]
})
res
.
sendStatus
(
201
)
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment