Compare commits

...

3 commits

Author SHA1 Message Date
71e66cf437 no asumir que offers es solo length===1 2024-01-02 19:34:35 -03:00
db008c582f solo mostrar articulos con stock en home 2024-01-02 19:25:31 -03:00
21439a5da5 conseguir ultima entry
fixes #10
2024-01-02 19:05:50 -03:00
2 changed files with 4 additions and 4 deletions

View file

@ -32,7 +32,7 @@ const zProductLd = z.object({
name: z.string(),
image: z.string(),
offers: z.object({
offers: z.tuple([
offers: z.array(
z.object({
"@type": z.literal("Offer"),
price: z.number(),
@ -41,8 +41,8 @@ const zProductLd = z.object({
"http://schema.org/OutOfStock",
"http://schema.org/InStock",
]),
}),
]),
})
),
}),
});
type ProductLd = z.infer<typeof zProductLd>;

View file

@ -12,7 +12,7 @@ export const load: PageServerLoad = async ({ params }) => {
})
.from(precios)
.groupBy(precios.ean)
.having(sql`max(length(name))`)
.having(sql`max(length(name)) and max(parser_version) and in_stock`)
.orderBy(sql`random()`)
.limit(150);
const res = await q;