feat: Implement agent verification management, including document display and status updates, on the user detail page.
This commit is contained in:
@@ -18,6 +18,9 @@ export type {
|
||||
User,
|
||||
UsersListResponse,
|
||||
UserFilters,
|
||||
VerificationStatus,
|
||||
VerificationDocument,
|
||||
AgentProfileDetails,
|
||||
} from './users.service';
|
||||
|
||||
// Agent Types Service
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import api, { ApiResponse } from './api';
|
||||
|
||||
// Types
|
||||
export type VerificationStatus = 'NONE' | 'PENDING_REVIEW' | 'APPROVED' | 'REJECTED';
|
||||
|
||||
export interface AgentType {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -8,6 +10,14 @@ export interface AgentType {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface VerificationDocument {
|
||||
key: string;
|
||||
name: string;
|
||||
size: number;
|
||||
type: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface AgentProfileDetails {
|
||||
id: string;
|
||||
slug: string;
|
||||
@@ -20,6 +30,12 @@ export interface AgentProfileDetails {
|
||||
profileCompleteness: number;
|
||||
agentTypeId?: string | null;
|
||||
agentType?: AgentType | null;
|
||||
// Verification fields
|
||||
isVerified?: boolean;
|
||||
verificationStatus?: VerificationStatus;
|
||||
verificationNote?: string | null;
|
||||
verifiedAt?: string | null;
|
||||
verifiedBy?: string | null;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
@@ -102,6 +118,37 @@ class UsersService {
|
||||
const response = await api.patch<ApiResponse<{ id: string; agentTypeId: string; agentType: AgentType; message: string }>>(`${this.basePath}/${userId}/agent-type`, { agentTypeId });
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
async getVerificationDocuments(userId: string): Promise<VerificationDocument[]> {
|
||||
const response = await api.get<ApiResponse<VerificationDocument[]>>(`${this.basePath}/${userId}/verification-documents`);
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
async updateVerification(
|
||||
userId: string,
|
||||
data: { status: VerificationStatus; note?: string }
|
||||
): Promise<{
|
||||
id: string;
|
||||
agentProfileId: string;
|
||||
isVerified: boolean;
|
||||
verificationStatus: VerificationStatus;
|
||||
verificationNote: string | null;
|
||||
verifiedAt: string | null;
|
||||
verifiedBy: string | null;
|
||||
message: string;
|
||||
}> {
|
||||
const response = await api.patch<ApiResponse<{
|
||||
id: string;
|
||||
agentProfileId: string;
|
||||
isVerified: boolean;
|
||||
verificationStatus: VerificationStatus;
|
||||
verificationNote: string | null;
|
||||
verifiedAt: string | null;
|
||||
verifiedBy: string | null;
|
||||
message: string;
|
||||
}>>(`${this.basePath}/${userId}/verification`, data);
|
||||
return response.data.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const usersService = new UsersService();
|
||||
|
||||
Reference in New Issue
Block a user