|
|
|
@ -327,9 +327,11 @@ export const questionsQuestionRouter = createRouter()
|
|
|
|
|
|
|
|
|
|
const { cursor } = input;
|
|
|
|
|
|
|
|
|
|
const sortCondition =
|
|
|
|
|
input.sortType === SortType.TOP
|
|
|
|
|
? [
|
|
|
|
|
let sortCondition = undefined;
|
|
|
|
|
|
|
|
|
|
switch (input.sortType) {
|
|
|
|
|
case SortType.TOP:
|
|
|
|
|
sortCondition = [
|
|
|
|
|
{
|
|
|
|
|
upvotes: input.sortOrder,
|
|
|
|
|
},
|
|
|
|
@ -337,7 +339,9 @@ export const questionsQuestionRouter = createRouter()
|
|
|
|
|
id: input.sortOrder,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
: [
|
|
|
|
|
break;
|
|
|
|
|
case SortType.NEW:
|
|
|
|
|
sortCondition = [
|
|
|
|
|
{
|
|
|
|
|
lastSeenAt: input.sortOrder,
|
|
|
|
|
},
|
|
|
|
@ -345,6 +349,18 @@ export const questionsQuestionRouter = createRouter()
|
|
|
|
|
id: input.sortOrder,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
break;
|
|
|
|
|
case SortType.ENCOUNTERS:
|
|
|
|
|
sortCondition = [
|
|
|
|
|
{
|
|
|
|
|
numEncounters: input.sortOrder,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: input.sortOrder,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const questionsData = await ctx.prisma.questionsQuestion.findMany({
|
|
|
|
|
cursor: cursor ? { id: cursor } : undefined,
|
|
|
|
|