Skip to content

Commit b5baab6

Browse files
committed
feat: add login use case desacoplado da infrastructure
1 parent 6dfc463 commit b5baab6

22 files changed

Lines changed: 110 additions & 21 deletions

.github/workflows/check.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,11 @@ jobs:
2929
- name: Rodar os testes unitários
3030
run: npm run test:unit
3131

32-
- name: Buildar o Postgres
33-
run: docker compose build postgres
34-
3532
- name: Subir o Postgres
36-
run: docker compose up -d postgres
33+
run: npm run docker:up:postgres
3734

3835
- name: Rodar os testes de integração
3936
run: npm run test:int
4037

4138
- name: Parar o Postgres
42-
run: docker compose down postgres
39+
run: npm run docker:down:postgres

src/application/contracts/password-hashing.interface.ts renamed to src/application/common/utils/password-hashing.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface PasswordHashing {
1+
export interface IPasswordHashing {
22
hash(password: string, salt: number): Promise<string>
33
compare(password: string, hashedPassword: string): Promise<boolean>
44
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { AcessToken } from '../services/acess-token.interface'
2+
3+
export interface IAuthController<T> {
4+
login(data: T): Promise<AcessToken>
5+
}
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export class SignInInput {
2+
email: string
3+
password: string
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export class SenhaInvalidaError extends Error {
2+
constructor() {
3+
super('Senha inválida')
4+
this.name = 'SenhaInvalidaException'
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export class ClienteNaoEncontradoError extends Error {
2+
constructor(client: string) {
3+
super(`Cliente com o identificador '${client}' não encontrado`)
4+
this.name = 'ClienteNaoEncontradoException'
5+
}
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type AcessToken = {
2+
access_token: string
3+
}
File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { UserPayload } from '../controllers/user-payload.props'
2+
3+
export interface IJwtService {
4+
signAsync(payload: UserPayload): Promise<string>
5+
}

0 commit comments

Comments
 (0)