Skip to content

Commit bad73ab

Browse files
committed
add missing pieces for media type folders
1 parent 057d090 commit bad73ab

File tree

6 files changed

+41
-2
lines changed

6 files changed

+41
-2
lines changed

src/packages/core/repository/detail/detail-repository-base.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export abstract class UmbDetailRepositoryBase<
2929
) {
3030
super(host);
3131

32+
if (!detailSource) throw new Error('Detail source is missing');
33+
if (!detailStoreContextAlias) throw new Error('Detail store context alias is missing');
34+
3235
this.detailDataSource = new detailSource(host) as UmbDetailDataSourceType;
3336

3437
this.#init = Promise.all([
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const UMB_MEDIA_TYPE_FOLDER_REPOSITORY_ALIAS = 'Umb.Repository.MediaType.Folder';
2+
export const UMB_MEDIA_TYPE_FOLDER_STORE_ALIAS = 'Umb.Store.MediaType.Folder';

src/packages/media/media-types/tree/folder/manifests.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UMB_MEDIA_TYPE_FOLDER_ENTITY_TYPE } from '../../entity.js';
2-
import { UMB_MEDIA_TYPE_FOLDER_REPOSITORY_ALIAS } from './constants.js';
2+
import { UMB_MEDIA_TYPE_FOLDER_REPOSITORY_ALIAS, UMB_MEDIA_TYPE_FOLDER_STORE_ALIAS } from './constants.js';
33

44
export const manifests: Array<UmbExtensionManifest> = [
55
{
@@ -8,6 +8,12 @@ export const manifests: Array<UmbExtensionManifest> = [
88
name: 'Media Type Folder Repository',
99
api: () => import('./media-type-folder.repository.js'),
1010
},
11+
{
12+
type: 'store',
13+
alias: UMB_MEDIA_TYPE_FOLDER_STORE_ALIAS,
14+
name: 'Media Type Folder Store',
15+
api: () => import('./media-type-folder.store.js'),
16+
},
1117
{
1218
type: 'entityAction',
1319
kind: 'folderUpdate',

src/packages/media/media-types/tree/folder/media-type-folder.repository.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { UmbMediaTypeFolderServerDataSource } from './media-type-folder.server.data-source.js';
2+
import { UMB_MEDIA_TYPE_FOLDER_STORE_CONTEXT } from './media-type-folder.store.context-token.js';
23
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
34
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
45
import type { UmbFolderModel } from '@umbraco-cms/backoffice/tree';
56

67
export class UmbMediaTypeFolderRepository extends UmbDetailRepositoryBase<UmbFolderModel> {
78
constructor(host: UmbControllerHost) {
8-
super(host, UmbMediaTypeFolderServerDataSource);
9+
super(host, UmbMediaTypeFolderServerDataSource, UMB_MEDIA_TYPE_FOLDER_STORE_CONTEXT);
910
}
1011
}
1112

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { UmbMediaTypeFolderStore } from './media-type-folder.store.js';
2+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
3+
4+
export const UMB_MEDIA_TYPE_FOLDER_STORE_CONTEXT = new UmbContextToken<UmbMediaTypeFolderStore>(
5+
'UmbMediaTypeFolderStore',
6+
);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { UMB_MEDIA_TYPE_FOLDER_STORE_CONTEXT } from './media-type-folder.store.context-token.js';
2+
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
3+
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
4+
import type { UmbFolderModel } from '@umbraco-cms/backoffice/tree';
5+
6+
/**
7+
* @class UmbMediaTypeStore
8+
* @augments {UmbStoreBase}
9+
* @description - Data Store for Media Types
10+
*/
11+
export class UmbMediaTypeFolderStore extends UmbDetailStoreBase<UmbFolderModel> {
12+
/**
13+
* Creates an instance of UmbMediaTypeStore.
14+
* @param {UmbControllerHost} host - The controller host for this controller to be appended to
15+
* @memberof UmbMediaTypeStore
16+
*/
17+
constructor(host: UmbControllerHost) {
18+
super(host, UMB_MEDIA_TYPE_FOLDER_STORE_CONTEXT.toString());
19+
}
20+
}
21+
22+
export { UmbMediaTypeFolderStore as api };

0 commit comments

Comments
 (0)