barsa 8c89109213 Update worktree setup and enhance BFF with SupportModule integration
- Changed worktree setup command from npm to pnpm for improved package management.
- Added SupportModule to app.module.ts and router.config.ts for better support case handling.
- Refactored OrderEventsService to utilize OrderUpdateEventPayload for improved type safety.
- Updated InvoicesList component to use INVOICE_STATUS for status filtering and improved type definitions.
- Enhanced SimActions and SimDetailsCard components to utilize SimStatus for better state management.
- Refactored Subscription components to leverage new utility functions for status handling and billing cycle labels.
- Improved SupportCasesView with better state management and error handling.
- Updated API query keys to include support cases for better data retrieval.
2025-11-18 14:06:27 +09:00

75 lines
2.4 KiB
TypeScript

import { z } from "zod";
import {
SUPPORT_CASE_STATUS,
SUPPORT_CASE_PRIORITY,
SUPPORT_CASE_CATEGORY,
} from "./contract";
const supportCaseStatusValues = [
SUPPORT_CASE_STATUS.OPEN,
SUPPORT_CASE_STATUS.IN_PROGRESS,
SUPPORT_CASE_STATUS.WAITING_ON_CUSTOMER,
SUPPORT_CASE_STATUS.RESOLVED,
SUPPORT_CASE_STATUS.CLOSED,
] as const;
const supportCasePriorityValues = [
SUPPORT_CASE_PRIORITY.LOW,
SUPPORT_CASE_PRIORITY.MEDIUM,
SUPPORT_CASE_PRIORITY.HIGH,
SUPPORT_CASE_PRIORITY.CRITICAL,
] as const;
const supportCaseCategoryValues = [
SUPPORT_CASE_CATEGORY.TECHNICAL,
SUPPORT_CASE_CATEGORY.BILLING,
SUPPORT_CASE_CATEGORY.GENERAL,
SUPPORT_CASE_CATEGORY.FEATURE_REQUEST,
] as const;
export const supportCaseStatusSchema = z.enum(supportCaseStatusValues);
export const supportCasePrioritySchema = z.enum(supportCasePriorityValues);
export const supportCaseCategorySchema = z.enum(supportCaseCategoryValues);
export const supportCaseSchema = z.object({
id: z.number().int().positive(),
subject: z.string().min(1),
status: supportCaseStatusSchema,
priority: supportCasePrioritySchema,
category: supportCaseCategorySchema,
createdAt: z.string(),
updatedAt: z.string(),
lastReply: z.string().optional(),
description: z.string(),
assignedTo: z.string().optional(),
});
export const supportCaseSummarySchema = z.object({
total: z.number().int().nonnegative(),
open: z.number().int().nonnegative(),
highPriority: z.number().int().nonnegative(),
resolved: z.number().int().nonnegative(),
});
export const supportCaseListSchema = z.object({
cases: z.array(supportCaseSchema),
summary: supportCaseSummarySchema,
});
export const supportCaseFilterSchema = z
.object({
status: supportCaseStatusSchema.optional(),
priority: supportCasePrioritySchema.optional(),
category: supportCaseCategorySchema.optional(),
search: z.string().trim().min(1).optional(),
})
.default({});
export type SupportCaseStatus = z.infer<typeof supportCaseStatusSchema>;
export type SupportCasePriority = z.infer<typeof supportCasePrioritySchema>;
export type SupportCaseCategory = z.infer<typeof supportCaseCategorySchema>;
export type SupportCase = z.infer<typeof supportCaseSchema>;
export type SupportCaseSummary = z.infer<typeof supportCaseSummarySchema>;
export type SupportCaseList = z.infer<typeof supportCaseListSchema>;
export type SupportCaseFilter = z.infer<typeof supportCaseFilterSchema>;