feat: Introduce multi-platform architecture for Electron and Web clients with shared UI components, Convex backend for messaging, and integrated search functionality.
Some checks failed
Build and Release / build-and-release (push) Has been cancelled
Some checks failed
Build and Release / build-and-release (push) Has been cancelled
This commit is contained in:
@@ -164,6 +164,42 @@ export const listPinned = query({
|
||||
},
|
||||
});
|
||||
|
||||
// Slim paginated query for bulk search index rebuilding.
|
||||
// Skips reactions, avatars, reply resolution — only resolves sender username.
|
||||
export const fetchBulkPage = query({
|
||||
args: {
|
||||
channelId: v.id("channels"),
|
||||
paginationOpts: paginationOptsValidator,
|
||||
},
|
||||
returns: v.any(),
|
||||
handler: async (ctx, args) => {
|
||||
const result = await ctx.db
|
||||
.query("messages")
|
||||
.withIndex("by_channel", (q) => q.eq("channelId", args.channelId))
|
||||
.order("asc")
|
||||
.paginate(args.paginationOpts);
|
||||
|
||||
const enrichedPage = await Promise.all(
|
||||
result.page.map(async (msg) => {
|
||||
const sender = await ctx.db.get(msg.senderId);
|
||||
return {
|
||||
id: msg._id,
|
||||
channel_id: msg.channelId,
|
||||
sender_id: msg.senderId,
|
||||
username: sender?.username || "Unknown",
|
||||
ciphertext: msg.ciphertext,
|
||||
nonce: msg.nonce,
|
||||
created_at: new Date(msg._creationTime).toISOString(),
|
||||
pinned: msg.pinned || false,
|
||||
replyToId: msg.replyTo || null,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
return { ...result, page: enrichedPage };
|
||||
},
|
||||
});
|
||||
|
||||
export const remove = mutation({
|
||||
args: { id: v.id("messages"), userId: v.id("userProfiles") },
|
||||
returns: v.null(),
|
||||
|
||||
Reference in New Issue
Block a user