|
|
|
@ -113,9 +113,9 @@ export class FieldDto { |
|
|
|
export abstract class FieldPropertiesDto { |
|
|
|
constructor( |
|
|
|
public readonly fieldType: string, |
|
|
|
public readonly label: string, |
|
|
|
public readonly hints: string, |
|
|
|
public readonly placeholder: string, |
|
|
|
public readonly label: string | undefined, |
|
|
|
public readonly hints: string | undefined, |
|
|
|
public readonly placeholder: string | undefined, |
|
|
|
public readonly isRequired: boolean, |
|
|
|
public readonly isListField: boolean, |
|
|
|
public readonly isLocalizable: boolean |
|
|
|
@ -275,7 +275,7 @@ export class SchemasService { |
|
|
|
.catchError('Failed to load schemas. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public getSchema(appName: string, id: string, version: Version): Observable<SchemaDetailsDto> { |
|
|
|
public getSchema(appName: string, id: string, version?: Version): Observable<SchemaDetailsDto> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${id}`); |
|
|
|
|
|
|
|
return this.authService.authGet(url) |
|
|
|
@ -311,7 +311,7 @@ export class SchemasService { |
|
|
|
.catchError('Failed to load schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public postSchema(appName: string, dto: CreateSchemaDto, version: Version): Observable<EntityCreatedDto> { |
|
|
|
public postSchema(appName: string, dto: CreateSchemaDto, version?: Version): Observable<EntityCreatedDto> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas`); |
|
|
|
|
|
|
|
return this.authService.authPost(url, dto, version) |
|
|
|
@ -322,7 +322,7 @@ export class SchemasService { |
|
|
|
.catchError('Failed to create schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public postField(appName: string, schemaName: string, dto: AddFieldDto, version: Version): Observable<EntityCreatedDto> { |
|
|
|
public postField(appName: string, schemaName: string, dto: AddFieldDto, version?: Version): Observable<EntityCreatedDto> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields`); |
|
|
|
|
|
|
|
return this.authService.authPost(url, dto, version) |
|
|
|
@ -333,77 +333,77 @@ export class SchemasService { |
|
|
|
.catchError('Failed to add field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putSchema(appName: string, schemaName: string, dto: UpdateSchemaDto, version: Version): Observable<any> { |
|
|
|
public putSchema(appName: string, schemaName: string, dto: UpdateSchemaDto, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, dto, version) |
|
|
|
.catchError('Failed to update schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putFieldOrdering(appName: string, schemaName: string, dto: number[], version: Version): Observable<any> { |
|
|
|
public putFieldOrdering(appName: string, schemaName: string, dto: number[], version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/ordering`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, { fieldIds: dto }, version) |
|
|
|
.catchError('Failed to reorder fields. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public publishSchema(appName: string, schemaName: string, version: Version): Observable<any> { |
|
|
|
public publishSchema(appName: string, schemaName: string, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/publish`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, {}, version) |
|
|
|
.catchError('Failed to publish schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public unpublishSchema(appName: string, schemaName: string, version: Version): Observable<any> { |
|
|
|
public unpublishSchema(appName: string, schemaName: string, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/unpublish`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, {}, version) |
|
|
|
.catchError('Failed to unpublish schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putField(appName: string, schemaName: string, fieldId: number, dto: UpdateFieldDto, version: Version): Observable<any> { |
|
|
|
public putField(appName: string, schemaName: string, fieldId: number, dto: UpdateFieldDto, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, dto, version) |
|
|
|
.catchError('Failed to update field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public enableField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<any> { |
|
|
|
public enableField(appName: string, schemaName: string, fieldId: number, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/enable`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, {}, version) |
|
|
|
.catchError('Failed to enable field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public disableField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<any> { |
|
|
|
public disableField(appName: string, schemaName: string, fieldId: number, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/disable`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, {}, version) |
|
|
|
.catchError('Failed to disable field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public showField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<any> { |
|
|
|
public showField(appName: string, schemaName: string, fieldId: number, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/show`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, {}, version) |
|
|
|
.catchError('Failed to show field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public hideField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<any> { |
|
|
|
public hideField(appName: string, schemaName: string, fieldId: number, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/hide`); |
|
|
|
|
|
|
|
return this.authService.authPut(url, {}, version) |
|
|
|
.catchError('Failed to hide field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public deleteField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<any> { |
|
|
|
public deleteField(appName: string, schemaName: string, fieldId: number, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}`); |
|
|
|
|
|
|
|
return this.authService.authDelete(url, version) |
|
|
|
.catchError('Failed to delete field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public deleteSchema(appName: string, schemaName: string, version: Version): Observable<any> { |
|
|
|
public deleteSchema(appName: string, schemaName: string, version?: Version): Observable<any> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}`); |
|
|
|
|
|
|
|
return this.authService.authDelete(url, version) |
|
|
|
|