feat: jsonとform両方で受け付けるように

This commit is contained in:
usbharu 2024-02-21 11:09:36 +09:00
parent d116c5d0a4
commit 079ad108c5
2 changed files with 17 additions and 10 deletions

View File

@ -59,19 +59,19 @@ class MastodonAccountApiController(
HttpStatus.OK
)
override suspend fun apiV1AccountsPost(
username: String,
password: String,
email: String?,
agreement: Boolean?,
locale: Boolean?,
reason: String?
): ResponseEntity<Unit> {
override suspend fun apiV1AccountsPost(accountsCreateRequest: AccountsCreateRequest): ResponseEntity<Unit> {
transaction.transaction {
accountApiService.registerAccount(UserCreateDto(username, username, "", password))
accountApiService.registerAccount(
UserCreateDto(
accountsCreateRequest.username,
accountsCreateRequest.username,
"",
accountsCreateRequest.password
)
)
}
val httpHeaders = HttpHeaders()
httpHeaders.location = URI("/users/$username")
httpHeaders.location = URI("/users/${accountsCreateRequest.username}")
return ResponseEntity(Unit, httpHeaders, HttpStatus.FOUND)
}

View File

@ -276,6 +276,9 @@ paths:
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AccountsCreateRequest"
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/AccountsCreateRequest"
@ -1365,6 +1368,8 @@ components:
properties:
username:
type: string
minLength: 1
pattern: '^[a-zA-Z0-9_-]{1,300}$'
email:
type: string
password:
@ -1399,6 +1404,8 @@ components:
type: string
username:
type: string
minLength: 1
pattern: '^[a-zA-Z0-9_-]{1,300}$'
acct:
type: string
url: