mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
Fix incorrect order causing wrong timeline Link headers
This commit is contained in:
parent
d3a625e084
commit
5812618170
|
|
@ -17,11 +17,12 @@ export async function fetchTimeline<T extends User | Status>(
|
||||||
// Check if there are statuses before the first one
|
// Check if there are statuses before the first one
|
||||||
// @ts-expect-error This is a hack to get around the fact that Prisma doesn't have a common base type for all models
|
// @ts-expect-error This is a hack to get around the fact that Prisma doesn't have a common base type for all models
|
||||||
const objectsBefore = await model.findMany({
|
const objectsBefore = await model.findMany({
|
||||||
|
...args,
|
||||||
where: {
|
where: {
|
||||||
|
...args.where,
|
||||||
id: {
|
id: {
|
||||||
gt: objects[0].id,
|
gt: objects[0].id,
|
||||||
},
|
},
|
||||||
...args.where,
|
|
||||||
},
|
},
|
||||||
take: 1,
|
take: 1,
|
||||||
});
|
});
|
||||||
|
|
@ -38,11 +39,12 @@ export async function fetchTimeline<T extends User | Status>(
|
||||||
// Check if there are statuses after the last one
|
// Check if there are statuses after the last one
|
||||||
// @ts-expect-error This is a hack to get around the fact that Prisma doesn't have a common base type for all models
|
// @ts-expect-error This is a hack to get around the fact that Prisma doesn't have a common base type for all models
|
||||||
const objectsAfter = await model.findMany({
|
const objectsAfter = await model.findMany({
|
||||||
|
...args,
|
||||||
where: {
|
where: {
|
||||||
|
...args.where,
|
||||||
id: {
|
id: {
|
||||||
lt: objects.at(-1)?.id,
|
lt: objects.at(-1)?.id,
|
||||||
},
|
},
|
||||||
...args.where,
|
|
||||||
},
|
},
|
||||||
take: 1,
|
take: 1,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue