Skip to content

Commit

Permalink
fix no implicit public part3
Browse files Browse the repository at this point in the history
  • Loading branch information
MajedAlaitwniCap committed Dec 13, 2024
1 parent 7ee84ca commit 4d529e5
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
6 changes: 3 additions & 3 deletions apps/server/src/modules/account/domain/update-account.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export class UpdateAccount {
username?: string;
public username?: string;

password?: string;
public password?: string;

activated?: boolean;
public activated?: boolean;

constructor(props: UpdateAccount) {
this.username = props.username;
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/modules/account/domain/update-my-account.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export class UpdateMyAccount {
passwordOld!: string;
public passwordOld!: string;

passwordNew?: string;
public passwordNew?: string;

email?: string;
public email?: string;

firstName?: string;
public firstName?: string;

lastName?: string;
public lastName?: string;

constructor(props: UpdateMyAccount) {
this.passwordOld = props.passwordOld;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ describe('account repo', () => {
expect(repo.entityName).toBe(AccountEntity);
});

describe('mapDOToEntityProperties', () => {
describe('When an account is given', () => {
it('should map the account to an entity', () => {
const account = accountDoFactory.build();
const entityProps = AccountDoToEntityMapper.mapToEntity(account);

expect(entityProps).toEqual(expect.objectContaining(account.getProps()));
});
});

describe('When an account with partial props is given', () => {
it('should map the account to an entity', () => {
const account = accountDoFactory.build({ id: new ObjectId().toHexString(), username: 'John Doe' });
const entityProps = AccountDoToEntityMapper.mapToEntity(account);

expect(entityProps).toEqual(expect.objectContaining(account.getProps()));
});
});
});

describe('save', () => {
describe('When an account is given', () => {
it('should save an account', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Account } from '../../../domain/account';
import { AccountEntity } from '../../../domain/entity/account.entity';

export class AccountEntityToDoMapper {
static mapToDo(account: AccountEntity): Account {
public static mapToDo(account: AccountEntity): Account {
return new Account({
id: account.id,
createdAt: account.createdAt,
Expand All @@ -22,13 +22,13 @@ export class AccountEntityToDoMapper {
});
}

static mapCountedEntities(accountEntities: Counted<AccountEntity[]>): Counted<Account[]> {
public static mapCountedEntities(accountEntities: Counted<AccountEntity[]>): Counted<Account[]> {
const foundAccounts = accountEntities[0];
const accountDtos: Account[] = AccountEntityToDoMapper.mapEntitiesToDos(foundAccounts);
return [accountDtos, accountEntities[1]];
}

static mapEntitiesToDos(accounts: AccountEntity[]): Account[] {
public static mapEntitiesToDos(accounts: AccountEntity[]): Account[] {
return accounts.map((accountEntity) => AccountEntityToDoMapper.mapToDo(accountEntity));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { Account } from '../../../domain/account';

@Injectable()
export abstract class AccountIdmToDoMapper {
abstract mapToDo(account: IdmAccount): Account;
public abstract mapToDo(account: IdmAccount): Account;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Account } from '../../../domain/account';
import { AccountIdmToDoMapper } from './account-idm-to-do.mapper.abstract';

export class AccountIdmToDoMapperDb extends AccountIdmToDoMapper {
mapToDo(account: IdmAccount): Account {
public mapToDo(account: IdmAccount): Account {
const createdDate = account.createdDate ? account.createdDate : new Date();
return new Account({
id: account.attDbcAccountId ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Account } from '../../../domain/account';
import { AccountIdmToDoMapper } from './account-idm-to-do.mapper.abstract';

export class AccountIdmToDoMapperIdm extends AccountIdmToDoMapper {
mapToDo(account: IdmAccount): Account {
public mapToDo(account: IdmAccount): Account {
const createdDate = account.createdDate ? account.createdDate : new Date();
return new Account({
id: account.id,
Expand Down

0 comments on commit 4d529e5

Please sign in to comment.