From 7ed0d7a273b1465b27dc5eb3f4543efa0df36567 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Wed, 29 May 2024 10:39:08 +0200
Subject: [PATCH] OZG-5012 PoC List Resource create on wiedervorlage list

---
 .../lib/admin-settings-resource.service.ts    |   3 +-
 .../src/lib/admin-settings.module.ts          |   2 +
 .../src/lib/admin-settings.state.ts           |  20 +++
 .../configuration-resource.service.ts         |   2 +-
 .../lib/configuration/configuration.state.ts  |   2 +-
 .../src/lib/postfach/postfach.state.ts        |   2 +-
 .../src/lib/+state/bescheid.reducer.ts        |   4 +-
 .../src/lib/bescheid.service.ts               |  11 +-
 alfa-client/libs/command-shared/src/index.ts  |   1 +
 .../src/lib/command-list-resource.service.ts  | 106 ++++++++++++++++
 alfa-client/libs/tech-shared/src/index.ts     |   2 +-
 .../libs/tech-shared/src/lib/ngrx/actions.ts  |  43 ++++---
 .../src/lib/ngrx/del.reducer.service.ts       |   2 +-
 .../src/lib/ngrx/resource.loader.ts           |   4 +-
 ...esource.reducer.ts => resource.reducer.ts} | 118 ++++++++++--------
 .../src/lib/ngrx/resource.selector.ts         |  17 +--
 .../src/lib/ngrx/resource.state.service.ts    |   6 +-
 .../src/lib/resource/list-resource.service.ts |  16 ++-
 .../src/lib/resource/resource.model.ts        |   2 +-
 ...aktenzeichen-edit-dialog.component.spec.ts |  34 ++---
 .../aktenzeichen-editable.component.spec.ts   |  15 ++-
 .../vorgang-detail-header.component.spec.ts   |   2 +-
 .../wiedervorlage-list-resource.service.ts    |  38 ++++++
 .../src/lib/wiedervorlage-shared.module.ts    |   4 +-
 .../src/lib/wiedervorlage.service.ts          |  11 +-
 .../src/lib/wiedervorlage.state.ts            |  17 +++
 .../src/lib/wiedervorlage.module.ts           |   8 +-
 .../alfa/common/command/CommandBody.java      |   1 +
 .../WiedervorlageCommandController.java       |   5 +-
 29 files changed, 351 insertions(+), 147 deletions(-)
 create mode 100644 alfa-client/libs/admin-settings/src/lib/admin-settings.state.ts
 create mode 100644 alfa-client/libs/command-shared/src/lib/command-list-resource.service.ts
 rename alfa-client/libs/tech-shared/src/lib/ngrx/{del.resource.reducer.ts => resource.reducer.ts} (52%)
 create mode 100644 alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-list-resource.service.ts
 create mode 100644 alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.state.ts

