add schema for upgrader

This commit is contained in:
Jacob Overgaard
2022-07-27 13:47:04 +02:00
parent a64512ea01
commit f7848d43b3
3 changed files with 87 additions and 0 deletions

View File

@@ -89,6 +89,35 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/upgrade/settings:
get:
operationId: GetUpgradeSettings
responses:
'200':
description: 200 response
content:
application/json:
schema:
$ref: '#/components/schemas/UpgradeSettingsResponse'
default:
description: default response
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/upgrade/authorize:
post:
operationId: PostUpgradeAuthorize
parameters: []
responses:
'201':
description: 201 response
'400':
description: 400 response
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
/user:
get:
operationId: GetUser
@@ -339,6 +368,25 @@ components:
type: string
required:
- version
UpgradeSettingsResponse:
type: object
properties:
currentState:
type: string
newState:
type: string
newVersion:
type: string
oldVersion:
type: string
reportUrl:
type: string
required:
- currentState
- newState
- newVersion
- oldVersion
- reportUrl
UserResponse:
type: object
properties:

View File

@@ -1,5 +1,6 @@
import './installer';
import './server';
import './upgrader';
import './user';
import { api } from '@airtasker/spot';

View File

@@ -0,0 +1,38 @@
import { body, defaultResponse, endpoint, request, response } from '@airtasker/spot';
import { ProblemDetails } from './models';
@endpoint({
method: 'GET',
path: '/upgrade/settings',
})
export class GetUpgradeSettings {
@response({ status: 200 })
success(@body body: UpgradeSettingsResponse) {}
@defaultResponse
default(@body body: ProblemDetails) {}
}
@endpoint({
method: 'POST',
path: '/upgrade/authorize',
})
export class PostUpgradeAuthorize {
@request
request() {}
@response({ status: 201 })
success() {}
@response({ status: 400 })
badRequest(@body body: ProblemDetails) {}
}
export interface UpgradeSettingsResponse {
currentState: string;
newState: string;
newVersion: string;
oldVersion: string;
reportUrl: string;
}