From d4cb36c4bdf82b950e2f8338ec3180db282ba97d Mon Sep 17 00:00:00 2001 From: Jannik Pulfer Date: Tue, 17 Dec 2024 14:37:11 +0100 Subject: [PATCH] Correctly case all relevant occurences of firstname and lastname --- .../afterMigrate__0_initialData.sql | 2 +- .../dom-helper/dialogs/inviteMembersDialog.ts | 20 ++++++------- .../key-result-form.component.html | 2 +- .../key-result-form.component.spec.ts | 4 +-- .../keyresult-detail.component.html | 2 +- .../keyresult-dialog.component.spec.ts | 2 +- frontend/src/app/shared/testData.ts | 16 +++++------ .../src/app/shared/types/model/NewUser.ts | 4 +-- .../src/app/shared/types/model/NewUserForm.ts | 4 +-- frontend/src/app/shared/types/model/User.ts | 6 ++-- .../app/shared/types/model/UserTableEntry.ts | 10 +++---- ...dd-member-to-team-dialog.component.spec.ts | 2 +- .../add-member-to-team-dialog.component.ts | 2 +- .../delete-user/delete-user.component.spec.ts | 4 +-- .../delete-user/delete-user.component.ts | 2 +- .../invite-user-dialog.component.spec.ts | 6 ++-- .../invite-user-dialog.component.ts | 4 +-- .../member-list-table.component.html | 2 +- .../member-list-table.component.ts | 2 +- .../member-list/member-list.component.spec.ts | 6 ++-- .../new-user/new-user.component.html | 28 +++++++++---------- .../new-user/new-user.component.spec.ts | 4 +-- .../new-user/new-user.component.ts | 8 +++--- .../search-team-management.component.spec.ts | 12 ++++---- .../search-team-management.component.ts | 8 +++--- 25 files changed, 81 insertions(+), 81 deletions(-) diff --git a/backend/src/main/resources/db/data-migration-demo/afterMigrate__0_initialData.sql b/backend/src/main/resources/db/data-migration-demo/afterMigrate__0_initialData.sql index 0217f691c9..9b8ff979a5 100644 --- a/backend/src/main/resources/db/data-migration-demo/afterMigrate__0_initialData.sql +++ b/backend/src/main/resources/db/data-migration-demo/afterMigrate__0_initialData.sql @@ -20,7 +20,7 @@ values (1, '1'), -- last past quarter (8, '8'), -- future quarter (999, 'Backlog'); -insert into person (id, email, firstname, lastname, version, is_okr_champion) +insert into person (id, email, firstName, lastName, version, is_okr_champion) values (1, 'peggimann@puzzle.ch', 'Paco', 'Eggimann', 1, TRUE), (2, 'leimgruber@puzzle.ch', 'Philipp', 'Leimgruber', 1, TRUE), (3, 'brantschen@puzzle.ch', 'Jean-Claude', 'Brantschen', 1, TRUE), diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts index b4180d7a7c..2308888115 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts @@ -3,22 +3,22 @@ import { uniqueSuffix } from '../../utils'; import Chainable = Cypress.Chainable; export default class InviteMembersDialog extends Dialog { - private readonly firstnames: string[] = []; + private readonly firstNames: string[] = []; override validatePage() { super.validatePage(); this.getPage().contains('Members registrieren').should('exist'); } - enterUser(firstname: string, lastname: string, email: string) { - firstname = uniqueSuffix(firstname); + enterUser(firstName: string, lastName: string, email: string) { + firstName = uniqueSuffix(firstName); email = uniqueSuffix(email); - this.firstnames.push(firstname); - const firstnameInput = cy.get('[formcontrolname="firstname"]').last(); - const lastnameInput = cy.get('[formcontrolname="lastname"]').last(); + this.firstNames.push(firstName); + const firstNameInput = cy.get('[formcontrolname="firstName"]').last(); + const lastNameInput = cy.get('[formcontrolname="lastName"]').last(); const emailInput = cy.get('[formcontrolname="email"]').last(); - this.fillInput(firstnameInput, firstname); - this.fillInput(lastnameInput, lastname); + this.fillInput(firstNameInput, firstName); + this.fillInput(lastNameInput, lastName); this.fillInput(emailInput, email); return this; } @@ -28,12 +28,12 @@ export default class InviteMembersDialog extends Dialog { return this; } getFirstnames() { - return this.firstnames; + return this.firstNames; } override submit() { cy.getByTestId('invite').click(); - return this.firstnames; + return this.firstNames; } getPage(): Chainable { diff --git a/frontend/src/app/components/key-result-form/key-result-form.component.html b/frontend/src/app/components/key-result-form/key-result-form.component.html index 1697565fe0..b0fcff7688 100644 --- a/frontend/src/app/components/key-result-form/key-result-form.component.html +++ b/frontend/src/app/components/key-result-form/key-result-form.component.html @@ -35,7 +35,7 @@ /> - {{ user.firstname + " " + user.lastname }} + {{ user.firstName + " " + user.lastName }} diff --git a/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts b/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts index bbb5262ab1..616d931203 100644 --- a/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts +++ b/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts @@ -38,7 +38,7 @@ describe('KeyResultFormComponent', () => { const oauthMockService = { getIdentityClaims() { - return { name: users[1].firstname + ' ' + users[1].lastname }; + return { name: users[1].firstName + ' ' + users[1].lastName }; }, }; @@ -246,7 +246,7 @@ describe('KeyResultFormComponent', () => { }); it('should get username from oauthService right', () => { - expect(component.getLoggedInUserName()).toEqual(testUser.firstname + ' ' + testUser.lastname); + expect(component.getLoggedInUserName()).toEqual(testUser.firstName + ' ' + testUser.lastName); }); }); }); diff --git a/frontend/src/app/components/keyresult-detail/keyresult-detail.component.html b/frontend/src/app/components/keyresult-detail/keyresult-detail.component.html index 7eecee0230..59d40cfb99 100644 --- a/frontend/src/app/components/keyresult-detail/keyresult-detail.component.html +++ b/frontend/src/app/components/keyresult-detail/keyresult-detail.component.html @@ -14,7 +14,7 @@

person icon -

{{ owner.firstname }} {{ owner.lastname }}

+

{{ owner.firstName }} {{ owner.lastName }}

{{ quarter.label }}

diff --git a/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts b/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts index e13b93a55d..e72f366b4e 100644 --- a/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts +++ b/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts @@ -36,7 +36,7 @@ describe('KeyresultDialogComponent', () => { const oauthMockService = { getIdentityClaims() { - return { name: users[1].firstname + ' ' + users[1].lastname }; + return { name: users[1].firstName + ' ' + users[1].lastName }; }, }; diff --git a/frontend/src/app/shared/testData.ts b/frontend/src/app/shared/testData.ts index ec9dce9fb5..5c70ca4edb 100644 --- a/frontend/src/app/shared/testData.ts +++ b/frontend/src/app/shared/testData.ts @@ -357,8 +357,8 @@ export const secondCheckIn: CheckInMin = { export const testUser: User = { id: 1, - firstname: 'Bob', - lastname: 'Baumeister', + firstName: 'Bob', + lastName: 'Baumeister', isOkrChampion: false, userTeamList: [ { @@ -374,24 +374,24 @@ export const users: User[] = [ testUser, { id: 2, - firstname: 'Paco', - lastname: 'Egiman', + firstName: 'Paco', + lastName: 'Egiman', isOkrChampion: true, userTeamList: [], email: 'peggimann@puzzle.ch', }, { id: 3, - firstname: 'Robin', - lastname: 'Papier', + firstName: 'Robin', + lastName: 'Papier', isOkrChampion: false, userTeamList: [], email: 'robin.papier@puzzle.ch', }, { id: 4, - firstname: 'Key Result', - lastname: 'Owner', + firstName: 'Key Result', + lastName: 'Owner', isOkrChampion: false, userTeamList: [], email: 'keyresult.owner@puzzle.ch', diff --git a/frontend/src/app/shared/types/model/NewUser.ts b/frontend/src/app/shared/types/model/NewUser.ts index f793306897..1547b4e928 100644 --- a/frontend/src/app/shared/types/model/NewUser.ts +++ b/frontend/src/app/shared/types/model/NewUser.ts @@ -1,5 +1,5 @@ export interface NewUser { - firstname: string; - lastname: string; + firstName: string; + lastName: string; email: string; } diff --git a/frontend/src/app/shared/types/model/NewUserForm.ts b/frontend/src/app/shared/types/model/NewUserForm.ts index 800df9f04a..48a6479ce0 100644 --- a/frontend/src/app/shared/types/model/NewUserForm.ts +++ b/frontend/src/app/shared/types/model/NewUserForm.ts @@ -1,5 +1,5 @@ export interface NewUserForm { - firstname: T; + firstName: T; email: T; - lastname: T; + lastName: T; } diff --git a/frontend/src/app/shared/types/model/User.ts b/frontend/src/app/shared/types/model/User.ts index 736edc9bb9..230abc8481 100644 --- a/frontend/src/app/shared/types/model/User.ts +++ b/frontend/src/app/shared/types/model/User.ts @@ -3,8 +3,8 @@ import { UserTableEntry } from './UserTableEntry'; export interface User { id: number; - firstname: string; - lastname: string; + firstName: string; + lastName: string; email: string; userTeamList: UserTeam[]; isOkrChampion: boolean; @@ -15,5 +15,5 @@ export const extractTeamsFromUser = (user: User) => { }; export const getFullNameFromUser = (user: User | UserTableEntry) => { - return `${user.firstname} ${user.lastname}`; + return `${user.firstName} ${user.lastName}`; }; diff --git a/frontend/src/app/shared/types/model/UserTableEntry.ts b/frontend/src/app/shared/types/model/UserTableEntry.ts index 5c332b5bdf..71ea26497b 100644 --- a/frontend/src/app/shared/types/model/UserTableEntry.ts +++ b/frontend/src/app/shared/types/model/UserTableEntry.ts @@ -4,8 +4,8 @@ import { UserTeam } from './UserTeam'; export interface UserTableEntry { id: number; - firstname: string; - lastname: string; + firstName: string; + lastName: string; email: string; teams: string[]; roles: string[]; @@ -30,7 +30,7 @@ export const convertFromUsers = (users: User[], teamId: number | null): UserTabl .filter((u) => u.userTeamList.length) .map((u) => convertFromUser(u)); } - return userTableEntries.sort((a, b) => a.firstname.localeCompare(b.firstname)); + return userTableEntries.sort((a, b) => a.firstName.localeCompare(b.firstName)); }; export const convertFromUser = (user: User): UserTableEntry => { @@ -45,8 +45,8 @@ export const convertFromUser = (user: User): UserTableEntry => { return { id: user.id, - firstname: user.firstname, - lastname: user.lastname, + firstName: user.firstName, + lastName: user.lastName, email: user.email, teams, roles, diff --git a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts index 45b9c9bd51..37eaa25ba9 100644 --- a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts +++ b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts @@ -103,7 +103,7 @@ describe('AddMemberToTeamDialogComponent', () => { }); it('should return correct display value', () => { - expect(component.getDisplayValue(users[0])).toBe(`${users[0].firstname} ${users[0].lastname} (${users[0].email})`); + expect(component.getDisplayValue(users[0])).toBe(`${users[0].firstName} ${users[0].lastName} (${users[0].email})`); }); it('should add user to selected users and restore search value', () => { diff --git a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts index 00fce4104d..57aca0a799 100644 --- a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts +++ b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts @@ -92,7 +92,7 @@ export class AddMemberToTeamDialogComponent implements OnInit, OnDestroy { if (!user) { return ''; } - return `${user.firstname} ${user.lastname} (${user.email})`; + return `${user.firstName} ${user.lastName} (${user.email})`; } selectUser(user: User) { diff --git a/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts b/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts index 35c7992795..9d32f44432 100644 --- a/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts +++ b/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts @@ -40,8 +40,8 @@ describe('DeleteUserComponent', () => { component = fixture.componentInstance; component.user = { id: 2, - firstname: 'Hans', - lastname: 'Muster', + firstName: 'Hans', + lastName: 'Muster', isOkrChampion: false, userTeamList: [], email: 'hans.muster@puzzle.ch', diff --git a/frontend/src/app/team-management/delete-user/delete-user.component.ts b/frontend/src/app/team-management/delete-user/delete-user.component.ts index 273bd54561..3db9b1e205 100644 --- a/frontend/src/app/team-management/delete-user/delete-user.component.ts +++ b/frontend/src/app/team-management/delete-user/delete-user.component.ts @@ -136,7 +136,7 @@ export class DeleteUserComponent implements OnInit { deleteUser() { const data: ConfirmDialogData = { title: `User löschen`, - text: `Möchtest du den User ${this.user.firstname} ${this.user.lastname} wirklich löschen?`, + text: `Möchtest du den User ${this.user.firstName} ${this.user.lastName} wirklich löschen?`, yesButtonState: ButtonState.VisibleEnabled, noButtonState: ButtonState.VisibleEnabled, closeButtonState: ButtonState.Hidden, diff --git a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts index 52e589add3..137f514454 100644 --- a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts +++ b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts @@ -18,9 +18,9 @@ describe('InviteUserDialogComponent', () => { let component: InviteUserDialogComponent; let fixture: ComponentFixture; - const user1 = { firstname: 'user1', lastname: '1user', email: 'user1@user.ch' }; - const user2 = { firstname: 'user2', lastname: '2user', email: 'user2@user.ch' }; - const user3 = { firstname: 'user3', lastname: '3user', email: 'user3@user.ch' }; + const user1 = { firstName: 'user1', lastName: '1user', email: 'user1@user.ch' }; + const user2 = { firstName: 'user2', lastName: '2user', email: 'user2@user.ch' }; + const user3 = { firstName: 'user3', lastName: '3user', email: 'user3@user.ch' }; const userServiceMock = { createUsers: jest.fn(), diff --git a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts index 36b8d1ac15..7df937685f 100644 --- a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts +++ b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts @@ -50,8 +50,8 @@ export class InviteUserDialogComponent { private createUserFormGroup() { return this.formBuilder.group({ - firstname: this.formBuilder.control('', [Validators.required, Validators.minLength(1)]), - lastname: this.formBuilder.control('', [Validators.required, Validators.minLength(1)]), + firstName: this.formBuilder.control('', [Validators.required, Validators.minLength(1)]), + lastName: this.formBuilder.control('', [Validators.required, Validators.minLength(1)]), email: this.formBuilder.control('', [ Validators.required, Validators.minLength(1), diff --git a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.html b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.html index 43ba8f2118..9d33cf1e2b 100644 --- a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.html +++ b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.html @@ -10,7 +10,7 @@ Name - {{ element.firstname }} {{ element.lastname }} + {{ element.firstName }} {{ element.lastName }} diff --git a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts index 89d1b8b36a..bb5516e351 100644 --- a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts +++ b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts @@ -57,7 +57,7 @@ export class MemberListTableComponent implements OnInit, OnDestroy { event.stopPropagation(); event.preventDefault(); const i18nData = { - user: `${entry.firstname} ${entry.lastname}`, + user: `${entry.firstName} ${entry.lastName}`, team: this.selectedTeam$.value?.name, }; this.dialogService diff --git a/frontend/src/app/team-management/member-list/member-list.component.spec.ts b/frontend/src/app/team-management/member-list/member-list.component.spec.ts index 6dd87bfec6..f54cbce6e4 100644 --- a/frontend/src/app/team-management/member-list/member-list.component.spec.ts +++ b/frontend/src/app/team-management/member-list/member-list.component.spec.ts @@ -95,8 +95,8 @@ describe('MemberListComponent', () => { let userTableEntry = convertFromUser(user); expect(userTableEntry.id).toBe(user.id); - expect(userTableEntry.firstname).toBe(user.firstname); - expect(userTableEntry.lastname).toBe(user.lastname); + expect(userTableEntry.firstName).toBe(user.firstName); + expect(userTableEntry.lastName).toBe(user.lastName); expect(userTableEntry.email).toBe(user.email); expect(userTableEntry.roles).toStrictEqual([UserRole.TEAM_MEMBER]); expect(userTableEntry.isOkrChampion).toBeFalsy(); @@ -154,7 +154,7 @@ describe('MemberListComponent', () => { // test that it makes a deep copy expect(userTableEntries).not.toBe(usersCopy); // should be sorted - expect(userTableEntries.map((ut) => ut.firstname)).toStrictEqual(['Bob', 'Key Result', 'Paco', 'Robin']); + expect(userTableEntries.map((ut) => ut.firstName)).toStrictEqual(['Bob', 'Key Result', 'Paco', 'Robin']); }); it('ngAfterViewInit should load all Users, set teamId, selectedTeam and update data source correctly', fakeAsync(() => { diff --git a/frontend/src/app/team-management/new-user/new-user.component.html b/frontend/src/app/team-management/new-user/new-user.component.html index 662bd4a78b..f46861ad20 100644 --- a/frontend/src/app/team-management/new-user/new-user.component.html +++ b/frontend/src/app/team-management/new-user/new-user.component.html @@ -1,40 +1,40 @@
-
+
@if (index === 0) { - + } - @if (firstname.errors?.["required"] && triedToSubmit) { + @if (firstName.errors?.["required"] && triedToSubmit) { Angabe benötigt }
-
+
@if (index === 0) { - + } - @if (lastname.errors?.["required"] && triedToSubmit) { + @if (lastName.errors?.["required"] && triedToSubmit) { Angabe benötigt } @@ -67,11 +67,11 @@
@if (index === 0) { - + } diff --git a/frontend/src/app/team-management/new-user/new-user.component.spec.ts b/frontend/src/app/team-management/new-user/new-user.component.spec.ts index 3934b994ad..95cc55a234 100644 --- a/frontend/src/app/team-management/new-user/new-user.component.spec.ts +++ b/frontend/src/app/team-management/new-user/new-user.component.spec.ts @@ -23,8 +23,8 @@ describe('NewUserComponent', () => { component = fixture.componentInstance; component.userFormGroup = new FormGroup>({ - firstname: new FormControl('user1'), - lastname: new FormControl('user'), + firstName: new FormControl('user1'), + lastName: new FormControl('user'), email: new FormControl('test@test.ch'), }); diff --git a/frontend/src/app/team-management/new-user/new-user.component.ts b/frontend/src/app/team-management/new-user/new-user.component.ts index 2ef11f8b3c..953890f408 100644 --- a/frontend/src/app/team-management/new-user/new-user.component.ts +++ b/frontend/src/app/team-management/new-user/new-user.component.ts @@ -40,12 +40,12 @@ export class NewUserComponent implements AfterViewInit { this.removeUser.emit(); } - get firstname() { - return this.userFormGroup.controls.firstname; + get firstName() { + return this.userFormGroup.controls.firstName; } - get lastname() { - return this.userFormGroup.controls.lastname; + get lastName() { + return this.userFormGroup.controls.lastName; } get email() { diff --git a/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts b/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts index 9e6f2ad37a..fabc437a50 100644 --- a/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts +++ b/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts @@ -48,24 +48,24 @@ const teams: Team[] = [ const users: User[] = [ { id: 2, - firstname: 'Pete', - lastname: 'Parrot', + firstName: 'Pete', + lastName: 'Parrot', email: 'parrot@puzzle.ch', userTeamList: [], isOkrChampion: false, }, { id: 1, - firstname: 'Martin', - lastname: 'Käser', + firstName: 'Martin', + lastName: 'Käser', email: 'kaeser@puzzle.ch', userTeamList: [], isOkrChampion: false, }, { id: 3, - firstname: 'Ruedi', - lastname: 'Peters', + firstName: 'Ruedi', + lastName: 'Peters', email: 'rpeter@gmail.com', userTeamList: [], isOkrChampion: false, diff --git a/frontend/src/app/team-management/search-team-management/search-team-management.component.ts b/frontend/src/app/team-management/search-team-management/search-team-management.component.ts index 9676ae1ff0..ecddaaf8f9 100644 --- a/frontend/src/app/team-management/search-team-management/search-team-management.component.ts +++ b/frontend/src/app/team-management/search-team-management/search-team-management.component.ts @@ -114,7 +114,7 @@ export class SearchTeamManagementComponent { private updateTeamsAndUsers(teams: Team[], users: User[]) { this.teams = [...teams].sort((a, b) => a.name.localeCompare(b.name)); - this.users = users.sort((a, b) => (a.firstname + a.lastname).localeCompare(b.firstname + b.lastname)); + this.users = users.sort((a, b) => (a.firstName + a.lastName).localeCompare(b.firstName + b.lastName)); this.applyFilter(this.searchValue$.getValue()); } @@ -130,12 +130,12 @@ export class SearchTeamManagementComponent { private filterUsers(users: User[], filterValue: string): FilteredUser[] { return users - .filter((user) => this.containsText(user.firstname + user.lastname + user.email, filterValue)) + .filter((user) => this.containsText(user.firstName + user.lastName + user.email, filterValue)) .map((user) => ({ ...user, - displayValue: `${user.firstname} ${user.lastname} (${user.email})`, - htmlValue: this.formatText(`${user.firstname} ${user.lastname} (${user.email})`, filterValue), + displayValue: `${user.firstName} ${user.lastName} (${user.email})`, + htmlValue: this.formatText(`${user.firstName} ${user.lastName} (${user.email})`, filterValue), })); }