Make subscription_type, username, and years optional on POST /v1/admin/users

- subscription_type defaults to lifetime when omitted; validated when provided
- years is only required (and enforced) when subscription_type is yearly
- username uniqueness check and validation are skipped when username is empty
- Update OpenAPI spec to reflect pubkey as the only required field
This commit is contained in:
2026-05-05 04:02:36 +00:00
parent 611ef5fc4a
commit 14fcce50af
3 changed files with 20 additions and 12 deletions

View File

@@ -222,12 +222,12 @@ paths:
application/json:
schema:
type: object
required: [pubkey, username, subscription_type]
required: [pubkey]
properties:
pubkey: { type: string }
username: { type: string }
subscription_type: { type: string, enum: [yearly, lifetime] }
years: { type: integer }
username: { type: string, description: "Optional NIP-05 username to assign" }
subscription_type: { type: string, enum: [yearly, lifetime], description: "Defaults to lifetime when omitted" }
years: { type: integer, description: "Required when subscription_type is yearly" }
responses:
'201':
description: Created