HRWD-0..9 实现人事生命周期企微通讯录同步
这个提交包含在:
@@ -7,6 +7,31 @@ export type EmployeeContractStatus = "active" | "expired" | "terminated";
|
||||
export type EmployeeTrainingType = "internal" | "external" | "online";
|
||||
export type EmployeeTrainingStatus = "planned" | "in_progress" | "completed" | "cancelled";
|
||||
export type EmployeeCertificateStatus = "valid" | "expired";
|
||||
export type WecomDirectorySyncOperation = "create" | "update" | "disable";
|
||||
export type WecomDirectorySyncStatus = "running" | "success" | "failed" | "skipped";
|
||||
export type WecomDirectoryStateStatus = "unbound" | "bound" | "synced" | "sync_success" | "sync_skipped" | "sync_failed";
|
||||
|
||||
export type WecomDirectorySyncRun = {
|
||||
id: string;
|
||||
employeeId: string;
|
||||
externalUserId: string | null;
|
||||
operation: WecomDirectorySyncOperation;
|
||||
status: WecomDirectorySyncStatus;
|
||||
attempts: number;
|
||||
errorCode: string | null;
|
||||
errorMessage: string | null;
|
||||
responseSummary: Record<string, unknown> | null;
|
||||
triggeredBy: string | null;
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
};
|
||||
|
||||
export type WecomDirectoryState = {
|
||||
status: WecomDirectoryStateStatus;
|
||||
externalUserId: string | null;
|
||||
bound: boolean;
|
||||
latestSync: WecomDirectorySyncRun | null;
|
||||
};
|
||||
|
||||
export type EmployeeDepartmentSummary = {
|
||||
id: string;
|
||||
@@ -31,6 +56,7 @@ export type EmployeeSummary = {
|
||||
roleCodes: string[];
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
wecomDirectory?: WecomDirectoryState;
|
||||
};
|
||||
|
||||
export type EmployeeListResponse = {
|
||||
@@ -175,6 +201,7 @@ export type EmployeeProfile = {
|
||||
roleCodes: string[];
|
||||
department: EmployeeDepartmentSummary | null;
|
||||
directManager: { id: string; employeeNo: string; name: string; avatarUrl: string | null } | null;
|
||||
wecomDirectory?: WecomDirectoryState;
|
||||
};
|
||||
lifecycle: {
|
||||
events: EmployeeLifecycleEvent[];
|
||||
@@ -403,6 +430,33 @@ export async function fetchEmployeeLifecycle(employeeId: string) {
|
||||
return apiRequestData<EmployeeProfile["lifecycle"]>(`/api/employees/${employeeId}/lifecycle`);
|
||||
}
|
||||
|
||||
export async function fetchEmployeeWecomDirectorySync(employeeId: string) {
|
||||
return apiRequestData<{
|
||||
employeeId: string;
|
||||
wecomDirectory: WecomDirectoryState;
|
||||
items: WecomDirectorySyncRun[];
|
||||
}>(`/api/employees/${employeeId}/wecom-directory-sync`);
|
||||
}
|
||||
|
||||
export async function retryEmployeeWecomDirectorySync(employeeId: string, operation?: WecomDirectorySyncOperation) {
|
||||
return apiRequestData<{
|
||||
employeeId: string;
|
||||
operation: WecomDirectorySyncOperation;
|
||||
result: {
|
||||
ok: boolean;
|
||||
skipped: boolean;
|
||||
status: WecomDirectorySyncStatus;
|
||||
code: string;
|
||||
message: string | null;
|
||||
run: WecomDirectorySyncRun | null;
|
||||
} | null;
|
||||
wecomDirectory: WecomDirectoryState;
|
||||
}>(`/api/employees/${employeeId}/wecom-directory-sync/retry`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(operation ? { operation } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchEmployeeOrganization() {
|
||||
return apiRequestData<{ items: OrganizationDepartmentSection[] }>("/api/employees/organization");
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户