Skip to content
Snippets Groups Projects
Commit 037ec241 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-5868-RemoveHackathon-Feature' (#701) from...

Merge pull request 'OZG-5868-RemoveHackathon-Feature' (#701) from OZG-5868-RemoveHackathon-Feature into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/alfa/pulls/701


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents 0b0f15b1 4367a3bb
No related branches found
No related tags found
No related merge requests found
Showing
with 29 additions and 271 deletions
......@@ -4,7 +4,7 @@ import {
CommandService,
CreateCommand,
} from '@alfa-client/command-shared';
import { EMPTY_STRING, StateResource, createStateResource } from '@alfa-client/tech-shared';
import { createStateResource, EMPTY_STRING, StateResource } from '@alfa-client/tech-shared';
import { Mock, mock, useFromMock } from '@alfa-client/test-utils';
import { VorgangWithEingangLinkRel, VorgangWithEingangResource } from '@alfa-client/vorgang-shared';
import { Store } from '@ngrx/store';
......@@ -43,31 +43,15 @@ describe('BescheidFacade', () => {
});
});
describe('createBescheid', () => {
describe('createBescheidDraft', () => {
const createCommand: CreateCommand = createCreateCommand(CommandOrder.CREATE_BESCHEID);
describe('with both Links', () => {
it('should call command service with CREATE_BESCHEID linkRel', () => {
it('should create command', () => {
const vorgang: VorgangWithEingangResource = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.CREATE_BESCHEID,
VorgangWithEingangLinkRel.CREATE_BESCHEID_DRAFT,
]);
facade.createBescheid(vorgang, createCommand);
expect(commandService.createCommandByProps).toHaveBeenCalledWith({
resource: vorgang,
linkRel: VorgangWithEingangLinkRel.CREATE_BESCHEID,
command: createCommand,
});
});
});
describe('with CREATE_BESCHEID_DRAFT link', () => {
it('should call command service with CREATE_BESCHEID_DRAFT linkRel and empty snackBarMessage', () => {
const vorgang: VorgangWithEingangResource = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.CREATE_BESCHEID_DRAFT,
]);
facade.createBescheid(vorgang, createCommand);
facade.createBescheidDraft(vorgang, createCommand);
expect(commandService.createCommandByProps).toHaveBeenCalledWith({
resource: vorgang,
......@@ -77,26 +61,4 @@ describe('BescheidFacade', () => {
});
});
});
describe('with CREATE_BESCHEID link', () => {
it('should call command service with CREATE_BESCHEID_DRAFT linkRel', () => {
const vorgang: VorgangWithEingangResource = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.CREATE_BESCHEID,
]);
facade.createBescheid(vorgang, createCommand);
expect(commandService.createCommandByProps).toHaveBeenCalledWith({
resource: vorgang,
linkRel: VorgangWithEingangLinkRel.CREATE_BESCHEID,
command: createCommand,
});
});
});
it('should emit error if link is missing()', () => {
const vorgang: VorgangWithEingangResource = createVorgangWithEingangResource();
expect(() => facade.createBescheid(vorgang, createCommand)).toThrowError();
});
});
});
......@@ -8,7 +8,6 @@ import { EMPTY_STRING, StateResource } from '@alfa-client/tech-shared';
import { VorgangWithEingangLinkRel, VorgangWithEingangResource } from '@alfa-client/vorgang-shared';
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { hasLink } from '@ngxp/rest';
import { Observable } from 'rxjs';
import * as BescheidSelectors from './bescheid.selectors';
......@@ -24,31 +23,6 @@ export class BescheidFacade {
return this.store.select(BescheidSelectors.bescheidCommand);
}
public createBescheid(
vorgangWithEingang: VorgangWithEingangResource,
command: CreateCommand,
): void {
if (hasLink(vorgangWithEingang, VorgangWithEingangLinkRel.CREATE_BESCHEID)) {
return this.createBescheidKiel(vorgangWithEingang, command);
}
if (hasLink(vorgangWithEingang, VorgangWithEingangLinkRel.CREATE_BESCHEID_DRAFT)) {
return this.createBescheidDraft(vorgangWithEingang, command);
}
throw new Error('Missing Link: CREATE_BESCHEID or CREATE_BESCHEID_DRAFT expected');
}
public createBescheidKiel(
vorgangWithEingang: VorgangWithEingangResource,
command: CreateCommand,
): void {
const createCommandProps: CreateCommandProps = {
resource: vorgangWithEingang,
linkRel: VorgangWithEingangLinkRel.CREATE_BESCHEID,
command,
};
this.commandService.createCommandByProps(createCommandProps);
}
public createBescheidDraft(
vorgangWithEingang: VorgangWithEingangResource,
command: CreateCommand,
......
......@@ -26,7 +26,7 @@ describe('Bescheid Reducer', () => {
const resource: VorgangWithEingangResource = createVorgangWithEingangResource();
const action: Action = CommandActions.createCommand({
resource,
linkRel: VorgangWithEingangLinkRel.CREATE_BESCHEID,
linkRel: VorgangWithEingangLinkRel.CREATE_BESCHEID_DRAFT,
command: { ...createCommandResource(), order: CommandOrder.CREATE_BESCHEID },
});
......
......@@ -11,13 +11,13 @@ import {
} from '@alfa-client/command-shared';
import {
ApiError,
createEmptyStateResource,
createErrorStateResource,
createStateResource,
EMPTY_ARRAY,
EMPTY_STRING,
HttpError,
StateResource,
createEmptyStateResource,
createErrorStateResource,
createStateResource,
} from '@alfa-client/tech-shared';
import { Mock, mock, useFromMock } from '@alfa-client/test-utils';
import {
......@@ -28,12 +28,12 @@ import {
} from '@alfa-client/vorgang-shared';
import { fakeAsync, tick } from '@angular/core/testing';
import faker from '@faker-js/faker';
import { ResourceUri, getUrl } from '@ngxp/rest';
import { getUrl, ResourceUri } from '@ngxp/rest';
import { cold } from 'jest-marbles';
import { CommandLinkRel } from 'libs/command-shared/src/lib/command.linkrel';
import { createApiError } from 'libs/tech-shared/test/error';
import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
import { Observable, first, of } from 'rxjs';
import { first, Observable, of } from 'rxjs';
import {
createBinaryFileListResource,
createBinaryFileResource,
......@@ -155,7 +155,7 @@ describe('BescheidService', () => {
it('should call facade', () => {
service.createBescheid(vorgangWithEingang).pipe(first()).subscribe();
expect(facade.createBescheid).toHaveBeenCalledWith(vorgangWithEingang, {
expect(facade.createBescheidDraft).toHaveBeenCalledWith(vorgangWithEingang, {
order: CommandOrder.CREATE_BESCHEID,
body: null,
});
......
......@@ -13,19 +13,19 @@ import {
tapOnCommandSuccessfullyDone,
} from '@alfa-client/command-shared';
import {
EMPTY_ARRAY,
HttpError,
ResourceListService,
StateResource,
createEmptyStateResource,
createStateResource,
EMPTY_ARRAY,
filterIsLoadedOrHasError,
getEmbeddedResources,
hasStateResourceError,
HttpError,
isLoaded,
isNotEmpty,
isNotNil,
ResourceListService,
sortByGermanDateStr,
StateResource,
} from '@alfa-client/tech-shared';
import {
VorgangCommandService,
......@@ -35,15 +35,15 @@ import {
} from '@alfa-client/vorgang-shared';
import { getEmpfaenger } from '@alfa-client/vorgang-shared-ui';
import { Injectable } from '@angular/core';
import { ResourceUri, getUrl, hasLink } from '@ngxp/rest';
import { getUrl, hasLink, ResourceUri } from '@ngxp/rest';
import {
BehaviorSubject,
Observable,
Subscription,
filter,
first,
map,
Observable,
startWith,
Subscription,
switchMap,
take,
tap,
......@@ -172,7 +172,7 @@ export class BescheidService {
vorgangWithEingang: VorgangWithEingangResource,
bescheid?: Bescheid,
): Observable<StateResource<CommandResource>> {
this.facade.createBescheid(vorgangWithEingang, buildCreateBescheidCommand(bescheid));
this.facade.createBescheidDraft(vorgangWithEingang, buildCreateBescheidCommand(bescheid));
return this.getBescheidCommand().pipe(
tapOnCommandSuccessfullyDone((commandStateResource: StateResource<CommandResource>) =>
this.updateBescheidDraft(commandStateResource.resource),
......
export * from './lib/bescheid.module';
export * from './lib/beschieden-date-in-vorgang-container/beschieden-date-in-vorgang-container.component';
export * from './lib/create-bescheid-button-container/create-bescheid-button-container.component';
......@@ -12,8 +12,6 @@ import { BescheidListInVorgangComponent } from './bescheid-list-in-vorgang-conta
import { DocumentInBescheidContainerComponent } from './bescheid-list-in-vorgang-container/bescheid-list-in-vorgang/document-in-bescheid-container/document-in-bescheid-container.component';
import { BeschiedenDateContainerComponent } from './beschieden-date-in-vorgang-container/beschieden-date-container/beschieden-date-container.component';
import { BeschiedenDateInVorgangContainerComponent } from './beschieden-date-in-vorgang-container/beschieden-date-in-vorgang-container.component';
import { CreateBescheidButtonContainerComponent } from './create-bescheid-button-container/create-bescheid-button-container.component';
import { CreateBescheidButtonComponent } from './create-bescheid-button-container/create-bescheid-button/create-bescheid-button.component';
import {
BescheidStatusTextComponent,
......@@ -36,8 +34,6 @@ import {
CloseIconComponent,
],
declarations: [
CreateBescheidButtonContainerComponent,
CreateBescheidButtonComponent,
BescheidInVorgangContainerComponent,
BescheidInVorgangComponent,
BescheidListInVorgangContainerComponent,
......@@ -48,7 +44,6 @@ import {
],
exports: [
BescheidInVorgangContainerComponent,
CreateBescheidButtonContainerComponent,
BescheidListInVorgangContainerComponent,
BeschiedenDateInVorgangContainerComponent,
],
......
<alfa-create-bescheid-button
data-test-id="create-bescheid-button-component"
[createBescheidCommand]="createBescheidInCommand$ | async"
(createBescheid)="create()"
>
</alfa-create-bescheid-button>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Mock, dispatchEventFromFixture, mock } from '@alfa-client/test-utils';
import { VorgangWithEingangResource } from '@alfa-client/vorgang-shared';
import { BescheidService } from 'libs/bescheid-shared/src/lib/bescheid.service';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
import { MockComponent } from 'ng-mocks';
import { CreateBescheidButtonContainerComponent } from './create-bescheid-button-container.component';
import { CreateBescheidButtonComponent } from './create-bescheid-button/create-bescheid-button.component';
describe('CreateBescheidButtonContainerComponent', () => {
let component: CreateBescheidButtonContainerComponent;
let fixture: ComponentFixture<CreateBescheidButtonContainerComponent>;
const createBescheidComponent: string = getDataTestIdOf('create-bescheid-button-component');
const service: Mock<BescheidService> = mock(BescheidService);
const vorgangWithEingang: VorgangWithEingangResource = createVorgangWithEingangResource();
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
CreateBescheidButtonContainerComponent,
MockComponent(CreateBescheidButtonComponent),
],
providers: [
{
provide: BescheidService,
useValue: service,
},
],
}).compileComponents();
fixture = TestBed.createComponent(CreateBescheidButtonContainerComponent);
component = fixture.componentInstance;
component.vorgangWithEingang = vorgangWithEingang;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('ngOnInit', () => {
it('should get bescheid command', () => {
component.ngOnInit();
expect(service.getBescheidCommand).toHaveBeenCalled();
});
});
describe('create', () => {
it('should call service', () => {
dispatchEventFromFixture(fixture, createBescheidComponent, 'createBescheid');
expect(service.createBescheid).toHaveBeenCalledWith(vorgangWithEingang);
});
});
});
import { CommandResource } from '@alfa-client/command-shared';
import { StateResource, createEmptyStateResource } from '@alfa-client/tech-shared';
import { VorgangWithEingangResource } from '@alfa-client/vorgang-shared';
import { Component, Input, OnInit } from '@angular/core';
import { BescheidService } from 'libs/bescheid-shared/src/lib/bescheid.service';
import { Observable, of } from 'rxjs';
@Component({
selector: 'alfa-create-bescheid-button-container',
templateUrl: './create-bescheid-button-container.component.html',
styleUrls: ['./create-bescheid-button-container.component.scss'],
})
export class CreateBescheidButtonContainerComponent implements OnInit {
@Input() vorgangWithEingang: VorgangWithEingangResource;
public createBescheidInCommand$: Observable<StateResource<CommandResource>> = of(
createEmptyStateResource<CommandResource>(),
);
constructor(private bescheidService: BescheidService) {}
ngOnInit(): void {
this.createBescheidInCommand$ = this.bescheidService.getBescheidCommand();
}
public create(): void {
this.bescheidService.createBescheid(this.vorgangWithEingang);
}
}
<ozgcloud-icon-button-with-spinner
data-test-id="create-bescheid-icon-button"
icon="description"
toolTip="Bescheid erstellen"
[stateResource]="createBescheidCommand"
(clickEmitter)="createBescheid.emit()"
>
</ozgcloud-icon-button-with-spinner>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { dispatchEventFromFixture } from '@alfa-client/test-utils';
import { IconButtonWithSpinnerComponent } from '@alfa-client/ui';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { CreateBescheidButtonComponent } from './create-bescheid-button.component';
describe('CreateBescheidButtonComponent', () => {
let component: CreateBescheidButtonComponent;
let fixture: ComponentFixture<CreateBescheidButtonComponent>;
const createBescheidButton: string = getDataTestIdOf('create-bescheid-icon-button');
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CreateBescheidButtonComponent, MockComponent(IconButtonWithSpinnerComponent)],
}).compileComponents();
fixture = TestBed.createComponent(CreateBescheidButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('on button click', () => {
it('should emit createBescheid', () => {
jest.spyOn(component.createBescheid, 'emit');
dispatchEventFromFixture(fixture, createBescheidButton, 'clickEmitter');
expect(component.createBescheid.emit).toHaveBeenCalled();
});
});
});
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CommandResource } from '@alfa-client/command-shared';
import { StateResource, createEmptyStateResource } from '@alfa-client/tech-shared';
@Component({
selector: 'alfa-create-bescheid-button',
templateUrl: './create-bescheid-button.component.html',
styleUrls: ['./create-bescheid-button.component.scss'],
})
export class CreateBescheidButtonComponent {
@Input() createBescheidCommand: StateResource<CommandResource> =
createEmptyStateResource<CommandResource>();
@Output() createBescheid: EventEmitter<void> = new EventEmitter();
}
......@@ -82,9 +82,3 @@
[showAsIconButton]="showAsIconButton"
[vorgang]="vorgangWithEingang"
></alfa-postfach-mail-button-container>
<alfa-create-bescheid-button-container
*ngIf="vorgangWithEingang | hasLink: vorgangWithEingangLinkRel.CREATE_BESCHEID"
[vorgangWithEingang]="vorgangWithEingang"
data-test-id="create-bescheid-button-container"
></alfa-create-bescheid-button-container>
......@@ -21,13 +21,7 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateBescheidButtonContainerComponent } from '@alfa-client/bescheid';
import {
EndgueltigLoeschenButtonContainerComponent,
LoeschAnforderungZuruecknehmenButtonContainerComponent,
LoeschenAnfordernButtonContainerComponent,
} from '@alfa-client/loesch-anforderung';
import { EndgueltigLoeschenButtonContainerComponent, LoeschAnforderungZuruecknehmenButtonContainerComponent, LoeschenAnfordernButtonContainerComponent } from '@alfa-client/loesch-anforderung';
import { PostfachMailButtonContainerComponent } from '@alfa-client/postfach';
import { HasLinkPipe } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils';
......@@ -35,6 +29,7 @@ import { IconButtonWithSpinnerComponent } from '@alfa-client/ui';
import { AssignUserProfileButtonContainerComponent } from '@alfa-client/user-profile';
import { VorgangWithEingangLinkRel } from '@alfa-client/vorgang-shared';
import { CreateWiedervorlageButtonContainerComponent } from '@alfa-client/wiedervorlage';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
import { MockComponent } from 'ng-mocks';
......@@ -77,7 +72,6 @@ describe('VorgangDetailActionButtonsComponent', () => {
MockComponent(LoeschenAnfordernButtonContainerComponent),
MockComponent(EndgueltigLoeschenButtonContainerComponent),
MockComponent(LoeschAnforderungZuruecknehmenButtonContainerComponent),
MockComponent(CreateBescheidButtonContainerComponent),
],
});
});
......
......@@ -56,7 +56,6 @@ export enum VorgangWithEingangLinkRel {
HISTORIE = 'historie',
SEARCH_USER_PROFILES = 'search-user-profiles',
EXPORT = 'export',
CREATE_BESCHEID = 'createBescheid',
CREATE_BESCHEID_DRAFT = 'createBescheidDraft',
PROCESS_VORGANG = 'processVorgang',
......
......@@ -8,7 +8,6 @@ keycloak:
ozgcloud:
feature:
createBescheid: true
reply-always-allowed: true
forwarding:
lninfo:
......
......@@ -12,11 +12,6 @@ import lombok.Setter;
@ConfigurationProperties(prefix = "ozgcloud.feature")
public class FeatureToggleProperties {
/**
* Enable/Disable bescheid creation feature.
*/
private boolean createBescheid = false;
/**
* Enable mail reply option regardless of other configuration.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment