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> {
const user = await this.usersService.createUser(
registerDto.username,
registerDto.displayname,
registerDto.displayName,
);
// ToDo: Figure out how to rollback user if anything with this calls goes wrong
await this.identityService.createLocalIdentity(user, registerDto.password);

View file

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

View file

@ -21,7 +21,7 @@ describe('Auth', () => {
let testSetup: TestSetup;
let username: string;
let displayname: string;
let displayName: string;
let password: string;
beforeAll(async () => {
@ -29,7 +29,7 @@ describe('Auth', () => {
await testSetup.app.init();
username = 'hardcoded';
displayname = 'Testy';
displayName = 'Testy';
password = 'test_password';
});
@ -40,7 +40,7 @@ describe('Auth', () => {
describe('POST /auth/local', () => {
it('works', async () => {
const registrationDto: RegisterDto = {
displayname: displayname,
displayName: displayName,
password: password,
username: username,
};
@ -52,7 +52,7 @@ describe('Auth', () => {
const newUser = await testSetup.userService.getUserByUsername(username, [
UserRelationEnum.IDENTITIES,
]);
expect(newUser.displayName).toEqual(displayname);
expect(newUser.displayName).toEqual(displayName);
await expect(newUser.identities).resolves.toHaveLength(1);
await expect(
checkPassword(
@ -64,9 +64,9 @@ describe('Auth', () => {
describe('fails', () => {
it('when the user already exits', async () => {
const username2 = 'already_existing';
await testSetup.userService.createUser(username2, displayname);
await testSetup.userService.createUser(username2, displayName);
const registrationDto: RegisterDto = {
displayname: displayname,
displayName: displayName,
password: password,
username: username2,
};
@ -79,7 +79,7 @@ describe('Auth', () => {
it('when registration is disabled', async () => {
testSetup.configService.get('authConfig').local.enableRegister = false;
const registrationDto: RegisterDto = {
displayname: displayname,
displayName: displayName,
password: password,
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 () => {
// register a new user
const registrationDto: RegisterDto = {
displayname: DISPLAYNAME,
displayName: DISPLAYNAME,
password: PASSWORD,
username: USERNAME,
};
@ -67,7 +67,7 @@ describe('Register and Login', () => {
test('a username cannot be used twice', async () => {
// register a new user
const registrationDto: RegisterDto = {
displayname: DISPLAYNAME,
displayName: DISPLAYNAME,
password: PASSWORD,
username: USERNAME,
};
@ -88,7 +88,7 @@ describe('Register and Login', () => {
test('a user can create a local account and change the password', async () => {
// register a new user
const registrationDto: RegisterDto = {
displayname: DISPLAYNAME,
displayName: DISPLAYNAME,
password: PASSWORD,
username: USERNAME,
};