feat(auth): add psid field to various login request DTOs and schemas

This commit is contained in:
2026-07-10 16:33:29 +08:00
parent 4e06e08b15
commit dfcb06f5a9
13 changed files with 45 additions and 8 deletions
@@ -11,6 +11,7 @@ export class FacebookLoginRequest {
declare readonly accessToken: string;
declare readonly platform: string;
declare readonly guestId: string;
declare readonly psid: string;
declare readonly isTestAccount: boolean;
private constructor(input: FacebookLoginRequestInput) {
@@ -10,6 +10,7 @@ import {
export class FbIdLoginRequest {
declare readonly fbId: string;
declare readonly avatarUrl: string;
declare readonly psid: string;
declare readonly isTestAccount: boolean;
private constructor(input: FbIdLoginRequestInput) {
@@ -11,6 +11,7 @@ export class GoogleLoginRequest {
declare readonly idToken: string;
declare readonly platform: string;
declare readonly guestId: string;
declare readonly psid: string;
declare readonly isTestAccount: boolean;
private constructor(input: GoogleLoginRequestInput) {
@@ -13,6 +13,7 @@ export class LoginRequest {
declare readonly password: string;
declare readonly platform: string;
declare readonly guestId: string;
declare readonly psid: string;
declare readonly isTestAccount: boolean;
private constructor(input: LoginRequestInput) {
+8
View File
@@ -73,6 +73,7 @@ export class AuthRepository implements IAuthRepository {
username?: string;
password: string;
guestId?: string;
psid?: string;
}): Promise<Result<LoginResponse>> {
return Result.wrap(async () => {
const email = input.email?.trim() ?? "";
@@ -84,6 +85,7 @@ export class AuthRepository implements IAuthRepository {
password: input.password,
platform: getAuthPlatform(),
guestId: input.guestId ?? "",
psid: input.psid ?? "",
}),
),
);
@@ -173,6 +175,7 @@ export class AuthRepository implements IAuthRepository {
async googleLogin(input: {
idToken: string;
guestId?: string;
psid?: string;
}): Promise<Result<LoginResponse>> {
return this._socialLogin(LoginStatus.Google, () =>
this.api.googleLogin(
@@ -181,6 +184,7 @@ export class AuthRepository implements IAuthRepository {
idToken: input.idToken,
platform: getAuthPlatform(),
guestId: input.guestId ?? "",
psid: input.psid ?? "",
}),
),
),
@@ -191,6 +195,7 @@ export class AuthRepository implements IAuthRepository {
async facebookLogin(input: {
accessToken: string;
guestId?: string;
psid?: string;
}): Promise<Result<LoginResponse>> {
return this._socialLogin(LoginStatus.Facebook, () =>
this.api.facebookLogin(
@@ -199,6 +204,7 @@ export class AuthRepository implements IAuthRepository {
accessToken: input.accessToken,
platform: getAuthPlatform(),
guestId: input.guestId ?? "",
psid: input.psid ?? "",
}),
),
),
@@ -209,6 +215,7 @@ export class AuthRepository implements IAuthRepository {
async facebookIdLogin(input: {
fbId: string;
avatarUrl?: string;
psid?: string;
}): Promise<Result<LoginResponse>> {
return this._socialLogin(LoginStatus.Facebook, () =>
this.api.facebookIdLogin(
@@ -216,6 +223,7 @@ export class AuthRepository implements IAuthRepository {
withTestAccountFlag({
fbId: input.fbId,
avatarUrl: input.avatarUrl ?? "",
psid: input.psid ?? "",
}),
),
),
@@ -36,6 +36,7 @@ export interface IAuthRepository {
username?: string;
password: string;
guestId?: string;
psid?: string;
}): Promise<Result<LoginResponse>>;
/** 退出真实用户登录并恢复游客态。 */
@@ -48,18 +49,21 @@ export interface IAuthRepository {
googleLogin(input: {
idToken: string;
guestId?: string;
psid?: string;
}): Promise<Result<LoginResponse>>;
/** Facebook 登录(accessToken 流程)。 */
facebookLogin(input: {
accessToken: string;
guestId?: string;
psid?: string;
}): Promise<Result<LoginResponse>>;
/** Facebook ID 登录(v7.0 新增,fbId 流程)。 */
facebookIdLogin(input: {
fbId: string;
avatarUrl?: string;
psid?: string;
}): Promise<Result<LoginResponse>>;
/** 刷新 token:先读本地的 refresh token,空则返回错误。 */
@@ -10,6 +10,7 @@ export const FacebookLoginRequestSchema = z.object({
accessToken: z.string(),
platform: z.string(),
guestId: stringOrEmpty,
psid: stringOrEmpty,
isTestAccount: booleanOrFalse,
});
@@ -9,6 +9,7 @@ import { booleanOrFalse, stringOrEmpty } from "../nullable-defaults";
export const FbIdLoginRequestSchema = z.object({
fbId: z.string(),
avatarUrl: stringOrEmpty,
psid: stringOrEmpty,
isTestAccount: booleanOrFalse,
});
@@ -10,6 +10,7 @@ export const GoogleLoginRequestSchema = z.object({
idToken: z.string(),
platform: z.string(),
guestId: stringOrEmpty,
psid: stringOrEmpty,
isTestAccount: booleanOrFalse,
});
+1
View File
@@ -12,6 +12,7 @@ export const LoginRequestSchema = z.object({
password: z.string(),
platform: z.string(),
guestId: stringOrEmpty,
psid: stringOrEmpty,
isTestAccount: booleanOrFalse,
});