TerjaN
TerjaN
Explore posts from servers
DTDrizzle Team
Created by TerjaN on 10/14/2024 in #help
Cannot drop unique index of an empty table in planetscale
No description
2 replies
TTCTheo's Typesafe Cult
Created by TerjaN on 5/13/2024 in #questions
UTApi (Server SDK) - getFileUrls with keyType equals "customId"
I'm using the ids of my products table as customId when saving the files, and I want to retrieve the urls using the id from my database, but the response returns an
data: readonly {
readonly key: string;
readonly url: string;
}[]
data: readonly {
readonly key: string;
readonly url: string;
}[]
I don't think I have a way to know the key with just the customId. I know there are alternatives, but I like the idea of having my product table like just the id and the name without having to save nothing from uploadthing and just use customId
const products = await ctx.db.select().from(productsTable).all();
const images = await utapi
.getFileUrls(products.map((p) => p.id), {keyType: "customId"})
.then((r) => r.data);
const products = await ctx.db.select().from(productsTable).all();
const images = await utapi
.getFileUrls(products.map((p) => p.id), {keyType: "customId"})
.then((r) => r.data);
Thanks
4 replies