mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
48
server/core/controllers/api/users/my-abuses.ts
Normal file
48
server/core/controllers/api/users/my-abuses.ts
Normal file
|
@ -0,0 +1,48 @@
|
|||
import express from 'express'
|
||||
import { AbuseModel } from '@server/models/abuse/abuse.js'
|
||||
import {
|
||||
abuseListForUserValidator,
|
||||
abusesSortValidator,
|
||||
asyncMiddleware,
|
||||
authenticate,
|
||||
paginationValidator,
|
||||
setDefaultPagination,
|
||||
setDefaultSort
|
||||
} from '../../../middlewares/index.js'
|
||||
|
||||
const myAbusesRouter = express.Router()
|
||||
|
||||
myAbusesRouter.get('/me/abuses',
|
||||
authenticate,
|
||||
paginationValidator,
|
||||
abusesSortValidator,
|
||||
setDefaultSort,
|
||||
setDefaultPagination,
|
||||
abuseListForUserValidator,
|
||||
asyncMiddleware(listMyAbuses)
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
myAbusesRouter
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listMyAbuses (req: express.Request, res: express.Response) {
|
||||
const resultList = await AbuseModel.listForUserApi({
|
||||
start: req.query.start,
|
||||
count: req.query.count,
|
||||
sort: req.query.sort,
|
||||
id: req.query.id,
|
||||
search: req.query.search,
|
||||
state: req.query.state,
|
||||
user: res.locals.oauth.token.User
|
||||
})
|
||||
|
||||
return res.json({
|
||||
total: resultList.total,
|
||||
data: resultList.data.map(d => d.toFormattedUserJSON())
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue