update method to post installer

This commit is contained in:
Jacob Overgaard
2022-05-19 10:50:33 +02:00
parent 64fe70d9f9
commit e4b6c825ac
4 changed files with 146 additions and 6 deletions

View File

@@ -99,7 +99,26 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/UmbracoInstaller'
$ref: '#/components/schemas/UmbracoInstallerPerformInstallRequest'
required: true
responses:
'201':
description: 201 response
'400':
description: 400 response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/install/database/validate:
post:
operationId: PostInstallValidateDatabase
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UmbracoInstallerDatabaseConfiguration'
required: true
responses:
'201':
@@ -277,3 +296,45 @@ components:
required:
- installId
- steps
UmbracoInstallerDatabaseConfiguration:
type: object
properties:
connectionString:
type: string
providerName:
type: string
integratedAuth:
type: boolean
databaseProviderMetadataId:
type: string
required:
- connectionString
- providerName
- integratedAuth
- databaseProviderMetadataId
UmbracoInstallerPerformInstallRequest:
type: object
properties:
name:
type: string
email:
type: string
password:
type: string
subscribeToNewsletter:
type: boolean
telemetryLevel:
type: string
enum:
- Minimal
- Basic
- Detailed
database:
$ref: '#/components/schemas/UmbracoInstallerDatabaseConfiguration'
required:
- name
- email
- password
- subscribeToNewsletter
- telemetryLevel
- database

View File

@@ -23,6 +23,9 @@ export interface paths {
get: operations["GetInstall"];
post: operations["PostInstall"];
};
"/install/database/validate": {
post: operations["PostInstallValidateDatabase"];
};
}
export interface components {
@@ -91,6 +94,21 @@ export interface components {
installId: string;
steps: components["schemas"]["UmbracoInstallerStep"][];
};
UmbracoInstallerDatabaseConfiguration: {
connectionString: string;
providerName: string;
integratedAuth: boolean;
databaseProviderMetadataId: string;
};
UmbracoInstallerPerformInstallRequest: {
name: string;
email: string;
password: string;
subscribeToNewsletter: boolean;
/** @enum {string} */
telemetryLevel: "Minimal" | "Basic" | "Detailed";
database: components["schemas"]["UmbracoInstallerDatabaseConfiguration"];
};
};
}
@@ -197,7 +215,25 @@ export interface operations {
};
requestBody: {
content: {
"application/json": components["schemas"]["UmbracoInstaller"];
"application/json": components["schemas"]["UmbracoInstallerPerformInstallRequest"];
};
};
};
PostInstallValidateDatabase: {
parameters: {};
responses: {
/** 201 response */
201: unknown;
/** 400 response */
400: {
content: {
"application/json": components["schemas"]["ErrorResponse"];
};
};
};
requestBody: {
content: {
"application/json": components["schemas"]["UmbracoInstallerDatabaseConfiguration"];
};
};
};

View File

@@ -41,11 +41,23 @@ export class UmbInstallerUser extends LitElement {
this._install(name, email, password, news);
};
private async _install(name: string, email: string, password: string, news: boolean) {
console.log('Installing', name, email, password, news);
private async _install(name: string, email: string, password: string, subscribeToNewsletter: boolean) {
console.log('Installing', name, email, password, subscribeToNewsletter);
try {
await postInstall({});
await postInstall({
name,
email,
password,
telemetryLevel: 'Basic',
subscribeToNewsletter,
database: {
connectionString: '',
databaseProviderMetadataId: '1',
integratedAuth: false,
providerName: 'SQLite'
}
});
// TODO: Change to redirect when router has been added.
this.dispatchEvent(new CustomEvent('install', { bubbles: true, composed: true }));

View File

@@ -17,7 +17,7 @@ export class GetInstall {
})
export class PostInstall {
@request
request(@body body: UmbracoInstaller) { }
request(@body body: UmbracoInstallerPerformInstallRequest) { }
@response({ status: 201 })
success() { }
@@ -26,6 +26,37 @@ export class PostInstall {
badRequest(@body body: ErrorResponse) { }
}
@endpoint({
method: 'POST',
path: '/install/database/validate'
})
export class PostInstallValidateDatabase {
@request
request(@body body: UmbracoInstallerDatabaseConfiguration) { }
@response({ status: 201 })
success() { }
@response({ status: 400 })
badRequest(@body body: ErrorResponse) { }
}
export interface UmbracoInstallerPerformInstallRequest {
name: string;
email: string;
password: string;
subscribeToNewsletter: boolean;
telemetryLevel: 'Minimal' | 'Basic' | 'Detailed';
database: UmbracoInstallerDatabaseConfiguration;
}
export interface UmbracoInstallerDatabaseConfiguration {
connectionString: string;
providerName: string;
integratedAuth: boolean;
databaseProviderMetadataId: string;
}
export interface UmbracoInstaller {
installId: string;
steps: UmbracoInstallerStep[];