feat: 为文档库/相关问题页面添加类型筛选功能 #92
@ -21,7 +21,7 @@ describe('toQuestionTypeView', () => {
|
|||||||
|
|
||||||
expect(toQuestionTypeView(rawData)).toEqual({
|
expect(toQuestionTypeView(rawData)).toEqual({
|
||||||
id: '1',
|
id: '1',
|
||||||
type: 'Type Name',
|
name: 'Type Name',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ describe('toQuestionTypeView', () => {
|
|||||||
|
|
||||||
expect(toQuestionTypeView(rawData)).toEqual({
|
expect(toQuestionTypeView(rawData)).toEqual({
|
||||||
id: '1',
|
id: '1',
|
||||||
type: '',
|
name: '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ describe('toQuestionTypeView', () => {
|
|||||||
const rawData: QuestionType | null = null;
|
const rawData: QuestionType | null = null;
|
||||||
|
|
||||||
expect(toQuestionTypeView(rawData)).toEqual({
|
expect(toQuestionTypeView(rawData)).toEqual({
|
||||||
id: '',
|
id: '-1',
|
||||||
type: '',
|
type: '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -120,7 +120,7 @@ describe('toQuestionListView', () => {
|
|||||||
id: '1',
|
id: '1',
|
||||||
type: {
|
type: {
|
||||||
id: '1',
|
id: '1',
|
||||||
type: 'Type Name',
|
name: 'Type Name',
|
||||||
},
|
},
|
||||||
title: 'Question Title',
|
title: 'Question Title',
|
||||||
content: 'Question Answer',
|
content: 'Question Answer',
|
||||||
@ -160,7 +160,7 @@ describe('toQuestionListView', () => {
|
|||||||
id: '1',
|
id: '1',
|
||||||
type: {
|
type: {
|
||||||
id: '1',
|
id: '1',
|
||||||
type: 'Type Name',
|
name: 'Type Name',
|
||||||
},
|
},
|
||||||
title: '',
|
title: '',
|
||||||
content: '',
|
content: '',
|
||||||
|
|||||||
@ -14,15 +14,15 @@ export function toQuestionTypeView(
|
|||||||
): QuestionTypeView {
|
): QuestionTypeView {
|
||||||
if (typeof raw === 'string' || raw === null) {
|
if (typeof raw === 'string' || raw === null) {
|
||||||
return {
|
return {
|
||||||
id: '',
|
id: '-1',
|
||||||
type: '',
|
name: '',
|
||||||
} satisfies QuestionTypeView;
|
} satisfies QuestionTypeView;
|
||||||
}
|
}
|
||||||
const trans = raw.translations?.[0];
|
const trans = raw.translations?.[0];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: raw.id.toString(),
|
id: raw.id.toString(),
|
||||||
type: trans?.name ?? '',
|
name: trans?.name ?? '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export interface QuestionTypeView {
|
|||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
/** 类型名 **/
|
/** 类型名 **/
|
||||||
type: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user