feat: 展示客户咨询状态时间线
This commit is contained in:
1 parent
d6c47ce143
commit
a8a37c179e
11 files changed
+98
-24
No files matched your search
+33
-22
@@ -282,24 +282,24 @@ export class PublicWorkspaceController {
|
||||
].includes(String(value.type))
|
||||
? (value.type as RuntimeInquiryField["type"])
|
||||
: "text";
|
||||
const options = Array.isArray(value.options)
|
||||
? value.options.flatMap((option) => {
|
||||
if (!option || typeof option !== "object") return [];
|
||||
const item = option as Record<string, unknown>;
|
||||
return typeof item.label === "string" && typeof item.value === "string"
|
||||
? [{ label: item.label, value: item.value }]
|
||||
: [];
|
||||
})
|
||||
: undefined;
|
||||
return [
|
||||
{
|
||||
key: value.key,
|
||||
label: value.label,
|
||||
type,
|
||||
required: value.required === true,
|
||||
...(options?.length ? { options } : {}),
|
||||
},
|
||||
];
|
||||
const options = Array.isArray(value.options)
|
||||
? value.options.flatMap((option) => {
|
||||
if (!option || typeof option !== "object") return [];
|
||||
const item = option as Record<string, unknown>;
|
||||
return typeof item.label === "string" && typeof item.value === "string"
|
||||
? [{ label: item.label, value: item.value }]
|
||||
: [];
|
||||
})
|
||||
: undefined;
|
||||
return [
|
||||
{
|
||||
key: value.key,
|
||||
label: value.label,
|
||||
type,
|
||||
required: value.required === true,
|
||||
...(options?.length ? { options } : {}),
|
||||
},
|
||||
];
|
||||
});
|
||||
const inquiryForm = inquiryForms[0] ?? null;
|
||||
const runtimeWorkspace: RuntimeWorkspace = {
|
||||
@@ -480,11 +480,14 @@ export class PublicInquiryFormController {
|
||||
@Controller("customer/inquiry-submissions")
|
||||
export class CustomerInquirySubmissionController {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
private present<T extends { customerSubject: string }>(
|
||||
submission: T,
|
||||
): Omit<T, "customerSubject"> {
|
||||
const { customerSubject: _customerSubject, ...publicSubmission } = submission;
|
||||
private present<T extends { customerSubject: string; adminNote?: string | null }>(submission: T) {
|
||||
const {
|
||||
customerSubject: _customerSubject,
|
||||
adminNote: _adminNote,
|
||||
...publicSubmission
|
||||
} = submission;
|
||||
void _customerSubject;
|
||||
void _adminNote;
|
||||
return publicSubmission;
|
||||
}
|
||||
private identity(request: FastifyRequest): ReturnType<typeof readIdentity> {
|
||||
@@ -509,6 +512,10 @@ export class CustomerInquirySubmissionController {
|
||||
include: {
|
||||
inquiryForm: { select: { name: true, purpose: true } },
|
||||
offering: { select: { id: true, name: true } },
|
||||
statusHistory: {
|
||||
select: { fromStatus: true, toStatus: true, createdAt: true },
|
||||
orderBy: { createdAt: "asc" },
|
||||
},
|
||||
},
|
||||
});
|
||||
return submissions.map((submission) => this.present(submission));
|
||||
@@ -522,6 +529,10 @@ export class CustomerInquirySubmissionController {
|
||||
include: {
|
||||
inquiryForm: { select: { name: true, purpose: true } },
|
||||
offering: { select: { id: true, name: true } },
|
||||
statusHistory: {
|
||||
select: { fromStatus: true, toStatus: true, createdAt: true },
|
||||
orderBy: { createdAt: "asc" },
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!submission) throw new NotFoundException("咨询记录不存在");
|
||||
|
||||
Reference in new issue
Block a user