fix: replace first and last name with single field (#4915)

This commit is contained in:
Brian Austin
2023-11-11 20:03:32 -05:00
committed by GitHub
parent 413ab2c538
commit 7fca0d8da5
98 changed files with 567 additions and 1147 deletions
+3 -6
View File
@@ -350,8 +350,7 @@ describe(`${ActivityController.name} (e2e)`, () => {
const { id: userId } = await api.userApi.create(server, admin.accessToken, {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
});
await api.albumApi.addUsers(server, admin.accessToken, album.id, { sharedUserIds: [userId] });
const nonOwner = await api.authApi.login(server, { email: 'user1@immich.app', password: 'Password123' });
@@ -371,8 +370,7 @@ describe(`${ActivityController.name} (e2e)`, () => {
const { id: userId } = await api.userApi.create(server, admin.accessToken, {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
});
await api.albumApi.addUsers(server, admin.accessToken, album.id, { sharedUserIds: [userId] });
const nonOwner = await api.authApi.login(server, { email: 'user1@immich.app', password: 'Password123' });
@@ -393,8 +391,7 @@ describe(`${ActivityController.name} (e2e)`, () => {
const { id: userId } = await api.userApi.create(server, admin.accessToken, {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
});
await api.albumApi.addUsers(server, admin.accessToken, album.id, { sharedUserIds: [userId] });
const nonOwner = await api.authApi.login(server, { email: 'user1@immich.app', password: 'Password123' });
+2 -4
View File
@@ -41,14 +41,12 @@ describe(`${AlbumController.name} (e2e)`, () => {
api.userApi.create(server, admin.accessToken, {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
}),
api.userApi.create(server, admin.accessToken, {
email: 'user2@immich.app',
password: 'Password123',
firstName: 'User 2',
lastName: 'Test',
name: 'User 2',
}),
]);
+2 -4
View File
@@ -22,15 +22,13 @@ import request from 'supertest';
const user1Dto = {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
};
const user2Dto = {
email: 'user2@immich.app',
password: 'Password123',
firstName: 'User 2',
lastName: 'Test',
name: 'User 2',
};
const makeUploadDto = (options?: { omit: string }): Record<string, any> => {
+7 -13
View File
@@ -13,15 +13,13 @@ import {
import { testApp } from '@test/test-utils';
import request from 'supertest';
const firstName = 'Immich';
const lastName = 'Admin';
const name = 'Immich Admin';
const password = 'Password123';
const email = 'admin@immich.app';
const adminSignupResponse = {
id: expect.any(String),
firstName: 'Immich',
lastName: 'Admin',
name: 'Immich Admin',
email: 'admin@immich.app',
storageLabel: 'admin',
externalPath: null,
@@ -64,23 +62,19 @@ describe(`${AuthController.name} (e2e)`, () => {
const invalid = [
{
should: 'require an email address',
data: { firstName, lastName, password },
data: { name, password },
},
{
should: 'require a password',
data: { firstName, lastName, email },
data: { name, email },
},
{
should: 'require a first name ',
data: { lastName, email, password },
},
{
should: 'require a last name ',
data: { firstName, email, password },
should: 'require a name',
data: { email, password },
},
{
should: 'require a valid email',
data: { firstName, lastName, email: 'immich', password },
data: { name, email: 'immich', password },
},
];
+2 -4
View File
@@ -15,15 +15,13 @@ describe(`${LibraryController.name} (e2e)`, () => {
const user1Dto = {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
};
const user2Dto = {
email: 'user2@immich.app',
password: 'Password123',
firstName: 'User 2',
lastName: 'Test',
name: 'User 2',
};
beforeAll(async () => {
+2 -4
View File
@@ -10,15 +10,13 @@ import request from 'supertest';
const user1Dto = {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
};
const user2Dto = {
email: 'user2@immich.app',
password: 'Password123',
firstName: 'User 2',
lastName: 'Test',
name: 'User 2',
};
describe(`${PartnerController.name} (e2e)`, () => {
+2 -3
View File
@@ -111,7 +111,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
it('should only work for admins', async () => {
const loginDto = { email: 'test@immich.app', password: 'Immich123' };
await api.userApi.create(server, accessToken, { ...loginDto, firstName: 'test', lastName: 'test' });
await api.userApi.create(server, accessToken, { ...loginDto, name: 'test' });
const { accessToken: userAccessToken } = await api.authApi.login(server, loginDto);
const { status, body } = await request(server)
.get('/server-info/statistics')
@@ -132,9 +132,8 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
{
photos: 0,
usage: 0,
userFirstName: 'Immich',
userName: 'Immich Admin',
userId: loginResponse.userId,
userLastName: 'Admin',
videos: 0,
},
],
+1 -2
View File
@@ -11,8 +11,7 @@ import request from 'supertest';
const user1Dto = {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
};
describe(`${PartnerController.name} (e2e)`, () => {
+1 -2
View File
@@ -64,8 +64,7 @@ describe(`${SystemConfigController.name} (e2e)`, () => {
const credentials = { email: 'user1@immich.app', password: 'Password123' };
await api.userApi.create(server, admin.accessToken, {
...credentials,
firstName: 'User 1',
lastName: 'Test',
name: 'User 1',
});
const { accessToken } = await api.authApi.login(server, credentials);
const { status, body } = await request(server)
+8 -16
View File
@@ -59,8 +59,7 @@ describe(`${UserController.name}`, () => {
const user1 = await api.userApi.create(server, accessToken, {
email: `user1@immich.app`,
password: 'Password123',
firstName: `User 1`,
lastName: 'Test',
name: `User 1`,
});
await api.userApi.delete(server, accessToken, user1.id);
@@ -78,8 +77,7 @@ describe(`${UserController.name}`, () => {
const user1 = await api.userApi.create(server, accessToken, {
email: `user1@immich.app`,
password: 'Password123',
firstName: `User 1`,
lastName: 'Test',
name: `User 1`,
});
await api.userApi.delete(server, accessToken, user1.id);
@@ -149,8 +147,7 @@ describe(`${UserController.name}`, () => {
isAdmin: true,
email: 'user1@immich.app',
password: 'Password123',
firstName: 'Immich',
lastName: 'User',
name: 'Immich',
})
.set('Authorization', `Bearer ${accessToken}`);
expect(body).toMatchObject({
@@ -167,8 +164,7 @@ describe(`${UserController.name}`, () => {
.send({
email: 'no-memories@immich.app',
password: 'Password123',
firstName: 'No Memories',
lastName: 'User',
name: 'No Memories',
memoriesEnabled: false,
})
.set('Authorization', `Bearer ${accessToken}`);
@@ -186,8 +182,7 @@ describe(`${UserController.name}`, () => {
beforeEach(async () => {
userToDelete = await api.userApi.create(server, accessToken, {
email: userStub.user1.email,
firstName: userStub.user1.firstName,
lastName: userStub.user1.lastName,
name: userStub.user1.name,
password: 'superSecurePassword',
});
});
@@ -246,8 +241,7 @@ describe(`${UserController.name}`, () => {
const user = await api.userApi.create(server, accessToken, {
email: 'user1@immich.app',
password: 'Password123',
firstName: 'Immich',
lastName: 'User',
name: 'Immich User',
});
const { status, body } = await request(server)
@@ -284,15 +278,13 @@ describe(`${UserController.name}`, () => {
const before = await api.userApi.get(server, accessToken, loginResponse.userId);
const after = await api.userApi.update(server, accessToken, {
id: before.id,
firstName: 'First Name',
lastName: 'Last Name',
name: 'Name',
});
expect(after).toEqual({
...before,
updatedAt: expect.any(String),
firstName: 'First Name',
lastName: 'Last Name',
name: 'Name',
});
expect(before.updatedAt).not.toEqual(after.updatedAt);
});