make detail interfaces extend read interface

This commit is contained in:
Mads Rasmussen
2024-03-22 14:24:52 +01:00
parent 6c857e8bf7
commit 5ee080d41e
3 changed files with 5 additions and 12 deletions

View File

@@ -1,14 +1,14 @@
import type { UmbDataSourceResponse } from '../data-source-response.interface.js';
import type { UmbReadDetailDataSource } from './read/index.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export interface UmbDetailDataSourceConstructor<DetailType = any> {
new (host: UmbControllerHost): UmbDetailDataSource<DetailType>;
}
export interface UmbDetailDataSource<DetailType> {
export interface UmbDetailDataSource<DetailType> extends UmbReadDetailDataSource<DetailType> {
createScaffold(preset?: Partial<DetailType>): Promise<UmbDataSourceResponse<DetailType>>;
create(data: DetailType, parentUnique: string | null): Promise<UmbDataSourceResponse<DetailType>>;
read(unique: string): Promise<UmbDataSourceResponse<DetailType>>;
update(data: DetailType): Promise<UmbDataSourceResponse<DetailType>>;
delete(unique: string): Promise<UmbDataSourceResponse>;
}

View File

@@ -1,15 +1,9 @@
import type {
UmbRepositoryErrorResponse,
UmbRepositoryResponse,
UmbRepositoryResponseWithAsObservable,
} from '../types.js';
import type { UmbRepositoryErrorResponse, UmbRepositoryResponse } from '../types.js';
import type { UmbReadDetailRepository } from './read/index.js';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
export interface UmbDetailRepository<DetailModelType> extends UmbApi {
export interface UmbDetailRepository<DetailModelType> extends UmbReadDetailRepository<DetailModelType>, UmbApi {
createScaffold(preset?: Partial<DetailModelType>): Promise<UmbRepositoryResponse<DetailModelType>>;
requestByUnique(unique: string): Promise<UmbRepositoryResponseWithAsObservable<DetailModelType>>;
byUnique(unique: string): Promise<Observable<DetailModelType | undefined>>;
create(data: DetailModelType, parentUnique: string | null): Promise<UmbRepositoryResponse<DetailModelType>>;
save(data: DetailModelType): Promise<UmbRepositoryResponse<DetailModelType>>;
delete(unique: string): Promise<UmbRepositoryErrorResponse>;

View File

@@ -32,7 +32,6 @@ export class UmbRelationTypeDetailRepository
* @memberof UmbDetailRepositoryBase
*/
async requestByUnique(unique: string) {
debugger;
if (!unique) throw new Error('Unique is missing');
await this.#init;