Tabla de inventario agregada
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import { DRIZZLE_PROVIDER } from 'src/database/drizzle-provider';
|
||||
import { Env, validateString } from '@/common/utils';
|
||||
import { Inject, Injectable, HttpException, HttpStatus, NotFoundException, UnauthorizedException } from '@nestjs/common';
|
||||
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
||||
import * as schema from 'src/database/index';
|
||||
import { products } from 'src/database/index';
|
||||
import { eq, like, or, SQL, sql, and, not } from 'drizzle-orm';
|
||||
import * as bcrypt from 'bcryptjs';
|
||||
import { CreateProductDto } from './dto/create-product.dto';
|
||||
import { UpdateUserDto } from './dto/update-product.dto';
|
||||
import { UpdateProductDto } from './dto/update-product.dto';
|
||||
import { Product } from './entities/inventory.entity';
|
||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||
|
||||
@@ -53,8 +51,9 @@ export class InventoryService {
|
||||
id: products.id,
|
||||
title: products.title,
|
||||
description: products.description,
|
||||
valuePerUnit: products.valuePerUnit,
|
||||
price: products.price,
|
||||
urlImg: products.urlImg,
|
||||
stock: products.stock,
|
||||
// price: products.price,
|
||||
// quantity: products.quantity,
|
||||
// isActive: products.isActive
|
||||
@@ -79,7 +78,7 @@ export class InventoryService {
|
||||
previousPage: page > 1 ? page - 1 : null,
|
||||
};
|
||||
|
||||
// console.log(data);
|
||||
console.log(data);
|
||||
|
||||
return { data, meta };
|
||||
}
|
||||
@@ -90,8 +89,9 @@ export class InventoryService {
|
||||
id: products.id,
|
||||
title: products.title,
|
||||
description: products.description,
|
||||
valuePerUnit: products.valuePerUnit,
|
||||
price: products.price,
|
||||
urlImg: products.urlImg,
|
||||
stock: products.stock
|
||||
})
|
||||
.from(products)
|
||||
// .leftJoin(usersRole, eq(usersRole.userId, users.id))
|
||||
@@ -124,8 +124,9 @@ export class InventoryService {
|
||||
.values({
|
||||
title: createProductDto.title,
|
||||
description: createProductDto.description,
|
||||
valuePerUnit: createProductDto.valuePerUnit,
|
||||
price: createProductDto.price,
|
||||
urlImg: createProductDto.urlImg,
|
||||
stock: createProductDto.stock
|
||||
})
|
||||
.returning();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user