-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(domain): refactored errors in the account and institutional …
…domains Refactored every use cases and respective tests in the account and institutional domains. User already exists error, institution already exists error and unregistered institution error created. Ci file for release altered to create prereleases in the alpha branch.
- Loading branch information
1 parent
f4c6a44
commit ff959d8
Showing
30 changed files
with
359 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ on: | |
workflows: [Run Unit Tests] | ||
types: | ||
- completed | ||
branches: | ||
- alpha | ||
|
||
jobs: | ||
on-success: | ||
|
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
7 changes: 7 additions & 0 deletions
7
src/domain/account/application/use-cases/errors/user-already-exists-error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { UseCaseError } from '@core/errors/use-case-error' | ||
|
||
export class UserAlreadyExistsError extends Error implements UseCaseError { | ||
constructor() { | ||
super('User already exists!') | ||
} | ||
} |
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
12 changes: 8 additions & 4 deletions
12
src/domain/account/application/use-cases/fetch-pending-solicitations.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import { Solicitation } from '@account/enterprise/entities/solicitation' | ||
import { SolicitationsRepository } from '../repositories/solicitations-repository' | ||
import { Either, success } from '@core/either' | ||
|
||
interface FetchPendingSolicitationsUseCaseResponse { | ||
solicitations: Solicitation[] | ||
} | ||
type FetchPendingSolicitationsUseCaseResponse = Either< | ||
null, | ||
{ | ||
solicitations: Solicitation[] | ||
} | ||
> | ||
|
||
export class FetchPendingSolicitationsUseCase { | ||
constructor(private solicitationsRepository: SolicitationsRepository) {} | ||
|
||
async execute(): Promise<FetchPendingSolicitationsUseCaseResponse> { | ||
const solicitations = await this.solicitationsRepository.list() | ||
|
||
return { solicitations } | ||
return success({ solicitations }) | ||
} | ||
} |
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
Oops, something went wrong.