refactor(register-dto): rename displayname -> displayName

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-02-14 11:12:35 +01:00
parent 6f1bdcbaa5
commit 64b16c831e
4 changed files with 12 additions and 12 deletions

View file

@ -47,7 +47,7 @@ export class AuthController {
async registerUser(@Body() registerDto: RegisterDto): Promise<void> { async registerUser(@Body() registerDto: RegisterDto): Promise<void> {
const user = await this.usersService.createUser( const user = await this.usersService.createUser(
registerDto.username, registerDto.username,
registerDto.displayname, registerDto.displayName,
); );
// ToDo: Figure out how to rollback user if anything with this calls goes wrong // ToDo: Figure out how to rollback user if anything with this calls goes wrong
await this.identityService.createLocalIdentity(user, registerDto.password); await this.identityService.createLocalIdentity(user, registerDto.password);

View file

@ -10,7 +10,7 @@ export class RegisterDto {
username: string; username: string;
@IsString() @IsString()
displayname: string; displayName: string;
@IsString() @IsString()
password: string; password: string;

View file

@ -21,7 +21,7 @@ describe('Auth', () => {
let testSetup: TestSetup; let testSetup: TestSetup;
let username: string; let username: string;
let displayname: string; let displayName: string;
let password: string; let password: string;
beforeAll(async () => { beforeAll(async () => {
@ -29,7 +29,7 @@ describe('Auth', () => {
await testSetup.app.init(); await testSetup.app.init();
username = 'hardcoded'; username = 'hardcoded';
displayname = 'Testy'; displayName = 'Testy';
password = 'test_password'; password = 'test_password';
}); });
@ -40,7 +40,7 @@ describe('Auth', () => {
describe('POST /auth/local', () => { describe('POST /auth/local', () => {
it('works', async () => { it('works', async () => {
const registrationDto: RegisterDto = { const registrationDto: RegisterDto = {
displayname: displayname, displayName: displayName,
password: password, password: password,
username: username, username: username,
}; };
@ -52,7 +52,7 @@ describe('Auth', () => {
const newUser = await testSetup.userService.getUserByUsername(username, [ const newUser = await testSetup.userService.getUserByUsername(username, [
UserRelationEnum.IDENTITIES, UserRelationEnum.IDENTITIES,
]); ]);
expect(newUser.displayName).toEqual(displayname); expect(newUser.displayName).toEqual(displayName);
await expect(newUser.identities).resolves.toHaveLength(1); await expect(newUser.identities).resolves.toHaveLength(1);
await expect( await expect(
checkPassword( checkPassword(
@ -64,9 +64,9 @@ describe('Auth', () => {
describe('fails', () => { describe('fails', () => {
it('when the user already exits', async () => { it('when the user already exits', async () => {
const username2 = 'already_existing'; const username2 = 'already_existing';
await testSetup.userService.createUser(username2, displayname); await testSetup.userService.createUser(username2, displayName);
const registrationDto: RegisterDto = { const registrationDto: RegisterDto = {
displayname: displayname, displayName: displayName,
password: password, password: password,
username: username2, username: username2,
}; };
@ -79,7 +79,7 @@ describe('Auth', () => {
it('when registration is disabled', async () => { it('when registration is disabled', async () => {
testSetup.configService.get('authConfig').local.enableRegister = false; testSetup.configService.get('authConfig').local.enableRegister = false;
const registrationDto: RegisterDto = { const registrationDto: RegisterDto = {
displayname: displayname, displayName: displayName,
password: password, password: password,
username: username, username: username,
}; };

View file

@ -29,7 +29,7 @@ describe('Register and Login', () => {
test('a user can successfully create a local account and log in', async () => { test('a user can successfully create a local account and log in', async () => {
// register a new user // register a new user
const registrationDto: RegisterDto = { const registrationDto: RegisterDto = {
displayname: DISPLAYNAME, displayName: DISPLAYNAME,
password: PASSWORD, password: PASSWORD,
username: USERNAME, username: USERNAME,
}; };
@ -67,7 +67,7 @@ describe('Register and Login', () => {
test('a username cannot be used twice', async () => { test('a username cannot be used twice', async () => {
// register a new user // register a new user
const registrationDto: RegisterDto = { const registrationDto: RegisterDto = {
displayname: DISPLAYNAME, displayName: DISPLAYNAME,
password: PASSWORD, password: PASSWORD,
username: USERNAME, username: USERNAME,
}; };
@ -88,7 +88,7 @@ describe('Register and Login', () => {
test('a user can create a local account and change the password', async () => { test('a user can create a local account and change the password', async () => {
// register a new user // register a new user
const registrationDto: RegisterDto = { const registrationDto: RegisterDto = {
displayname: DISPLAYNAME, displayName: DISPLAYNAME,
password: PASSWORD, password: PASSWORD,
username: USERNAME, username: USERNAME,
}; };