-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from chingu-x/refactor/auth-architecture-pt2
Refactor/auth architecture pt2
- Loading branch information
Showing
13 changed files
with
93 additions
and
34 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const AuthUrls = { | ||
login: "/api/v1/auth/login", | ||
logout: "/api/v1/auth/logout", | ||
} as const; |
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,16 @@ | ||
import { inject, injectable } from "tsyringe"; | ||
import { TYPES } from "@/di/types"; | ||
import { type AuthApiPort } from "@/modules/auth/ports/secondary/authApiPort"; | ||
import { type LogoutResponseDto } from "@/modules/auth/application/dtos/response.dto"; | ||
|
||
@injectable() | ||
export class LogoutUsecase { | ||
constructor( | ||
@inject(TYPES.AuthApiPort) | ||
private readonly authApi: AuthApiPort, | ||
) {} | ||
|
||
async execute(): Promise<LogoutResponseDto> { | ||
return await this.authApi.logout(); | ||
} | ||
} |
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,6 +1,10 @@ | ||
import { type LoginRequestDto } from "@/modules/auth/application/dtos/request.dto"; | ||
import { type LoginResponseDto } from "@/modules/auth/application/dtos/response.dto"; | ||
import type { | ||
LogoutResponseDto, | ||
LoginResponseDto, | ||
} from "@/modules/auth/application/dtos/response.dto"; | ||
|
||
export interface AuthClientPort { | ||
login: (props: LoginRequestDto) => Promise<LoginResponseDto>; | ||
logout: () => Promise<LogoutResponseDto>; | ||
} |
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,6 +1,10 @@ | ||
import { type LoginRequestDto } from "@/modules/auth/application/dtos/request.dto"; | ||
import { type LoginResponseDto } from "@/modules/auth/application/dtos/response.dto"; | ||
import type { | ||
LogoutResponseDto, | ||
LoginResponseDto, | ||
} from "@/modules/auth/application/dtos/response.dto"; | ||
|
||
export interface AuthApiPort { | ||
login: ({ email, password }: LoginRequestDto) => Promise<LoginResponseDto>; | ||
logout: () => Promise<LogoutResponseDto>; | ||
} |
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