-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
94 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ecorator/application.service.decorator.ts → ...corators/application.service.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ror-decorator/audith.service.decorator.ts → ...ce/decorators/audith.service.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...r/loggin-application.service.decorator.ts → ...s/loggin-application.service.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...notifier-application-service.decorator.ts → ...notifier-application-service.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IAudithRepository { | ||
addAudith(user_id: string, operation: string, data: string): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/common/infrastructure/repositories/audithRepository.impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Column, Entity,PrimaryGeneratedColumn } from "typeorm"; | ||
@Entity('auditorias') | ||
export class Audith { | ||
@PrimaryGeneratedColumn('uuid') | ||
id: string; | ||
@Column({ type: 'json', nullable: false }) | ||
origin: JSON; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Phone } from 'src/phones/domain/phoneAggregate/phone'; | ||
import { phoneId } from 'src/phones/domain/phoneAggregate/value-objects/phoneId'; | ||
import { phoneNumber } from 'src/phones/domain/phoneAggregate/value-objects/phoneNumber'; | ||
|
||
|
||
/*static create(id: string, _phoneNumber: string, id_line:string,line: string): Phone { | ||
return new Phone(phoneId.create(id), phoneNumber.create(_phoneNumber), Line.create(id_line,Object.keys(phoneOperatorsEnum).find(key => phoneOperatorsEnum[key] === line))); | ||
}*/ | ||
|
||
export class PhoneObjectMother { | ||
static createPhone() { | ||
let phone = Phone.create( | ||
'9d934281-d626-44e4-8e1f-14b17504823b', | ||
'4121234567', | ||
'a9ebe28a-26fb-4f73-9a81-088a31211d98', | ||
'Digitel'); | ||
return phone; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
// import { ItransactionHandler } from 'src/common/domain/transaction_handler/transaction_handler'; | ||
// import { QueryRunner } from 'typeorm'; | ||
import { ItransactionHandler } from 'src/common/domain/transaction_handler/transaction_handler'; | ||
import { QueryRunner } from 'typeorm'; | ||
|
||
// export class TransactionHandlerMock implements ItransactionHandler { | ||
// constructor(private readonly runner: QueryRunner) { | ||
// this.runner = runner; | ||
// } | ||
// async startTransaction() { | ||
// return this.runner.startTransaction(); | ||
// } | ||
// async commitTransaction() { | ||
// return await this.runner.commitTransaction(); | ||
// } | ||
// async rollbackTransaction() { | ||
// return await this.runner.rollbackTransaction(); | ||
// } | ||
export class TransactionHandlerMock implements ItransactionHandler { | ||
constructor(private readonly runner: QueryRunner) { | ||
this.runner = runner; | ||
} | ||
async startTransaction() { | ||
return this.runner.startTransaction(); | ||
} | ||
async commitTransaction() { | ||
return await this.runner.commitTransaction(); | ||
} | ||
async rollbackTransaction() { | ||
return await this.runner.rollbackTransaction(); | ||
} | ||
|
||
// getRunner(): QueryRunner { | ||
// return this.runner; | ||
// } | ||
// } | ||
getRunner(): QueryRunner { | ||
return this.runner; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import { FindUserByPhoneTest } from '../core/objects-mother/FindUserByPhoneTest'; | ||
import { UserRepositoryMock } from '../core/repository-mocks/user.repository.mock'; | ||
import { UserObjectMother } from 'test/core/objects-mother/user.object-mother'; | ||
import { SignUserInTest } from 'test/core/objects-mother/SignUserInTest'; | ||
import { PhoneObjectMother } from 'test/core/objects-mother/phone.object-mother'; | ||
|
||
describe('Testing SignUserIn Service...', () => { | ||
test('test', async () => { | ||
//Arrange | ||
const user = UserObjectMother.createUser(); | ||
const phone = PhoneObjectMother.createPhone(); | ||
const mock = new UserRepositoryMock(); | ||
const findByPhoneUserService = FindUserByPhoneTest.findUserByPhoneService(mock,null); | ||
const service = SignUserInTest.SignUserInService(findByPhoneUserService); | ||
|
||
//Act | ||
const findUser = await findByPhoneUserService.execute(user.Phone.PhoneNumber.phoneNumber,); | ||
const result = await service.execute(findUser.Value.Phone.PhoneNumber.phoneNumber); | ||
const result = await service.execute(phone.PhoneNumber.phoneNumber); | ||
|
||
//Assert | ||
expect(result.IsSuccess).toBeTruthy(); | ||
expect(result.Value).not.toBeNull(); | ||
}); | ||
}); |