Skip to content

Commit

Permalink
Populate search field when resetting data
Browse files Browse the repository at this point in the history
  • Loading branch information
vakila committed Oct 10, 2024
1 parent 2c2cf1b commit 3fb7904
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion convex/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,11 @@ export const reset = internalMutation({
await Promise.all(POSTS.map(async (p) => {
const { authorIndex, ...post } = p;
const authorId = userIds[authorIndex]
const { title, content, summary, slug, } = post;
const search = [title, content, summary, slug].join(' ')

const postId = await ctx.db.insert('posts',
{ ...post, authorId, publishTime: Date.now() }
{ ...post, authorId, publishTime: Date.now(), search }
);
console.log(`Created document ${postId} in "posts" table`);
const versionId = await ctx.db.insert('versions',
Expand Down

0 comments on commit 3fb7904

Please sign in to comment.