Add openapi doc
This commit is contained in:
parent
d573926e9b
commit
668b7f096e
|
@ -1,4 +1,4 @@
|
||||||
import { AbuseMessageModel } from '@server/models/abuse/abuse-message'
|
import { AccountModel } from '@server/models/account/account'
|
||||||
import { getServerActor } from '@server/models/application/application'
|
import { getServerActor } from '@server/models/application/application'
|
||||||
import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
|
import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
|
||||||
import {
|
import {
|
||||||
|
@ -24,7 +24,6 @@ import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../type
|
||||||
import { isBlockedByServerOrAccount } from './blocklist'
|
import { isBlockedByServerOrAccount } from './blocklist'
|
||||||
import { Emailer } from './emailer'
|
import { Emailer } from './emailer'
|
||||||
import { PeerTubeSocket } from './peertube-socket'
|
import { PeerTubeSocket } from './peertube-socket'
|
||||||
import { AccountModel } from '@server/models/account/account'
|
|
||||||
|
|
||||||
class Notifier {
|
class Notifier {
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ const checkAbuseValidForMessagesValidator = [
|
||||||
const abuse = res.locals.abuse
|
const abuse = res.locals.abuse
|
||||||
if (abuse.ReporterAccount.isOwned() === false) {
|
if (abuse.ReporterAccount.isOwned() === false) {
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
error: 'This abuse was created by a user of your instance.',
|
error: 'This abuse was created by a user of your instance.'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -427,4 +427,3 @@ describe('Test abuses API validators', function () {
|
||||||
await cleanupTests([ server ])
|
await cleanupTests([ server ])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
|
import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
|
||||||
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
|
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
|
||||||
|
import { VideoCommentModel } from '@server/models/video/video-comment'
|
||||||
import { PickWith } from '@shared/core-utils'
|
import { PickWith } from '@shared/core-utils'
|
||||||
import { AbuseModel } from '../../../models/abuse/abuse'
|
import { AbuseModel } from '../../../models/abuse/abuse'
|
||||||
import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl, MAccount } from '../account'
|
import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account'
|
||||||
import { MCommentOwner, MCommentUrl, MVideoUrl, MCommentOwnerVideo, MComment, MCommentVideo } from '../video'
|
import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video'
|
||||||
import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
|
import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'
|
||||||
import { VideoCommentModel } from '@server/models/video/video-comment'
|
|
||||||
|
|
||||||
type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>
|
type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>
|
||||||
type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
|
type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { RegisterServerAuthExternalOptions } from '@server/types'
|
import { RegisterServerAuthExternalOptions } from '@server/types'
|
||||||
import {
|
import {
|
||||||
MAbuse,
|
|
||||||
MAbuseMessage,
|
MAbuseMessage,
|
||||||
|
MAbuseReporter,
|
||||||
MAccountBlocklist,
|
MAccountBlocklist,
|
||||||
MActorUrl,
|
MActorUrl,
|
||||||
MStreamingPlaylist,
|
MStreamingPlaylist,
|
||||||
|
@ -9,8 +9,7 @@ import {
|
||||||
MVideoFile,
|
MVideoFile,
|
||||||
MVideoImmutable,
|
MVideoImmutable,
|
||||||
MVideoPlaylistFull,
|
MVideoPlaylistFull,
|
||||||
MVideoPlaylistFullSummary,
|
MVideoPlaylistFullSummary
|
||||||
MAbuseReporter
|
|
||||||
} from '@server/types/models'
|
} from '@server/types/models'
|
||||||
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
||||||
import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
|
import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
|
||||||
|
|
|
@ -1474,6 +1474,38 @@ paths:
|
||||||
description: HTTP or Torrent/magnetURI import not enabled
|
description: HTTP or Torrent/magnetURI import not enabled
|
||||||
'400':
|
'400':
|
||||||
description: '`magnetUri` or `targetUrl` or a torrent file missing'
|
description: '`magnetUri` or `targetUrl` or a torrent file missing'
|
||||||
|
|
||||||
|
/users/me/abuses:
|
||||||
|
get:
|
||||||
|
summary: List my abuses
|
||||||
|
security:
|
||||||
|
- OAuth2: []
|
||||||
|
tags:
|
||||||
|
- Abuses
|
||||||
|
- My User
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: query
|
||||||
|
description: only list the report with this id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- name: state
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AbuseStateSet'
|
||||||
|
- $ref: '#/components/parameters/start'
|
||||||
|
- $ref: '#/components/parameters/count'
|
||||||
|
- $ref: '#/components/parameters/abusesSort'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Abuse'
|
||||||
|
|
||||||
/abuses:
|
/abuses:
|
||||||
get:
|
get:
|
||||||
summary: List abuses
|
summary: List abuses
|
||||||
|
@ -1501,13 +1533,8 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
- name: state
|
- name: state
|
||||||
in: query
|
in: query
|
||||||
description: 'The abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`)'
|
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
$ref: '#/components/schemas/AbuseStateSet'
|
||||||
enum:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- name: searchReporter
|
- name: searchReporter
|
||||||
in: query
|
in: query
|
||||||
description: only list reports of a specific reporter
|
description: only list reports of a specific reporter
|
||||||
|
@ -1556,7 +1583,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/VideoAbuse'
|
$ref: '#/components/schemas/Abuse'
|
||||||
|
|
||||||
post:
|
post:
|
||||||
summary: Report an abuse
|
summary: Report an abuse
|
||||||
|
@ -1653,6 +1680,61 @@ paths:
|
||||||
description: successful operation
|
description: successful operation
|
||||||
'404':
|
'404':
|
||||||
description: block not found
|
description: block not found
|
||||||
|
'/abuses/{abuseId}/messages':
|
||||||
|
get:
|
||||||
|
summary: List messages of an abuse
|
||||||
|
security:
|
||||||
|
- OAuth2: []
|
||||||
|
tags:
|
||||||
|
- Abuses
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/abuseId'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AbuseMessage'
|
||||||
|
|
||||||
|
post:
|
||||||
|
summary: Add message to an abuse
|
||||||
|
security:
|
||||||
|
- OAuth2: []
|
||||||
|
tags:
|
||||||
|
- Abuses
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
description: Message to send
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- message
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
'400':
|
||||||
|
description: incorrect request parameters
|
||||||
|
'/abuses/{abuseId}/messages/{abuseMessageId}':
|
||||||
|
delete:
|
||||||
|
summary: Delete an abuse message
|
||||||
|
security:
|
||||||
|
- OAuth2: []
|
||||||
|
tags:
|
||||||
|
- Abuses
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/abuseId'
|
||||||
|
- $ref: '#/components/parameters/abuseMessageId'
|
||||||
|
responses:
|
||||||
|
'204':
|
||||||
|
description: successful operation
|
||||||
|
|
||||||
'/videos/{id}/blacklist':
|
'/videos/{id}/blacklist':
|
||||||
post:
|
post:
|
||||||
|
@ -3332,6 +3414,13 @@ components:
|
||||||
description: Abuse id
|
description: Abuse id
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
|
abuseMessageId:
|
||||||
|
name: abuseMessageId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: Abuse message id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
captionLanguage:
|
captionLanguage:
|
||||||
name: captionLanguage
|
name: captionLanguage
|
||||||
in: path
|
in: path
|
||||||
|
@ -3599,7 +3688,7 @@ components:
|
||||||
- 1
|
- 1
|
||||||
- 2
|
- 2
|
||||||
- 3
|
- 3
|
||||||
description: 'The video playlist privacy (Pending = `1`, Rejected = `2`, Accepted = `3`)'
|
description: 'The abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`)'
|
||||||
AbuseStateConstant:
|
AbuseStateConstant:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
|
@ -3960,7 +4049,7 @@ components:
|
||||||
format: date-time
|
format: date-time
|
||||||
video:
|
video:
|
||||||
$ref: '#/components/schemas/Video'
|
$ref: '#/components/schemas/Video'
|
||||||
VideoAbuse:
|
Abuse:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
|
@ -3991,6 +4080,19 @@ components:
|
||||||
createdAt:
|
createdAt:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
|
AbuseMessage:
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
byModerator:
|
||||||
|
type: boolean
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
account:
|
||||||
|
$ref: '#/components/schemas/AccountSummary'
|
||||||
VideoBlacklist:
|
VideoBlacklist:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
|
|
Loading…
Reference in New Issue