rochel3
rochel3
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
for example if the user types Property, i want to find every post with property inside the title along in the paginated filter query above
17 replies
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
i cant use searchIndex together with withIndex
17 replies
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
im trying to combine all the filters into one function
17 replies
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
I also require title to be part of the filter, problem is i am unable to use withSearchindex to do the fuzzy search on all documents with similar titles, currently i am using
if (args.title) {
var res = res.filter((q) => q.eq(q.field("title"), args.title));
}
if (args.title) {
var res = res.filter((q) => q.eq(q.field("title"), args.title));
}
However, this only works if the title is EXACTLY the name parameter i search for, how do i work around this?
17 replies
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
got it, thank you so much ❤️
17 replies
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
It gives an error under res saying Type 'Query<{ document: { _id: Id<"post">; _creationTime: number; title: string; src: string; description: string; location: string; pricing: number; categoryId: Id<"categories">; userId: Id<"users">; likes: number; interactions: number; }; fieldPaths: ExtractFieldPaths<...> | "_id"; indexes: { ...; }; searchIndexes: {}; ...' is missing the following properties from type 'QueryInitializer<{ document: { _id: Id<"post">; _creationTime: number; title: string; src: string; description: string; location: string; pricing: number; categoryId: Id<"categories">; userId: Id<"users">; likes: number; interactions: number; }; fieldPaths: ExtractFieldPaths<...> | "_id"; indexes: { ...; }; searchIn...': fullTableScan, withIndex, withSearchIndexts(2739)
17 replies
CCConvex Community
Created by rochel3 on 6/4/2024 in #support-community
Get Price highest to lowest with pagination query
with this updated code, i no longer get it sorted by price, instead it sorts by creationTime
export const getPostList = query({
args: {
paginationOpts: paginationOptsValidator,
categoryId: v.optional(v.id("categories")),
title: v.optional(v.string()),
sortedBy: v.string(),
min: v.optional(v.number()),
max: v.optional(v.number()),
},
handler: async (ctx, args) => {
var res = ctx.db.query("post");

if (args.sortedBy === "asc" || args.sortedBy === "desc") {
res.withIndex("by_price");
}

if (args.categoryId) {
var res = res.filter((q) => q.eq(q.field("categoryId"), args.categoryId));
}

if (args.title) {
var res = res.filter((q) => q.eq(q.field("title"), args.title));
}

if (args.min) {
var res = res.filter((q) => q.gte(q.field("pricing"), args.min!));
}

if (args.max) {
var res = res.filter((q) => q.lte(q.field("pricing"), args.max!));
}

if (args.sortedBy === "oldest") {
return await res.order("asc").paginate(args.paginationOpts);
} else if (args.sortedBy === "desc") {
const x = await res.order("desc").paginate(args.paginationOpts);
return x;
} else if (args.sortedBy === "asc") {
const x = await res.order("asc").paginate(args.paginationOpts);
return x;
} else {
return await res.order("desc").paginate(args.paginationOpts);
}
},
});
export const getPostList = query({
args: {
paginationOpts: paginationOptsValidator,
categoryId: v.optional(v.id("categories")),
title: v.optional(v.string()),
sortedBy: v.string(),
min: v.optional(v.number()),
max: v.optional(v.number()),
},
handler: async (ctx, args) => {
var res = ctx.db.query("post");

if (args.sortedBy === "asc" || args.sortedBy === "desc") {
res.withIndex("by_price");
}

if (args.categoryId) {
var res = res.filter((q) => q.eq(q.field("categoryId"), args.categoryId));
}

if (args.title) {
var res = res.filter((q) => q.eq(q.field("title"), args.title));
}

if (args.min) {
var res = res.filter((q) => q.gte(q.field("pricing"), args.min!));
}

if (args.max) {
var res = res.filter((q) => q.lte(q.field("pricing"), args.max!));
}

if (args.sortedBy === "oldest") {
return await res.order("asc").paginate(args.paginationOpts);
} else if (args.sortedBy === "desc") {
const x = await res.order("desc").paginate(args.paginationOpts);
return x;
} else if (args.sortedBy === "asc") {
const x = await res.order("asc").paginate(args.paginationOpts);
return x;
} else {
return await res.order("desc").paginate(args.paginationOpts);
}
},
});
17 replies
CCConvex Community
Created by rochel3 on 5/31/2024 in #support-community
pyTelegrambotAPI with convex, cant get image to be sent sometimes
Can i check if it is the correct practice to getUrl() everytime i need the image? Or is it better if i just store the URL
13 replies
CCConvex Community
Created by rochel3 on 5/31/2024 in #support-community
pyTelegrambotAPI with convex, cant get image to be sent sometimes
I use getUrl() each time i use it
13 replies
CCConvex Community
Created by rochel3 on 5/31/2024 in #support-community
pyTelegrambotAPI with convex, cant get image to be sent sometimes
@ballingt Nope i do not delete those seating charts. When i head to the old files that did not work and hovered over them , it still showed the correct image that was supposed to be sent
13 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Convex import causes telegram bot to not work.
sure! thanks
15 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Convex import causes telegram bot to not work.
I'll pm you the code
15 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Convex import causes telegram bot to not work.
Hmm it seems like the bot doesnt work at all even after the start command was given. Without the convex function it was able to run /start and print the message but after commenting it out it works
15 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Convex import causes telegram bot to not work.
This is the error: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.telegram.org:443 DEBUG:urllib3.connectionpool:https://api.telegram.org/ "GET /bot6583121108:AAEx-N1Qu7g80kyxGiC-5qgkEG1SsKt87q0/getMe HTTP/1.1" 200 195 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.telegram.org:443
15 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Convex import causes telegram bot to not work.
@ballingt Give me a second let me send the code
15 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Convex import causes telegram bot to not work.
You would need to create a telegram bot using botfather and get the api key
15 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Getting specific column results
thanks man!
5 replies
CCConvex Community
Created by rochel3 on 3/20/2024 in #support-community
Getting specific column results
Hey @Michal Srb thanks for the quick reply
export const getSchoolsByDate = query({
args: { show_date: v.string() },
handler: async (ctx, args) => {
const _schools = await ctx.db
.query("show_dates")
.filter((q) => q.eq(q.field("show_date"), args.show_date))
.collect();
const schools: string[] = [];
_schools.map((o) => {
schools.push(o.school_name);
});
return schools;
},
});
export const getSchoolsByDate = query({
args: { show_date: v.string() },
handler: async (ctx, args) => {
const _schools = await ctx.db
.query("show_dates")
.filter((q) => q.eq(q.field("show_date"), args.show_date))
.collect();
const schools: string[] = [];
_schools.map((o) => {
schools.push(o.school_name);
});
return schools;
},
});
This was my work around, im not sure if it is efficient
5 replies