diff --git a/alfa-client/libs/admin-settings/src/lib/admin-settings-resource.service.ts b/alfa-client/libs/admin-settings/src/lib/admin-settings-resource.service.ts
index 16d26ceec2..96cf404829 100644
--- a/alfa-client/libs/admin-settings/src/lib/admin-settings-resource.service.ts
+++ b/alfa-client/libs/admin-settings/src/lib/admin-settings-resource.service.ts
@@ -6,6 +6,7 @@ import {
 import { Resource } from '@ngxp/rest';
 import { SettingListLinkRel } from './admin-settings.linkrel';
 import { SettingItemResource, SettingListResource } from './admin-settings.model';
+import { SETTING_FEATURE_KEY, SETTING_LIST_PATH } from './admin-settings.state';
 import { ConfigurationLinkRel } from './configuration/configuration.linkrel';
 import { ConfigurationResource } from './configuration/configuration.model';
 import { ConfigurationService } from './configuration/configuration.service';
@@ -26,7 +27,7 @@ function buildConfig(
   configurationService: ConfigurationService,
 ): ListResourceServiceConfig<ConfigurationResource> {
   return {
-    stateInfo: { name: 'SettingState', featureName: 'settingList' },
+    stateInfo: { name: SETTING_FEATURE_KEY, path: SETTING_LIST_PATH },
     baseResource: configurationService.get(),
     createLinkRel: SettingListLinkRel.CREATE,
     getLinkRel: ConfigurationLinkRel.SETTING,
diff --git a/alfa-client/libs/admin-settings/src/lib/admin-settings.module.ts b/alfa-client/libs/admin-settings/src/lib/admin-settings.module.ts
index ddb76b52e8..380a7a84aa 100644
--- a/alfa-client/libs/admin-settings/src/lib/admin-settings.module.ts
+++ b/alfa-client/libs/admin-settings/src/lib/admin-settings.module.ts
@@ -13,6 +13,7 @@ import {
   SettingListResourceService,
 } from './admin-settings-resource.service';
 import { SettingsService } from './admin-settings.service';
+import { SETTING_FEATURE_KEY, settingReducers } from './admin-settings.state';
 import {
   ConfigurationResourceService,
   createConfigurationResourceService,
@@ -69,6 +70,7 @@ import { TextFieldComponent } from './shared/text-field/text-field.component';
     ReactiveFormsModule,
     StoreModule.forFeature(CONFIGURATION_FEATURE_KEY, configurationReducers),
     StoreModule.forFeature(POSTFACH_FEATURE_KEY, postfachReducers),
+    StoreModule.forFeature(SETTING_FEATURE_KEY, settingReducers),
   ],
   exports: [
     PostfachContainerComponent,
diff --git a/alfa-client/libs/admin-settings/src/lib/admin-settings.state.ts b/alfa-client/libs/admin-settings/src/lib/admin-settings.state.ts
new file mode 100644
index 0000000000..cdcf69b425
--- /dev/null
+++ b/alfa-client/libs/admin-settings/src/lib/admin-settings.state.ts
@@ -0,0 +1,20 @@
+import {
+  ListResourceReducer,
+  ListResourceState,
+  createListResourceActions,
+} from '@alfa-client/tech-shared';
+import { Action, ActionReducerMap } from '@ngrx/store';
+
+export const SETTING_FEATURE_KEY = 'SettingState';
+
+export const SETTING_LIST_PATH = 'settingList';
+
+export function settingListResourceReducer(state: ListResourceState, action: Action) {
+  const resourceReducer: ListResourceReducer = new ListResourceReducer(
+    createListResourceActions({ name: SETTING_FEATURE_KEY, path: SETTING_LIST_PATH }),
+  );
+  return resourceReducer.reducer(state, action);
+}
+export const settingReducers: ActionReducerMap<any> = {
+  [SETTING_LIST_PATH]: settingListResourceReducer,
+};
diff --git a/alfa-client/libs/admin-settings/src/lib/configuration/configuration-resource.service.ts b/alfa-client/libs/admin-settings/src/lib/configuration/configuration-resource.service.ts
index 51fcf93f8a..36dc80f507 100644
--- a/alfa-client/libs/admin-settings/src/lib/configuration/configuration-resource.service.ts
+++ b/alfa-client/libs/admin-settings/src/lib/configuration/configuration-resource.service.ts
@@ -25,7 +25,7 @@ function buildConfig(apiRootService: ApiRootService): ResourceServiceConfig<ApiR
   return {
     stateInfo: {
       name: CONFIGURATION_FEATURE_KEY,
-      featureName: CONFIGURATION_PATH,
+      path: CONFIGURATION_PATH,
     },
     baseResource: apiRootService.getApiRoot(),
     getLinkRel: ApiRootLinkRel.CONFIGURATION,
diff --git a/alfa-client/libs/admin-settings/src/lib/configuration/configuration.state.ts b/alfa-client/libs/admin-settings/src/lib/configuration/configuration.state.ts
index c2c220bc4a..a81bde1ea3 100644
--- a/alfa-client/libs/admin-settings/src/lib/configuration/configuration.state.ts
+++ b/alfa-client/libs/admin-settings/src/lib/configuration/configuration.state.ts
@@ -11,7 +11,7 @@ export const CONFIGURATION_PATH = 'configuration';
 
 export function configurationResourceReducer(state: ListResourceState, action: Action) {
   const resourceReducer: ListResourceReducer = new ListResourceReducer(
-    createListResourceActions({ name: CONFIGURATION_FEATURE_KEY, featureName: CONFIGURATION_PATH }),
+    createListResourceActions({ name: CONFIGURATION_FEATURE_KEY, path: CONFIGURATION_PATH }),
   );
   return resourceReducer.reducer(state, action);
 }
diff --git a/alfa-client/libs/admin-settings/src/lib/postfach/postfach.state.ts b/alfa-client/libs/admin-settings/src/lib/postfach/postfach.state.ts
index cb02408678..7e34ebbde7 100644
--- a/alfa-client/libs/admin-settings/src/lib/postfach/postfach.state.ts
+++ b/alfa-client/libs/admin-settings/src/lib/postfach/postfach.state.ts
@@ -11,7 +11,7 @@ export const POSTFACH_PATH = 'postfach';
 
 export function postfachResourceReducer(state: SingleResourceState, action: Action) {
   const resourceReducer: SingleResourceReducer = new SingleResourceReducer(
-    createSingleResourceActions({ name: POSTFACH_FEATURE_KEY, featureName: POSTFACH_PATH }),
+    createSingleResourceActions({ name: POSTFACH_FEATURE_KEY, path: POSTFACH_PATH }),
   );
   return resourceReducer.reducer(state, action);
 }
diff --git a/alfa-client/libs/bescheid-shared/src/lib/+state/bescheid.reducer.ts b/alfa-client/libs/bescheid-shared/src/lib/+state/bescheid.reducer.ts
index 8d0c95be8f..689bb74c77 100644
--- a/alfa-client/libs/bescheid-shared/src/lib/+state/bescheid.reducer.ts
+++ b/alfa-client/libs/bescheid-shared/src/lib/+state/bescheid.reducer.ts
@@ -80,14 +80,14 @@ export const reducers: ActionReducerMap<any> = {
 
 function bescheidDraftResourceReducer(state: BescheidState, action: Action) {
   const resourceReducer: SingleResourceReducer = new SingleResourceReducer(
-    createSingleResourceActions({ name: BESCHEID_FEATURE_KEY, featureName: BESCHEID_DRAFT_PATH }),
+    createSingleResourceActions({ name: BESCHEID_FEATURE_KEY, path: BESCHEID_DRAFT_PATH }),
   );
   return resourceReducer.reducer(state, action);
 }
 
 function bescheidListResourceReducer(state: BescheidState, action: Action) {
   const resourceReducer: ListResourceReducer = new ListResourceReducer(
-    createListResourceActions({ name: BESCHEID_FEATURE_KEY, featureName: BESCHEID_LIST_PATH }),
+    createListResourceActions({ name: BESCHEID_FEATURE_KEY, path: BESCHEID_LIST_PATH }),
   );
   return resourceReducer.reducer(state, action);
 }
diff --git a/alfa-client/libs/bescheid-shared/src/lib/bescheid.service.ts b/alfa-client/libs/bescheid-shared/src/lib/bescheid.service.ts
index 46e1442dc3..f66c35f105 100644
--- a/alfa-client/libs/bescheid-shared/src/lib/bescheid.service.ts
+++ b/alfa-client/libs/bescheid-shared/src/lib/bescheid.service.ts
@@ -10,10 +10,10 @@ import {
   CommandService,
   getEffectedResourceUrl,
   tapOnCommandSuccessfullyDone,
+  CommandListResourceService
 } from '@alfa-client/command-shared';
 import {
   HttpError,
-  ResourceListService,
   StateResource,
   createEmptyStateResource,
   createStateResource,
@@ -77,7 +77,7 @@ import { DocumentResource } from './document.model';
 @Injectable({ providedIn: 'root' })
 export class BescheidService {
   bescheidDraftService: CommandResourceService<VorgangWithEingangResource, BescheidResource>;
-  bescheidListService: ResourceListService<
+  bescheidListService: CommandListResourceService<
     VorgangWithEingangResource,
     BescheidListResource,
     BescheidResource
@@ -118,9 +118,10 @@ export class BescheidService {
       this.stateService,
       this.commandService,
     );
-    this.bescheidListService = new ResourceListService(
+    this.bescheidListService = new CommandListResourceService(
       this.buildBescheidListServiceConfig(),
       this.stateService,
+      this.commandService,
     );
   }
 
@@ -128,7 +129,7 @@ export class BescheidService {
     return {
       stateInfo: {
         name: BESCHEID_FEATURE_KEY,
-        featureName: BESCHEID_DRAFT_PATH,
+        path: BESCHEID_DRAFT_PATH,
       },
       baseResource: this.vorgangService.getVorgangWithEingang(),
       getLinkRel: VorgangWithEingangLinkRel.BESCHEID_DRAFT,
@@ -141,7 +142,7 @@ export class BescheidService {
     return {
       stateInfo: {
         name: BESCHEID_FEATURE_KEY,
-        featureName: BESCHEID_LIST_PATH,
+        path: BESCHEID_LIST_PATH,
       },
       baseResource: this.vorgangService.getVorgangWithEingang(),
       getLinkRel: VorgangWithEingangLinkRel.BESCHEIDE,
diff --git a/alfa-client/libs/command-shared/src/index.ts b/alfa-client/libs/command-shared/src/index.ts
index ebafbac511..1f89975aca 100644
--- a/alfa-client/libs/command-shared/src/index.ts
+++ b/alfa-client/libs/command-shared/src/index.ts
@@ -22,6 +22,7 @@
  * unter der Lizenz sind dem Lizenztext zu entnehmen.
  */
 export * from './lib/+state/command.actions';
+export * from './lib/command-list-resource.service';
 export * from './lib/command-resource.service';
 export * from './lib/command-shared.module';
 export * from './lib/command.linkrel';
diff --git a/alfa-client/libs/command-shared/src/lib/command-list-resource.service.ts b/alfa-client/libs/command-shared/src/lib/command-list-resource.service.ts
new file mode 100644
index 0000000000..af377e2b26
--- /dev/null
+++ b/alfa-client/libs/command-shared/src/lib/command-list-resource.service.ts
@@ -0,0 +1,106 @@
+import {
+  ListItemResource,
+  ListResource,
+  ListResourceServiceConfig,
+  ResourceListService,
+  StateResource,
+  createEmptyStateResource,
+} from '@alfa-client/tech-shared';
+import { Resource } from '@ngxp/rest';
+import { StateService } from 'libs/tech-shared/src/lib/ngrx/resource.state.service';
+import { Observable, startWith, switchMap } from 'rxjs';
+import { CommandResource, CreateCommandProps } from './command.model';
+import { CommandService } from './command.service';
+
+export class CommandListResourceService<
+  B extends Resource,
+  T extends ListResource,
+  I extends ListItemResource,
+> extends ResourceListService<B, T, I> {
+  constructor(
+    protected config: ListResourceServiceConfig<B>,
+    protected stateService: StateService,
+    private commandService: CommandService,
+  ) {
+    super(config, stateService);
+  }
+
+  public create(props: CreateCommandProps): Observable<StateResource<CommandResource>> {
+    return this.resourceStateService.selectResource().pipe(
+      switchMap((listStateResource: StateResource<T>) =>
+        this.commandService.createCommandByProps({
+          ...props,
+          resource: listStateResource.resource,
+          linkRel: this.config.createLinkRel,
+        }),
+      ),
+      startWith(createEmptyStateResource<CommandResource>(true)),
+    );
+  }
+  //   return this.createCreateWiedervorlageCommand(
+  //     this.wiedervorlageList$.value.resource,
+  //     toCreate,
+  //   ).pipe(
+  //     filter((commandStateResource) => !commandStateResource.loading),
+  //     tap((commandStateResource) =>
+  //       this.proceedAfterReceiveCommand(
+  //         commandStateResource,
+  //         this.buildMessage(WiedervorlageMessages.CREATED, toCreate),
+  //       ),
+  //     ),
+  //     startWith(createEmptyStateResource<CommandResource>(true)),
+  //   );
+  // }
+
+  // createCreateWiedervorlageCommand(
+  //   listResource: T,
+  //   props: CreateCommandProps,
+  // ): Observable<StateResource<CommandResource>> {
+  //   return this.commandService.createCommandByProps({
+  //     ...props,
+  //     resource: listResource,
+  //     linkRel: this.config.createLinkRel
+  //   });
+  // return null;
+  // return this.commandService.createCommandByProps({
+  //   resource: listResource,
+  //   linkRel: this.config.createLinkRel,
+  //   command: this.buildCreateWiedervorlageCommand(props.toCreate),
+  //   snackBarMessage: props.snackbarMessage
+  // });
+  // return this.commandService.createCommand(
+  //   listResource,
+  //   this.config.createLinkRel, //CREATE_WIEDERVORLAGE,
+  //   this.buildCreateWiedervorlageCommand(toCreate),
+  // );
+  // }
+
+  // proceedAfterReceiveCommand(
+  //   commandStateResource: StateResource<CommandResource>,
+  //   message: string,
+  // ): void {
+  //   this.submitInProgress$.next({
+  //     ...this.submitInProgress$.value,
+  //     resource: commandStateResource.resource,
+  //   });
+  //   if (isDone(commandStateResource.resource)) {
+  //     this.submitInProgress$.next(createStateResource(commandStateResource.resource));
+  //     this.snackbarService.show(commandStateResource.resource, message);
+  //     this.setWiedervorlageListReload();
+  //   } else if (hasError(commandStateResource)) {
+  //     this.submitInProgress$.next(createStateResource(commandStateResource.resource));
+  //   }
+  // }
+
+  // private buildMessage(message: string, toCreate: unknown) {
+  //   return replacePlaceholder(message, 'betreff', wiedervorlage.betreff);
+  // }
+
+  // private buildCreateWiedervorlageCommand(toCreate: unknown): Command {
+  //   return <any>{ order: CommandOrder.CREATE_WIEDERVORLAGE, toCreate, body: null };
+  // }
+
+  // setWiedervorlageListReload(): void {
+  //   this.wiedervorlageList$.next({ ...this.wiedervorlageList$.value, reload: true });
+  // }
+}
diff --git a/alfa-client/libs/tech-shared/src/index.ts b/alfa-client/libs/tech-shared/src/index.ts
index 4cea35d10a..94e7e15c69 100644
--- a/alfa-client/libs/tech-shared/src/index.ts
+++ b/alfa-client/libs/tech-shared/src/index.ts
@@ -31,7 +31,7 @@ export * from './lib/form.util';
 export * from './lib/http.util';
 export * from './lib/message-code';
 export * from './lib/ngrx/actions';
-export * from './lib/ngrx/del.resource.reducer';
+export * from './lib/ngrx/resource.reducer';
 export * from './lib/ngrx/resource.state';
 export * from './lib/ngrx/resource.state.service';
 export * from './lib/pipe/convert-for-data-test.pipe';
diff --git a/alfa-client/libs/tech-shared/src/lib/ngrx/actions.ts b/alfa-client/libs/tech-shared/src/lib/ngrx/actions.ts
index 2976dafda8..933c202a34 100644
--- a/alfa-client/libs/tech-shared/src/lib/ngrx/actions.ts
+++ b/alfa-client/libs/tech-shared/src/lib/ngrx/actions.ts
@@ -55,8 +55,6 @@ export interface LoadResourceFailureProps {
   error: HttpError;
 }
 
-export interface LoadResourceSuccessProps {}
-
 export interface ResourceActions {
   loadAction: TypedActionCreatorWithProps<ResourceUriProps>;
   loadFailureAction: TypedActionCreatorWithProps<LoadResourceFailureProps>;
@@ -73,28 +71,28 @@ export interface ListResourceLoadActions extends ResourceActions {
 }
 
 export function createSingleResourceActions(stateInfo: StateInfo): SingleResourceLoadActions {
-  const stateName: string = stateInfo.name;
-  const subPath: string = stateInfo.featureName;
+  const actions: ResourceActions = createResourceActions(
+    stateInfo.name,
+    `${stateInfo.path} Resource`,
+  );
+  return { ...actions, loadSuccessAction: createLoadSuccessAction(stateInfo) };
+}
 
-  const actions: ResourceActions = createResourceActions(stateName, `${subPath} Resource`);
-  const loadSuccessAction: TypedActionCreatorWithProps<LoadResourceSuccessProps> = createAction(
-    createActionType(stateName, `Load ${subPath} Resource Success`),
+function createLoadSuccessAction(
+  stateInfo: StateInfo,
+): TypedActionCreatorWithProps<LoadResourceSuccessProps> {
+  return createAction(
+    createActionType(stateInfo.name, `Load ${stateInfo.path} Resource Success`),
     props<LoadResourceSuccessProps>(),
   );
-  return { ...actions, loadSuccessAction };
 }
 
 export function createListResourceActions(stateInfo: StateInfo): ListResourceLoadActions {
-  const stateName: string = stateInfo.name;
-  const subPath: string = stateInfo.featureName;
-
-  const actions: ResourceActions = createResourceActions(stateName, `${subPath} ListResource`);
-  const loadListSuccessAction: TypedActionCreatorWithProps<LoadListResourceSuccessProps> =
-    createAction(
-      createActionType(stateName, `Load ${subPath} ListResource Success`),
-      props<LoadListResourceSuccessProps>(),
-    );
-  return { ...actions, loadListSuccessAction };
+  const actions: ResourceActions = createResourceActions(
+    stateInfo.name,
+    `${stateInfo.path} ListResource`,
+  );
+  return { ...actions, loadListSuccessAction: createLoadListSuccessAction(stateInfo) };
 }
 
 function createResourceActions(stateName: string, message: string): ResourceActions {
@@ -118,3 +116,12 @@ function createResourceActions(stateName: string, message: string): ResourceActi
 function createActionType(stateName: string, message: string): string {
   return `[${stateName}] ${message}`;
 }
+
+function createLoadListSuccessAction(
+  stateInfo: StateInfo,
+): TypedActionCreatorWithProps<LoadListResourceSuccessProps> {
+  return createAction(
+    createActionType(stateInfo.name, `Load ${stateInfo.path} ListResource Success`),
+    props<LoadListResourceSuccessProps>(),
+  );
+}
diff --git a/alfa-client/libs/tech-shared/src/lib/ngrx/del.reducer.service.ts b/alfa-client/libs/tech-shared/src/lib/ngrx/del.reducer.service.ts
index 22fc605c62..7f14f5558b 100644
--- a/alfa-client/libs/tech-shared/src/lib/ngrx/del.reducer.service.ts
+++ b/alfa-client/libs/tech-shared/src/lib/ngrx/del.reducer.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
 import { Action, ActionReducer, ActionReducerMap, ReducerManager } from '@ngrx/store';
 import { StateInfo } from '../resource/resource.model';
 import { SingleResourceLoadActions } from './actions';
-import { SingleResourceReducer } from './del.resource.reducer';
+import { SingleResourceReducer } from './resource.reducer';
 import { SingleResourceStateService } from './resource.state.service';
 
 @Injectable({
diff --git a/alfa-client/libs/tech-shared/src/lib/ngrx/resource.loader.ts b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.loader.ts
index 1805d65a48..a0f969b717 100644
--- a/alfa-client/libs/tech-shared/src/lib/ngrx/resource.loader.ts
+++ b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.loader.ts
@@ -11,14 +11,14 @@ import {
   isStateResoureStable,
 } from '../resource/resource.util';
 import { isNotNull } from '../tech.util';
-import { GenerellResourceStateService } from './resource.state.service';
+import { ResourceStateService } from './resource.state.service';
 
 export class ResourceLoader<B extends Resource, T extends Resource> {
   configResource: B = null;
 
   constructor(
     private config: ServiceConfig<B>,
-    private resourceStateService: GenerellResourceStateService<T>,
+    private resourceStateService: ResourceStateService<T>,
   ) {}
 
   public get(): Observable<StateResource<T>> {
diff --git a/alfa-client/libs/tech-shared/src/lib/ngrx/del.resource.reducer.ts b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.reducer.ts
similarity index 52%
rename from alfa-client/libs/tech-shared/src/lib/ngrx/del.resource.reducer.ts
rename to alfa-client/libs/tech-shared/src/lib/ngrx/resource.reducer.ts
index 05a1f89bd3..e941b917ad 100644
--- a/alfa-client/libs/tech-shared/src/lib/ngrx/del.resource.reducer.ts
+++ b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.reducer.ts
@@ -1,4 +1,4 @@
-import { Action, ActionReducer, createReducer, on } from '@ngrx/store';
+import { Action, ActionReducer, ReducerTypes, createReducer, on } from '@ngrx/store';
 import {
   createEmptyStateResource,
   createErrorStateResource,
@@ -9,7 +9,9 @@ import {
   LoadListResourceSuccessProps,
   LoadResourceFailureProps,
   LoadResourceSuccessProps,
+  ResourceUriProps,
   SingleResourceLoadActions,
+  TypedActionCreatorWithProps,
 } from './actions';
 import {
   ListResourceState,
@@ -22,56 +24,74 @@ export class SingleResourceReducer {
   public reducer: ActionReducer<any, Action>;
 
   constructor(private actions: SingleResourceLoadActions) {
-    this.init();
+    this.initReducer();
   }
 
-  private init(): void {
+  private initReducer(): void {
     this.reducer = createReducer(
       initialResourceState,
-      on(this.actions.loadAction, (state: SingleResourceState): SingleResourceState => {
-        console.info('State after LOAD', {
-          ...state,
-          resource: { ...state.resource, loading: true, reload: false },
-        });
+      this.createLoadActionReducer(),
+      this.createLoadSuccessActionReducer(),
+      this.createFailureActionReducer(),
+      this.createClearActionReducer(),
+      this.createReloadActionReducer(),
+    );
+  }
+
+  private createLoadActionReducer(): ReducerTypes<
+    SingleResourceState,
+    [TypedActionCreatorWithProps<ResourceUriProps>]
+  > {
+    return on(this.actions.loadAction, (state: SingleResourceState): SingleResourceState => {
+      return {
+        ...state,
+        resource: { ...state.resource, loading: true },
+      };
+    });
+  }
+
+  private createLoadSuccessActionReducer(): ReducerTypes<
+    SingleResourceState,
+    [TypedActionCreatorWithProps<LoadResourceSuccessProps>]
+  > {
+    return on(
+      this.actions.loadSuccessAction,
+      (state: SingleResourceState, props: LoadResourceSuccessProps): SingleResourceState => {
         return {
           ...state,
-          resource: { ...state.resource, loading: true },
+          resource: createStateResource(props.resource),
         };
+      },
+    );
+  }
+
+  private createFailureActionReducer() {
+    return on(
+      this.actions.loadFailureAction,
+      (state: SingleResourceState, props: LoadResourceFailureProps): SingleResourceState => ({
+        ...state,
+        resource: createErrorStateResource(props.error),
+      }),
+    );
+  }
+
+  private createClearActionReducer() {
+    return on(
+      this.actions.clearAction,
+      (state: SingleResourceState): SingleResourceState => ({
+        ...state,
+        resource: createEmptyStateResource(),
+      }),
+    );
+  }
+
+  private createReloadActionReducer() {
+    return on(
+      this.actions.reloadAction,
+      (state: SingleResourceState): SingleResourceState => ({
+        ...state,
+        resource: { ...state.resource, reload: true },
       }),
-      on(
-        this.actions.loadSuccessAction,
-        (state: SingleResourceState, props: LoadResourceSuccessProps): SingleResourceState => {
-          console.info('State after SUCCESS', {
-            ...state,
-            resource: createStateResource(props.resource),
-          });
-          return {
-            ...state,
-            resource: createStateResource(props.resource),
-          };
-        },
-      ),
-      on(
-        this.actions.loadFailureAction,
-        (state: SingleResourceState, props: LoadResourceFailureProps): SingleResourceState => ({
-          ...state,
-          resource: createErrorStateResource(props.error),
-        }),
-      ),
-      on(
-        this.actions.clearAction,
-        (state: SingleResourceState): SingleResourceState => ({
-          ...state,
-          resource: createEmptyStateResource(),
-        }),
-      ),
-      on(
-        this.actions.reloadAction,
-        (state: SingleResourceState): SingleResourceState => ({
-          ...state,
-          resource: { ...state.resource, reload: true },
-        }),
-      ),
     );
   }
 }
@@ -80,17 +100,13 @@ export class ListResourceReducer {
   public reducer: ActionReducer<any, Action>;
 
   constructor(private actions: ListResourceLoadActions) {
-    this.init();
+    this.initReducer();
   }
 
-  private init(): void {
+  private initReducer(): void {
     this.reducer = createReducer(
       initialListResourceState,
       on(this.actions.loadAction, (state: ListResourceState): ListResourceState => {
-        console.info('State after LOAD', {
-          ...state,
-          resource: { ...state.listResource, loading: true, reload: false },
-        });
         return {
           ...state,
           listResource: { ...state.listResource, loading: true },
@@ -99,10 +115,6 @@ export class ListResourceReducer {
       on(
         this.actions.loadListSuccessAction,
         (state: ListResourceState, props: LoadListResourceSuccessProps): ListResourceState => {
-          console.info('State after SUCCESS', {
-            ...state,
-            listResource: createStateResource(props.listResource),
-          });
           return {
             ...state,
             listResource: createStateResource(props.listResource),
diff --git a/alfa-client/libs/tech-shared/src/lib/ngrx/resource.selector.ts b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.selector.ts
index 76fd21b9bf..ab2a6729e7 100644
--- a/alfa-client/libs/tech-shared/src/lib/ngrx/resource.selector.ts
+++ b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.selector.ts
@@ -2,6 +2,7 @@ import { createFeatureSelector, createSelector } from '@ngrx/store';
 import { StateInfo } from '../resource/resource.model';
 import { ListResourceState, SingleResourceState } from './resource.state';
 
+//Single Resource
 export const selectResource = <T>(stateInfo: StateInfo) =>
   createSelector(
     createFeatureSelector<SingleResourceState>(stateInfo.name),
@@ -16,6 +17,7 @@ export const existResource = <T>(stateInfo: StateInfo) =>
       <T>getFeatureState<SingleResourceState>(stateInfo, state).resource.loaded,
   );
 
+//List Resource
 export const selectListResource = <T>(stateInfo: StateInfo) =>
   createSelector(
     createFeatureSelector<ListResourceState>(stateInfo.name),
@@ -23,19 +25,6 @@ export const selectListResource = <T>(stateInfo: StateInfo) =>
       <T>getFeatureState<ListResourceState>(stateInfo, state).listResource,
   );
 
-// export const selectListItems = <T>(
-//   stateInfo: StateInfo,
-// ): MemoizedSelector<object, T, (s1: ResourceState) => T> =>
-//   createSelector(
-//     createFeatureSelector<ResourceState>(stateInfo.name),
-//     (state: ResourceState) => {
-//       const featureState = getFeatureState<ListResourceState>(stateInfo, state);
-//       const listResource: StateResource<T> = isNotNull(featureState.listResource.resource) &&
-
-//       // return <T>getFeatureState<ResourceState>(stateInfo, state).resource;
-//     }
-//   );
-
 function getFeatureState<T>(stateInfo: StateInfo, state: any): T {
-  return <T>state.hasOwnProperty(stateInfo.featureName) ? state[stateInfo.featureName] : state;
+  return <T>state.hasOwnProperty(stateInfo.path) ? state[stateInfo.path] : state;
 }
diff --git a/alfa-client/libs/tech-shared/src/lib/ngrx/resource.state.service.ts b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.state.service.ts
index e866a4f774..9dba6d4d8a 100644
--- a/alfa-client/libs/tech-shared/src/lib/ngrx/resource.state.service.ts
+++ b/alfa-client/libs/tech-shared/src/lib/ngrx/resource.state.service.ts
@@ -31,7 +31,7 @@ export class StateService {
   }
 }
 
-export abstract class GenerellResourceStateService<T> {
+export abstract class ResourceStateService<T> {
   actions: ResourceActions;
 
   constructor(
@@ -66,7 +66,7 @@ export abstract class GenerellResourceStateService<T> {
   public abstract selectResource<T>(): Observable<StateResource<T>>;
 }
 
-export class SingleResourceStateService<T> extends GenerellResourceStateService<T> {
+export class SingleResourceStateService<T> extends ResourceStateService<T> {
   actions: SingleResourceLoadActions;
 
   constructor(
@@ -94,7 +94,7 @@ export class SingleResourceStateService<T> extends GenerellResourceStateService<
   }
 }
 
-export class ListResourceStateService<T> extends GenerellResourceStateService<T> {
+export class ListResourceStateService<T> extends ResourceStateService<T> {
   actions: ListResourceLoadActions;
 
   constructor(
diff --git a/alfa-client/libs/tech-shared/src/lib/resource/list-resource.service.ts b/alfa-client/libs/tech-shared/src/lib/resource/list-resource.service.ts
index e7fa7cbce2..34a081301e 100644
--- a/alfa-client/libs/tech-shared/src/lib/resource/list-resource.service.ts
+++ b/alfa-client/libs/tech-shared/src/lib/resource/list-resource.service.ts
@@ -10,7 +10,7 @@ import { ListResource, StateResource, getEmbeddedResources } from './resource.ut
  * T = Type of listresource
  * I = Type of items in listresource
  */
-export class ResourceListService<
+export abstract class ResourceListService<
   B extends Resource,
   T extends ListResource,
   I extends ListItemResource,
@@ -26,14 +26,14 @@ export class ResourceListService<
   //   createEmptyStateResource(),
   // );
 
-  baseResource: B = null;
+  // baseResource: B = null;
 
   resourceStateService: ListResourceStateService<T>;
   resourceLoader: ResourceLoader<B, T>;
 
   constructor(
-    private config: ListResourceServiceConfig<B>,
-    private stateService: StateService,
+    protected config: ListResourceServiceConfig<B>,
+    protected stateService: StateService,
   ) {
     this.initStateService();
     this.initResourceLoader();
@@ -53,6 +53,14 @@ export class ResourceListService<
     return this.resourceLoader.get();
   }
 
+  public selectList(): Observable<StateResource<T>> {
+    return this.resourceStateService.selectResource();
+  }
+
+  // public loadByGivenBaseResource(baseResource: B):StateResource<T> {
+  //   return this.resourceLoader.getByBaseResource(baseResource);
+  // }
+
   //TODO migrieren
 
   // public getList(): Observable<StateResource<T>> {
diff --git a/alfa-client/libs/tech-shared/src/lib/resource/resource.model.ts b/alfa-client/libs/tech-shared/src/lib/resource/resource.model.ts
index 09437b2a43..9f03b96d37 100644
--- a/alfa-client/libs/tech-shared/src/lib/resource/resource.model.ts
+++ b/alfa-client/libs/tech-shared/src/lib/resource/resource.model.ts
@@ -4,7 +4,7 @@ import { StateResource } from './resource.util';
 
 export interface StateInfo {
   name: string;
-  featureName: string; //TODO Rename
+  path: string;
 }
 
 export interface ServiceConfig<B> {
diff --git a/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-edit-dialog/aktenzeichen-edit-dialog.component.spec.ts b/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-edit-dialog/aktenzeichen-edit-dialog.component.spec.ts
index 9048ea218b..1952b0e3d8 100644
--- a/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-edit-dialog/aktenzeichen-edit-dialog.component.spec.ts
+++ b/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-edit-dialog/aktenzeichen-edit-dialog.component.spec.ts
@@ -1,5 +1,14 @@
-import { AktenzeichenEditDialogComponent } from '@alfa-client/vorgang-detail';
-import { ComponentFixture, TestBed } from '@angular/core/testing';
+import {
+  COMMAND_ERROR_MESSAGES,
+  CommandErrorMessage,
+  hasError,
+  isSuccessfulDone,
+} from '@alfa-client/command-shared';
+import {
+  createEmptyStateResource,
+  hasContent,
+  isClipboardReadSupported,
+} from '@alfa-client/tech-shared';
 import { mock } from '@alfa-client/test-utils';
 import {
   OzgcloudPasteTextButtonComponent,
@@ -7,8 +16,9 @@ import {
   SnackBarService,
   TextEditorComponent,
 } from '@alfa-client/ui';
-import { MockComponent, MockDirective } from 'ng-mocks';
 import { VorgangService } from '@alfa-client/vorgang-shared';
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { FormBuilder, ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
 import {
   MAT_DIALOG_DATA,
   MatDialogActions,
@@ -16,27 +26,17 @@ import {
   MatDialogRef,
 } from '@angular/material/dialog';
 import { MatIcon } from '@angular/material/icon';
+import { cold, hot } from 'jest-marbles';
 import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
-import {
-  createEmptyStateResource,
-  hasContent,
-  isClipboardReadSupported,
-} from '@alfa-client/tech-shared';
+import { MockComponent, MockDirective } from 'ng-mocks';
 import { EMPTY, NEVER } from 'rxjs';
-import { FormBuilder, ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
-import { cold, hot } from 'jest-marbles';
 import {
   createCommandErrorResource,
   createCommandResource,
 } from '../../../../command-shared/test/command';
-import {
-  COMMAND_ERROR_MESSAGES,
-  CommandErrorMessage,
-  hasError,
-  isSuccessfulDone,
-} from '@alfa-client/command-shared';
-import { AktenzeichenEditDialogMessages } from './aktenzeichen-edit-dialog.message';
+import { AktenzeichenEditDialogComponent } from './aktenzeichen-edit-dialog.component';
 import { AktenzeichenEditDialogFormservice } from './aktenzeichen-edit-dialog.formservice';
+import { AktenzeichenEditDialogMessages } from './aktenzeichen-edit-dialog.message';
 
 jest.mock('@alfa-client/tech-shared');
 const isClipboardReadSupportedMock = isClipboardReadSupported as jest.Mock;
diff --git a/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-editable/aktenzeichen-editable.component.spec.ts b/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-editable/aktenzeichen-editable.component.spec.ts
index 0c89af4e82..ff9fac80cc 100644
--- a/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-editable/aktenzeichen-editable.component.spec.ts
+++ b/alfa-client/libs/vorgang-detail/src/lib/aktenzeichen-editable/aktenzeichen-editable.component.spec.ts
@@ -21,17 +21,16 @@
  * Die sprachspezifischen Genehmigungen und Beschränkungen
  * unter der Lizenz sind dem Lizenztext zu entnehmen.
  */
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { AktenzeichenEditableComponent } from '@alfa-client/vorgang-detail';
-import { DialogService } from '@alfa-client/ui';
+import { HasLinkPipe } from '@alfa-client/tech-shared';
 import { mock } from '@alfa-client/test-utils';
-import { MockComponent } from 'ng-mocks';
-import { OzgcloudIconButtonPrimaryComponent } from '@alfa-client/ui';
+import { DialogService, OzgcloudIconButtonPrimaryComponent } from '@alfa-client/ui';
+import { VorgangWithEingangLinkRel } from '@alfa-client/vorgang-shared';
 import { AktenzeichenComponent } from '@alfa-client/vorgang-shared-ui';
-import { AktenzeichenEditDialogComponent } from '@alfa-client/vorgang-detail';
+import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
-import { createEmptyStateResource, HasLinkPipe } from '@alfa-client/tech-shared';
-import { VorgangWithEingangLinkRel } from '@alfa-client/vorgang-shared';
+import { MockComponent } from 'ng-mocks';
+import { AktenzeichenEditDialogComponent } from '../aktenzeichen-edit-dialog/aktenzeichen-edit-dialog.component';
+import { AktenzeichenEditableComponent } from './aktenzeichen-editable.component';
 
 describe('AktenzeichenComponent', () => {
   let component: AktenzeichenEditableComponent;
diff --git a/alfa-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts b/alfa-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts
index 14c286f233..ad3b01b5a4 100644
--- a/alfa-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts
+++ b/alfa-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts
@@ -24,7 +24,6 @@
 import { BeschiedenDateInVorgangContainerComponent } from '@alfa-client/bescheid';
 import { EMPTY_STRING, EnumToLabelPipe, HasLinkPipe } from '@alfa-client/tech-shared';
 import { getDebugElementFromFixtureByCss } from '@alfa-client/test-utils';
-import { AktenzeichenEditableComponent } from '@alfa-client/vorgang-detail';
 import { VorgangHeaderLinkRel } from '@alfa-client/vorgang-shared';
 import {
   VorgangNummerComponent,
@@ -39,6 +38,7 @@ import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
 import { UserProfileInVorgangContainerComponent } from 'libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component';
 import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
 import { MockComponent } from 'ng-mocks';
+import { AktenzeichenEditableComponent } from '../../../aktenzeichen-editable/aktenzeichen-editable.component';
 import { VorgangDetailHeaderComponent } from './vorgang-detail-header.component';
 
 describe('VorgangDetailHeaderComponent', () => {
diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-list-resource.service.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-list-resource.service.ts
new file mode 100644
index 0000000000..86f4718839
--- /dev/null
+++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-list-resource.service.ts
@@ -0,0 +1,38 @@
+import { CommandListResourceService, CommandService } from '@alfa-client/command-shared';
+import { ListResourceServiceConfig, StateService } from '@alfa-client/tech-shared';
+import {
+  VorgangHeaderLinkRel,
+  VorgangService,
+  VorgangWithEingangResource,
+} from '@alfa-client/vorgang-shared';
+import { WiedervorlageListLinkRel } from './wiedervorlage.linkrel';
+import { WiedervorlageListResource, WiedervorlageResource } from './wiedervorlage.model';
+import { WIEDERVORLAGE_FEATURE_KEY, WIEDERVORLAGE_LIST_PATH } from './wiedervorlage.state';
+
+export class WiedervorlageListResourceService extends CommandListResourceService<
+  VorgangWithEingangResource,
+  WiedervorlageListResource,
+  WiedervorlageResource
+> {}
+
+export function createWiedervorlageListResourceService(
+  vorgangService: VorgangService,
+  stateService: StateService,
+  commandService: CommandService,
+) {
+  return new CommandListResourceService(buildConfig(vorgangService), stateService, commandService);
+}
+
+function buildConfig(
+  vorgangService: VorgangService,
+): ListResourceServiceConfig<VorgangWithEingangResource> {
+  return {
+    stateInfo: {
+      name: WIEDERVORLAGE_FEATURE_KEY,
+      path: WIEDERVORLAGE_LIST_PATH,
+    },
+    baseResource: vorgangService.getVorgangWithEingang(),
+    getLinkRel: VorgangHeaderLinkRel.WIEDERVORLAGEN,
+    listResourceListLinkRel: WiedervorlageListLinkRel.WIEDERVORLAGE_LIST,
+  };
+}
diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-shared.module.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-shared.module.ts
index ef0580cbd6..a74ce1b847 100644
--- a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-shared.module.ts
+++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage-shared.module.ts
@@ -21,10 +21,10 @@
  * Die sprachspezifischen Genehmigungen und Beschränkungen
  * unter der Lizenz sind dem Lizenztext zu entnehmen.
  */
-import { CommonModule } from '@angular/common';
 import { NgModule } from '@angular/core';
+import { WiedervorlageService } from './wiedervorlage.service';
 
 @NgModule({
-  imports: [CommonModule],
+  providers: [WiedervorlageService],
 })
 export class WiedervorlageSharedModule {}
diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts
index a96d7ca4e7..52cf5e2fa5 100644
--- a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts
+++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts
@@ -23,7 +23,6 @@
  */
 import { BinaryFileListResource, BinaryFileService } from '@alfa-client/binary-file-shared';
 import {
-  Command,
   CommandOrder,
   CommandResource,
   CommandService,
@@ -38,7 +37,6 @@ import {
   decodeUrlFromEmbedding,
   doIfLoadingRequired,
   hasError,
-  isNotNull,
   isNotUndefined,
   replacePlaceholder,
 } from '@alfa-client/tech-shared';
@@ -48,8 +46,9 @@ import { Injectable, OnDestroy } from '@angular/core';
 import { Params } from '@angular/router';
 import { ResourceUri, getUrl, hasLink } from '@ngxp/rest';
 import { isEqual, isNil, isNull, isUndefined } from 'lodash-es';
-import { BehaviorSubject, Observable, Subscription, combineLatest } from 'rxjs';
+import { BehaviorSubject, Observable, Subscription } from 'rxjs';
 import { filter, map, startWith, tap } from 'rxjs/operators';
+import { WiedervorlageListResourceService } from './wiedervorlage-list-resource.service';
 import { WiedervorlageLinkRel, WiedervorlageListLinkRel } from './wiedervorlage.linkrel';
 import { WiedervorlageMessages } from './wiedervorlage.message';
 import {
@@ -63,7 +62,7 @@ import { WiedervorlageRepository } from './wiedervorlage.repository';
 import { WiedervorlageRoutes } from './wiedervorlage.route';
 import { createErledigenCommand, createWiedereroeffnenCommand } from './wiedervorlage.util';
 
-@Injectable({ providedIn: 'root' })
+@Injectable()
 export class WiedervorlageService implements OnDestroy {
   static encodedWiedervorlageUriParam: string = 'wiedervorlageUrl';
 
@@ -274,8 +273,8 @@ export class WiedervorlageService implements OnDestroy {
     );
   }
 
-  private buildCreateWiedervorlageCommand(wiedervorlage: Wiedervorlage): Command {
-    return <any>{ order: CommandOrder.CREATE_WIEDERVORLAGE, wiedervorlage, body: null };
+  private buildCreateWiedervorlageCommand(wiedervorlage: Wiedervorlage): CreateCommand {
+    return { order: CommandOrder.CREATE_WIEDERVORLAGE, body: wiedervorlage };
   }
 
   public saveWiedervorlage(
diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.state.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.state.ts
new file mode 100644
index 0000000000..1314b37bc9
--- /dev/null
+++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.state.ts
@@ -0,0 +1,17 @@
+import { ListResourceReducer, createListResourceActions } from '@alfa-client/tech-shared';
+import { Action, ActionReducerMap } from '@ngrx/store';
+
+export const WIEDERVORLAGE_FEATURE_KEY = 'WiedervorlageState';
+
+export const WIEDERVORLAGE_LIST_PATH = 'wiedervorlage';
+
+export const reducers: ActionReducerMap<any> = {
+  [WIEDERVORLAGE_LIST_PATH]: wiedervorlageListReducer,
+};
+
+function wiedervorlageListReducer(state: unknown, action: Action) {
+  const resourceReducer: ListResourceReducer = new ListResourceReducer(
+    createListResourceActions({ name: WIEDERVORLAGE_FEATURE_KEY, path: WIEDERVORLAGE_LIST_PATH }),
+  );
+  return resourceReducer.reducer(state, action);
+}
diff --git a/alfa-client/libs/wiedervorlage/src/lib/wiedervorlage.module.ts b/alfa-client/libs/wiedervorlage/src/lib/wiedervorlage.module.ts
index 6e00e592ba..6d808d3517 100644
--- a/alfa-client/libs/wiedervorlage/src/lib/wiedervorlage.module.ts
+++ b/alfa-client/libs/wiedervorlage/src/lib/wiedervorlage.module.ts
@@ -21,15 +21,16 @@
  * Die sprachspezifischen Genehmigungen und Beschränkungen
  * unter der Lizenz sind dem Lizenztext zu entnehmen.
  */
-import { CommonModule, DatePipe } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
 import { BinaryFileModule } from '@alfa-client/binary-file';
 import { TechSharedModule } from '@alfa-client/tech-shared';
 import { UiModule } from '@alfa-client/ui';
 import { UserProfileModule } from '@alfa-client/user-profile';
 import { VorgangSharedModule } from '@alfa-client/vorgang-shared';
 import { VorgangSharedUiModule } from '@alfa-client/vorgang-shared-ui';
+import { WiedervorlageSharedModule } from '@alfa-client/wiedervorlage-shared';
+import { CommonModule, DatePipe } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
 import { CreateWiedervorlageButtonContainerComponent } from './create-wiedervorlage-button-container/create-wiedervorlage-button-container.component';
 import { ErledigenButtonContainerComponent } from './erledigen-button-container/erledigen-button-container.component';
 import { SubmitWiedervorlageButtonComponent } from './submit-wiedervorlage-button/submit-wiedervorlage-button.component';
@@ -69,6 +70,7 @@ const routes: Routes = [
     VorgangSharedUiModule,
     BinaryFileModule,
     UserProfileModule,
+    WiedervorlageSharedModule,
   ],
   declarations: [
     WiedervorlagePageComponent,
diff --git a/alfa-service/src/main/java/de/ozgcloud/alfa/common/command/CommandBody.java b/alfa-service/src/main/java/de/ozgcloud/alfa/common/command/CommandBody.java
index 55b885acd5..9621509f75 100644
--- a/alfa-service/src/main/java/de/ozgcloud/alfa/common/command/CommandBody.java
+++ b/alfa-service/src/main/java/de/ozgcloud/alfa/common/command/CommandBody.java
@@ -45,6 +45,7 @@ import de.ozgcloud.alfa.wiedervorlage.Wiedervorlage;
 		@Type(value = AssignUserCommandBody.class, name = "ASSIGN_USER"),
 		@Type(value = RedirectRequest.class, name = "REDIRECT_VORGANG"),
 		@Type(value = Wiedervorlage.class, name = "WIEDERVORLAGE"),
+		@Type(value = Wiedervorlage.class, name = "CREATE_WIEDERVORLAGE"),
 		@Type(value = Kommentar.class, name = "KOMMENTAR"),
 		@Type(value = LoeschAnforderung.class, name = "LOESCH_ANFORDERUNG"),
 		@Type(value = DeleteLoeschAnforderung.class, name = "DELETE_LOESCH_ANFORDERUNG"),
diff --git a/alfa-service/src/main/java/de/ozgcloud/alfa/wiedervorlage/WiedervorlageCommandController.java b/alfa-service/src/main/java/de/ozgcloud/alfa/wiedervorlage/WiedervorlageCommandController.java
index 9435cef625..54ce4e874c 100644
--- a/alfa-service/src/main/java/de/ozgcloud/alfa/wiedervorlage/WiedervorlageCommandController.java
+++ b/alfa-service/src/main/java/de/ozgcloud/alfa/wiedervorlage/WiedervorlageCommandController.java
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import de.ozgcloud.alfa.common.command.Command;
 import de.ozgcloud.alfa.common.command.CommandController;
+import de.ozgcloud.alfa.common.command.CreateCommand;
 import de.ozgcloud.alfa.common.command.LegacyOrder;
 import de.ozgcloud.common.errorhandling.TechnicalException;
 import lombok.RequiredArgsConstructor;
@@ -93,8 +94,8 @@ public class WiedervorlageCommandController {
 		private final WiedervorlageService service;
 
 		@PostMapping
-		public ResponseEntity<Void> createWiedervorlage(@RequestBody WiedervorlageCommand command, @PathVariable String vorgangId) {
-			var createdCommand = service.createWiedervorlage(command.getWiedervorlage(), vorgangId);
+		public ResponseEntity<Void> createWiedervorlage(@RequestBody CreateCommand command, @PathVariable String vorgangId) {
+			var createdCommand = service.createWiedervorlage((Wiedervorlage) command.getBody(), vorgangId);
 
 			service.updateNextFrist(vorgangId);
 
-- 
GitLab