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

View File

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