-
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.
feat: ✨ getUserUseCase in UsersService
- Loading branch information
1 parent
a1bdfdb
commit 66310ac
Showing
4 changed files
with
28 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { User } from '@users/domain'; | ||
|
||
import { GetUserUseCase } from './use-cases/get-user.use-case'; | ||
|
||
@Injectable() | ||
export class UsersService { | ||
private users: User[] = [ | ||
{ id: '1', name: 'John Doe' }, | ||
{ id: '2', name: 'Richard Roe' }, | ||
]; | ||
constructor(private readonly getUserUseCase: GetUserUseCase) {} | ||
|
||
findById(id: string): User | undefined { | ||
return this.users.find((user) => user.id === id); | ||
async findById(id: string): Promise<User | null> { | ||
return this.getUserUseCase.execute(id); | ||
} | ||
} |
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