feat: add admin user frontend contract

This commit is contained in:
Bastian Wagner
2026-08-01 09:17:57 +02:00
parent 78761b570b
commit 484c7473fb
20 changed files with 378 additions and 21 deletions

View File

@@ -28,7 +28,7 @@ describe('Register', () => {
afterEach(() => httpMock.verify());
it('verifies the invitation and links its player during registration', () => {
it('verifies the invitation and registers without linking its player', () => {
const fixture = TestBed.createComponent(Register);
const navigateSpy = vi.spyOn(router, 'navigate');
fixture.detectChanges();
@@ -50,7 +50,12 @@ describe('Register', () => {
fixture.componentInstance['onSubmit']();
const request = httpMock.expectOne(`${environment.apiUrl}auth/email/register`);
expect(request.request.body.linkPlayerId).toBe(7);
expect(request.request.body).toEqual({
email: 'alex@example.de',
password: 'secret1',
firstName: 'Alex',
lastName: 'Muster',
});
request.flush(null);
expect(navigateSpy).toHaveBeenCalledWith(['/auth/login'], { replaceUrl: true });

View File

@@ -78,7 +78,6 @@ export class Register {
password: value.password,
firstName: value.firstName,
lastName: value.lastName,
linkPlayerId: invitation.playerId,
})
.subscribe({
next: () => {

View File

@@ -11,8 +11,8 @@
<h1>Team auswählen</h1>
<mat-nav-list>
@for (player of players(); track player.id) {
<a mat-list-item [routerLink]="['/team', player.team?.id, 'overview']">
<span matListItemTitle>{{ player.team?.name }}</span>
<a mat-list-item [routerLink]="['/team', player.team.id, 'overview']">
<span matListItemTitle>{{ player.team.name }}</span>
<span matListItemLine>{{ player.firstName }} {{ player.lastName }}</span>
</a>
}

View File

@@ -5,6 +5,13 @@
</header>
<section class="link-grid">
<a routerLink="/users"
><mat-card
><mat-icon>group</mat-icon>
<div><strong>Benutzer</strong><span>Benutzerverzeichnis öffnen</span></div>
<mat-icon>chevron_right</mat-icon></mat-card
></a
>
<a routerLink="penalties"
><mat-card
><mat-icon>gavel</mat-icon>

View File

@@ -31,6 +31,9 @@ describe('More', () => {
expect(fixture.nativeElement.textContent).toContain('Profil');
expect(fixture.nativeElement.textContent).toContain('Öffentliche Freigabe');
expect(fixture.nativeElement.textContent).toContain('Benutzer');
expect(fixture.nativeElement.querySelector('a[href="/users"]')).not.toBeNull();
fixture.componentInstance['logout']();
await fixture.whenStable();
expect(clearSession).toHaveBeenCalled();

View File

@@ -0,0 +1,13 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-users',
template: `
<header>
<p class="eyebrow">Organisation</p>
<h1>Benutzer</h1>
<p>Benutzerverzeichnis wird vorbereitet.</p>
</header>
`,
})
export class Users {}