-
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.
- Loading branch information
Showing
18 changed files
with
101 additions
and
45 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
29 changes: 21 additions & 8 deletions
29
SPCServer/springboot/src/main/java/com/lcaohoanq/shoppe/dtos/responses/LoginResponse.java
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,24 +1,37 @@ | ||
package com.lcaohoanq.shoppe.dtos.responses; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@JsonPropertyOrder({"token", "refresh_token", "tokenType", "id", "username", "roles"}) | ||
@JsonPropertyOrder({ | ||
"access_token", | ||
"refresh_token", | ||
"expires_refresh_token", | ||
"expires", | ||
"user" | ||
}) | ||
@JsonInclude(Include.NON_NULL) | ||
public record LoginResponse ( | ||
@JsonProperty("token") | ||
public record LoginResponse( | ||
@JsonProperty("access_token") | ||
String token, | ||
|
||
@JsonProperty("refresh_token") | ||
String refreshToken, | ||
|
||
String tokenType, | ||
//user's detail | ||
Long id, | ||
String username, | ||
@JsonProperty("expires_refresh_token") | ||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSSSSS") | ||
LocalDateTime expiresRefreshToken, | ||
|
||
@JsonProperty("expires") | ||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSSSSS") | ||
LocalDateTime expires, | ||
|
||
List<String> roles | ||
//user's detail | ||
UserResponse user | ||
) {} |
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
3 changes: 2 additions & 1 deletion
3
SPCServer/springboot/src/main/java/com/lcaohoanq/shoppe/services/auth/IAuthService.java
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,7 @@ | ||
export type ApiResponse<Data> = { | ||
message: string | ||
data: Data | ||
status_code: number | ||
is_success: boolean | ||
reason: string | ||
} |
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,12 +1,6 @@ | ||
import { User } from './user.type' | ||
import { LoginResponse, User } from './user.type' | ||
import { SuccessResponse } from './utils.type' | ||
|
||
export type AuthResponse = SuccessResponse<{ | ||
access_token: string | ||
refresh_token: string | ||
expires_refresh_token: number | ||
expires: number | ||
user: User | ||
}> | ||
export type AuthResponse = SuccessResponse<LoginResponse> | ||
|
||
export type RefreshTokenReponse = SuccessResponse<{ access_token: string }> |
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,4 +1,8 @@ | ||
import { ApiResponse } from './api.type' | ||
|
||
export interface Category { | ||
_id: string | ||
id: string | ||
name: string | ||
} | ||
|
||
export type CategoryResponse = ApiResponse<Category[]> |
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