forked from baron/baron-sso
worksmobile 연동 & ory stack 26.2.0으로 업그레이드
This commit is contained in:
@@ -21,7 +21,7 @@ export type AuditLogListResponse = {
|
||||
|
||||
export type TenantSummary = {
|
||||
id: string;
|
||||
type: string; // PERSONAL, COMPANY, COMPANY_GROUP, USER_GROUP
|
||||
type: string; // 허용 타입: PERSONAL, COMPANY, COMPANY_GROUP, ORGANIZATION, USER_GROUP
|
||||
name: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
@@ -447,6 +447,7 @@ export type UserAppointment = {
|
||||
tenantId: string;
|
||||
tenantSlug?: string;
|
||||
tenantName: string;
|
||||
isPrimary?: boolean;
|
||||
isOwner: boolean;
|
||||
jobTitle?: string;
|
||||
position?: string;
|
||||
@@ -491,6 +492,60 @@ export type BulkUserResponse = {
|
||||
results: BulkUserResult[];
|
||||
};
|
||||
|
||||
export type WorksmobileOutboxItem = {
|
||||
id: string;
|
||||
resourceType: string;
|
||||
resourceId: string;
|
||||
action: string;
|
||||
status: string;
|
||||
retryCount: number;
|
||||
lastError?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type WorksmobileOverview = {
|
||||
tenant: TenantSummary;
|
||||
config: {
|
||||
enabled: boolean;
|
||||
tokenConfigured: boolean;
|
||||
};
|
||||
recentJobs: WorksmobileOutboxItem[];
|
||||
};
|
||||
|
||||
export type WorksmobileComparisonItem = {
|
||||
resourceType: string;
|
||||
baronId?: string;
|
||||
baronName?: string;
|
||||
baronEmail?: string;
|
||||
baronPrimaryOrgId?: string;
|
||||
baronPrimaryOrgName?: string;
|
||||
baronParentId?: string;
|
||||
baronParentName?: string;
|
||||
worksmobileId?: string;
|
||||
externalKey?: string;
|
||||
worksmobileName?: string;
|
||||
worksmobileEmail?: string;
|
||||
worksmobileLevelId?: string;
|
||||
worksmobileLevelName?: string;
|
||||
worksmobileTask?: string;
|
||||
worksmobileDomainId?: number;
|
||||
worksmobileDomainName?: string;
|
||||
worksmobilePrimaryOrgId?: string;
|
||||
worksmobilePrimaryOrgName?: string;
|
||||
worksmobilePrimaryOrgPositionId?: string;
|
||||
worksmobilePrimaryOrgPositionName?: string;
|
||||
worksmobilePrimaryOrgIsManager?: boolean;
|
||||
worksmobileParentId?: string;
|
||||
worksmobileParentName?: string;
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type WorksmobileComparison = {
|
||||
users: WorksmobileComparisonItem[];
|
||||
groups: WorksmobileComparisonItem[];
|
||||
};
|
||||
|
||||
export async function fetchUsers(
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
@@ -561,12 +616,86 @@ export async function bulkCreateUsers(users: BulkUserItem[]) {
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function fetchWorksmobileOverview(tenantId: string) {
|
||||
const { data } = await apiClient.get<WorksmobileOverview>(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile`,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function fetchWorksmobileComparison(
|
||||
tenantId: string,
|
||||
includeMatched = false,
|
||||
) {
|
||||
const { data } = await apiClient.get<WorksmobileComparison>(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile/comparison`,
|
||||
{
|
||||
params: { includeMatched },
|
||||
},
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function downloadWorksmobileInitialPasswordsCSV(tenantId: string) {
|
||||
const response = await apiClient.get<Blob>(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile/initial-passwords.csv`,
|
||||
{
|
||||
responseType: "blob",
|
||||
},
|
||||
);
|
||||
const dispositionHeader = response.headers["content-disposition"];
|
||||
const disposition = Array.isArray(dispositionHeader)
|
||||
? dispositionHeader[0]
|
||||
: String(dispositionHeader ?? "");
|
||||
const filenameMatch = disposition?.match(/filename="?([^"]+)"?/i);
|
||||
return {
|
||||
blob: response.data,
|
||||
filename: filenameMatch?.[1] ?? "worksmobile_initial_passwords.csv",
|
||||
};
|
||||
}
|
||||
|
||||
export async function enqueueWorksmobileBackfillDryRun(tenantId: string) {
|
||||
const { data } = await apiClient.post(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile/backfill/dry-run`,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function enqueueWorksmobileOrgUnitSync(
|
||||
tenantId: string,
|
||||
orgUnitId: string,
|
||||
) {
|
||||
const { data } = await apiClient.post<WorksmobileOutboxItem>(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile/orgunits/${orgUnitId}/sync`,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function enqueueWorksmobileUserSync(
|
||||
tenantId: string,
|
||||
userId: string,
|
||||
) {
|
||||
const { data } = await apiClient.post<WorksmobileOutboxItem>(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile/users/${userId}/sync`,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function retryWorksmobileJob(tenantId: string, jobId: string) {
|
||||
const { data } = await apiClient.post(
|
||||
`/v1/admin/tenants/${tenantId}/worksmobile/jobs/${jobId}/retry`,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function bulkUpdateUsers(payload: {
|
||||
userIds: string[];
|
||||
status?: string;
|
||||
role?: string;
|
||||
tenantSlug?: string;
|
||||
department?: string;
|
||||
position?: string;
|
||||
jobTitle?: string;
|
||||
}) {
|
||||
const requestPayload: typeof payload & { companyCode?: string } = {
|
||||
...payload,
|
||||
|
||||
Reference in New Issue
Block a user