Files
UTMS-NG-FE/types/api.ts
2026-04-21 06:30:48 +07:00

102 lines
2.3 KiB
TypeScript

export type ApiResponse<T> = {
success: boolean;
message: string;
data: T;
timestamp: string;
};
export type LoginRequest = { username: string; password: string };
export type LoginResponseData = {
tokenType: string;
accessToken: string;
refreshToken: string;
expiresInSeconds: number;
};
export type UserProfile = {
tenantId: string;
username: string;
roles: string[];
permissions: string[];
};
export type TenantContextResponse = { tenantId: string };
export type UserCreateRequest = {
username: string;
password?: string;
ldapDn?: string;
enabled?: boolean;
roleCodes: string[];
};
export type UpdateUserRolesRequest = { username: string; roleCodes: string[] };
export type RoleCreateRequest = { code: string; name: string; permissionCodes: string[] };
export type UpdateRolePermissionRequest = { code: string; permissionCodes: string[] };
export type WorkflowStatus = "DRAFT" | "PENDING" | "APPROVED" | "REJECTED";
export enum WorkflowResourceType {
USER_MANAGEMENT = "USER_MANAGEMENT",
ROLE_MANAGEMENT = "ROLE_MANAGEMENT",
OTHER = "OTHER"
}
export type WorkflowRequestItem = {
id: string;
tenantId: string;
resourceType: string;
resourceId: string;
makerUsername: string;
payload: string;
status: WorkflowStatus;
requiredSteps: number;
currentStep: number;
createdAt: string;
updatedAt: string;
};
export type WorkflowFilters = {
status?: WorkflowStatus | "";
resourceType?: string;
makerUsername?: string;
limit?: number;
};
export type WorkflowActionPayload = { notes?: string; checkerRole?: string };
export type ApprovalResponse = {
id: string;
status: WorkflowStatus;
requiredSteps: number;
currentStep: number;
};
export type WorkflowCreateRequest = {
resourceType: string;
resourceId: string;
payload?: string;
requiredSteps: number;
};
export type AuditItem = {
id: string;
tenantId: string;
actor: string;
correlationId: string;
action: string;
domain: string;
resourceType: string;
resourceId: string;
outcome: string;
httpMethod: string;
requestPath: string;
beforeState?: string;
afterState?: string;
details?: string;
createdAt: string;
};
export type ModuleItem = { code: string; name: string; enabled: boolean };
export type ToggleModuleRequest = { enabled: boolean };