Reconcile validated Turso runtime fix with republished main history
Hop-State: A_06FP6A2CG8PVBRDVQ5WGCN0 Hop-Proposal: R_06FP6A0YW23RY0N7Z5M8DW0 Hop-Task: T_06FP67JVF4BHPYKKC37XKQ8 Hop-Attempt: AT_06FP69RZ96ZMNF9Y5S02MT0
This commit is contained in:
@@ -16,7 +16,7 @@ export async function GET() {
|
||||
await requireAdmin();
|
||||
|
||||
const nodes = await db.query.swarmNodes.findMany({
|
||||
orderBy: () => [desc(swarmNodes.isBlocked), desc(swarmNodes.blockedAt), desc(swarmNodes.lastSeenAt)],
|
||||
orderBy: (swarmNodes, { desc }) => [desc(swarmNodes.isBlocked), desc(swarmNodes.blockedAt), desc(swarmNodes.lastSeenAt)],
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function GET(request: Request) {
|
||||
with: {
|
||||
author: true,
|
||||
},
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function GET(request: Request) {
|
||||
|
||||
const reportRows = await db.query.reports.findMany({
|
||||
where: status === 'all' ? undefined : { status: status },
|
||||
orderBy: () => [desc(reports.createdAt)],
|
||||
orderBy: (reports, { desc }) => [desc(reports.createdAt)],
|
||||
limit,
|
||||
with: {
|
||||
reporter: true,
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function GET(request: Request) {
|
||||
userId: user.id,
|
||||
...(unreadOnly ? { readAt: { isNull: true as const } } : {}),
|
||||
},
|
||||
orderBy: () => [desc(notifications.createdAt)],
|
||||
orderBy: (notifications, { desc }) => [desc(notifications.createdAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ export async function GET(
|
||||
const replies = await db.query.posts.findMany({
|
||||
where: { AND: [{ replyToId: id }, { isRemoved: false }] },
|
||||
with: postDetailRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
});
|
||||
|
||||
mainPost = {
|
||||
|
||||
@@ -631,7 +631,7 @@ export async function GET(request: Request) {
|
||||
feedPosts = await db.query.posts.findMany({
|
||||
where: whereCondition,
|
||||
with: feedPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
} else if (type === 'public') {
|
||||
@@ -639,13 +639,13 @@ export async function GET(request: Request) {
|
||||
const localPosts = await db.query.posts.findMany({
|
||||
where: baseFilter,
|
||||
with: feedPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit: limit * 2,
|
||||
});
|
||||
|
||||
// Get all cached remote posts
|
||||
const remotePostsData = await db.query.remotePosts.findMany({
|
||||
orderBy: () => [desc(remotePosts.publishedAt)],
|
||||
orderBy: (remotePosts, { desc }) => [desc(remotePosts.publishedAt)],
|
||||
limit: limit,
|
||||
});
|
||||
|
||||
@@ -676,7 +676,7 @@ export async function GET(request: Request) {
|
||||
feedPosts = await db.query.posts.findMany({
|
||||
where: whereCondition,
|
||||
with: feedPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
} else if (type === 'replies' && userId) {
|
||||
@@ -700,7 +700,7 @@ export async function GET(request: Request) {
|
||||
feedPosts = await db.query.posts.findMany({
|
||||
where: whereCondition,
|
||||
with: feedPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
} else if (type === 'curated') {
|
||||
@@ -868,7 +868,7 @@ export async function GET(request: Request) {
|
||||
const localPosts = await db.query.posts.findMany({
|
||||
where: whereCondition,
|
||||
with: feedPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit: cursor ? limit : limit * 2, // Get more on first load to account for mixing with remote
|
||||
});
|
||||
|
||||
@@ -878,7 +878,7 @@ export async function GET(request: Request) {
|
||||
};
|
||||
const swarmRepostRows = await db.query.userSwarmReposts.findMany({
|
||||
where: swarmRepostWhere,
|
||||
orderBy: () => [desc(userSwarmReposts.repostedAt)],
|
||||
orderBy: (userSwarmReposts, { desc }) => [desc(userSwarmReposts.repostedAt)],
|
||||
limit: cursor ? limit : limit * 2,
|
||||
});
|
||||
|
||||
@@ -967,7 +967,7 @@ export async function GET(request: Request) {
|
||||
feedPosts = await db.query.posts.findMany({
|
||||
where: baseFilter,
|
||||
with: feedPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ export async function GET(request: Request) {
|
||||
...(moderatedIds.length ? { userId: { notIn: moderatedIds } } : {}),
|
||||
},
|
||||
with: searchPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
searchPosts = postResults;
|
||||
|
||||
@@ -23,10 +23,10 @@ export async function GET(request: NextRequest) {
|
||||
// Get all conversations for this user
|
||||
const conversations = await db.query.chatConversations.findMany({
|
||||
where: { participant1Id: session.user.id },
|
||||
orderBy: () => [desc(chatConversations.lastMessageAt)],
|
||||
orderBy: (chatConversations, { desc }) => [desc(chatConversations.lastMessageAt)],
|
||||
with: {
|
||||
messages: {
|
||||
orderBy: () => [desc(chatMessages.createdAt)],
|
||||
orderBy: (chatMessages, { desc }) => [desc(chatMessages.createdAt)],
|
||||
limit: 1,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ export async function GET(request: NextRequest) {
|
||||
// Get messages
|
||||
const messages = await db.query.chatMessages.findMany({
|
||||
where: whereCondition,
|
||||
orderBy: () => [desc(chatMessages.createdAt)],
|
||||
orderBy: (chatMessages, { desc }) => [desc(chatMessages.createdAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ export async function GET(request: NextRequest, context: RouteContext) {
|
||||
author: true,
|
||||
media: true,
|
||||
},
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit: 50,
|
||||
});
|
||||
|
||||
|
||||
@@ -224,13 +224,13 @@ export async function GET(request: NextRequest, context: RouteContext) {
|
||||
const localPosts = await db.query.posts.findMany({
|
||||
where: { AND: [{ userId: user.id }, { isRemoved: false }, { replyToId: { isNull: true } }, { swarmReplyToId: { isNull: true } }] },
|
||||
with: profilePostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit: limit * 2,
|
||||
});
|
||||
|
||||
const remoteRepostRows = await db.query.userSwarmReposts.findMany({
|
||||
where: { userId: user.id },
|
||||
orderBy: () => [desc(userSwarmReposts.repostedAt)],
|
||||
orderBy: (userSwarmReposts, { desc }) => [desc(userSwarmReposts.repostedAt)],
|
||||
limit: limit * 2,
|
||||
});
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
with: likedPostRelations,
|
||||
},
|
||||
},
|
||||
orderBy: () => [desc(likes.createdAt)],
|
||||
orderBy: (likes, { desc }) => [desc(likes.createdAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
@@ -157,7 +157,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
|
||||
const swarmLikedRows = await db.query.userSwarmLikes.findMany({
|
||||
where: { userId: user.id },
|
||||
orderBy: () => [desc(userSwarmLikes.likedAt)],
|
||||
orderBy: (userSwarmLikes, { desc }) => [desc(userSwarmLikes.likedAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
const localPosts = await db.query.posts.findMany({
|
||||
where: whereConditions,
|
||||
with: userPostRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit: cursor ? limit : limit * 2,
|
||||
});
|
||||
|
||||
@@ -351,7 +351,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
};
|
||||
const swarmRepostRows = await db.query.userSwarmReposts.findMany({
|
||||
where: swarmRepostWhere,
|
||||
orderBy: () => [desc(userSwarmReposts.repostedAt)],
|
||||
orderBy: (userSwarmReposts, { desc }) => [desc(userSwarmReposts.repostedAt)],
|
||||
limit: cursor ? limit : limit * 2,
|
||||
});
|
||||
let userPosts: any[] = [
|
||||
|
||||
@@ -143,7 +143,7 @@ export async function GET(request: Request, context: RouteContext) {
|
||||
...(cursorDate ? { createdAt: { lt: cursorDate } } : {}),
|
||||
},
|
||||
with: replyRelations,
|
||||
orderBy: () => [desc(posts.createdAt)],
|
||||
orderBy: (posts, { desc }) => [desc(posts.createdAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user