move configurations to red-domain

This commit is contained in:
Dan Percic 2021-10-29 14:03:59 +03:00
parent 223399d6eb
commit 8646e9630a
11 changed files with 34 additions and 57 deletions

View File

@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { UserService } from '@services/user.service';
import { SMTPConfiguration } from '@redaction/red-ui-http';
import { ISmtpConfiguration } from '@red/domain';
@Component({
selector: 'redaction-smtp-auth-dialog',
@ -16,7 +16,7 @@ export class SmtpAuthDialogComponent {
private readonly _formBuilder: FormBuilder,
private readonly _userService: UserService,
public dialogRef: MatDialogRef<SmtpAuthDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: SMTPConfiguration,
@Inject(MAT_DIALOG_DATA) public data: ISmtpConfiguration,
) {
this.authForm = this._formBuilder.group({
user: [data?.user || this._userService.currentUser.email, [Validators.required]],

View File

@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AdminDialogService } from '../../services/admin-dialog.service';
import { GeneralConfigurationModel, SMTPConfiguration } from '@redaction/red-ui-http';
import { IGeneralConfiguration, ISmtpConfiguration } from '@red/domain';
import { ConfigService } from '@services/config.service';
import { AutoUnsubscribe, IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
@ -21,8 +21,8 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribe implements OnI
readonly configForm: FormGroup;
readonly smtpForm: FormGroup;
private _initialGeneralConfiguration: GeneralConfigurationModel;
private _initialSMTPConfiguration: SMTPConfiguration;
private _initialGeneralConfiguration: IGeneralConfiguration;
private _initialSMTPConfiguration: ISmtpConfiguration;
constructor(
private readonly _toaster: Toaster,

View File

@ -1,6 +1,6 @@
import { Injectable, Injector } from '@angular/core';
import { GenericService, RequiredParam, Validate } from '@iqser/common-ui';
import { SMTPConfiguration } from '@redaction/red-ui-http';
import { ISmtpConfiguration } from '@red/domain';
@Injectable()
export class SmtpConfigService extends GenericService<unknown> {
@ -9,12 +9,12 @@ export class SmtpConfigService extends GenericService<unknown> {
}
@Validate()
updateSMTPConfiguration(@RequiredParam() body: SMTPConfiguration) {
updateSMTPConfiguration(@RequiredParam() body: ISmtpConfiguration) {
return this._post(body, `${this._defaultModelPath}/smtp`);
}
@Validate()
testSMTPConfiguration(@RequiredParam() body: SMTPConfiguration) {
testSMTPConfiguration(@RequiredParam() body: ISmtpConfiguration) {
return this._post(body, `${this._defaultModelPath}/smtp/test`);
}

View File

@ -1,11 +1,11 @@
import { Injectable, Injector } from '@angular/core';
import { GenericService, RequiredParam, Validate } from '@iqser/common-ui';
import { GeneralConfigurationModel } from '@redaction/red-ui-http';
import { IGeneralConfiguration } from '@red/domain';
@Injectable({
providedIn: 'root',
})
export class GeneralSettingsService extends GenericService<GeneralConfigurationModel> {
export class GeneralSettingsService extends GenericService<IGeneralConfiguration> {
constructor(protected readonly _injector: Injector) {
super(_injector, 'configuration');
}
@ -15,7 +15,7 @@ export class GeneralSettingsService extends GenericService<GeneralConfigurationM
}
@Validate()
updateGeneralConfigurations(@RequiredParam() body: GeneralConfigurationModel) {
updateGeneralConfigurations(@RequiredParam() body: IGeneralConfiguration) {
return this._post<unknown>(body, `${this._defaultModelPath}/general`);
}
}

View File

@ -14,3 +14,4 @@ export * from './lib/file-attributes';
export * from './lib/files';
export * from './lib/downloads';
export * from './lib/reports';
export * from './lib/configuration';

View File

@ -0,0 +1,5 @@
export interface IGeneralConfiguration {
auxiliaryName?: string;
displayName?: string;
forgotPasswordFunctionEnabled?: boolean;
}

View File

@ -0,0 +1,2 @@
export * from './general-configuration';
export * from './smtp-configuration';

View File

@ -0,0 +1,15 @@
export interface ISmtpConfiguration {
auth?: boolean;
envelopeFrom?: string;
from?: string;
fromDisplayName?: string;
host?: string;
id?: string;
password?: string;
port?: number;
replyTo?: string;
replyToDisplayName?: string;
ssl?: boolean;
starttls?: boolean;
user?: string;
}

View File

@ -1,17 +0,0 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface GeneralConfigurationModel {
auxiliaryName?: string;
displayName?: string;
forgotPasswordFunctionEnabled?: boolean;
}

View File

@ -3,10 +3,8 @@ export * from './categoryModel';
export * from './colors';
export * from './digitalSignature';
export * from './digitalSignatureViewModel';
export * from './generalConfigurationModel';
export * from './idRemoval';
export * from './imageRecategorizationRequest';
export * from './placeholdersResponse';
export * from './rules';
export * from './smtp-configuration';
export * from './watermarkModel';

View File

@ -1,27 +0,0 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface SMTPConfiguration {
auth?: boolean;
envelopeFrom?: string;
from?: string;
fromDisplayName?: string;
host?: string;
id?: string;
password?: string;
port?: number;
replyTo?: string;
replyToDisplayName?: string;
ssl?: boolean;
starttls?: boolean;
user?: string;
}