array de galeria
This commit is contained in:
@@ -13,6 +13,7 @@ export const products = t.pgTable(
|
||||
stock: t.integer('stock').notNull().default(0),
|
||||
address: t.text('address').notNull(),
|
||||
urlImg: t.text('url_img').notNull(),
|
||||
gallery: t.text('gallery').array().notNull().default(sql`'{}'::text[]`),
|
||||
status: t.text('status').notNull().default('BORRADOR'),
|
||||
userId: t.integer('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||
...timestamps,
|
||||
@@ -26,6 +27,7 @@ export const viewProductsStore = t.pgView('v_product_store', {
|
||||
price: t.numeric('price'),
|
||||
stock: t.integer('stock'),
|
||||
urlImg: t.text('url_img'),
|
||||
gallery: t.text('gallery'),
|
||||
address: t.text('address'),
|
||||
status: t.text('status'),
|
||||
userId: t.integer('user_id'),
|
||||
@@ -33,6 +35,6 @@ export const viewProductsStore = t.pgView('v_product_store', {
|
||||
email: t.text('email'),
|
||||
phone: t.text('phone')
|
||||
}).as(sql`
|
||||
select p.id as product_id, p.title, p.description, p.price, p.stock, p.url_img, p.address, p.status, p.user_id, u.fullname, u.email, u.phone
|
||||
select p.id as product_id, p.title, p.description, p.price, p.stock, p.url_img, p.gallery, p.address, p.status, p.user_id, u.fullname, u.email, u.phone
|
||||
from products p
|
||||
left join auth.users as u on u.id = p.user_id`);
|
||||
Reference in New Issue
Block a user