Added new dependencies 'file-type' and 'multer' in pnpm-lock.yaml and package.json. These additions will assist in file handling and multipart form data processing.
Added try-catch block in verifyAuthToken to handle and log JWT verification errors. This change ensures that invalid tokens are caught and a relevant BadRequestException is thrown.
This commit cleans up the `CreateProductDto` class by removing the unused import `optional` from the `zod` library. This helps in maintaining code cleanliness and potentially improving application performance.
Refine and expand TODO comments to outline specific tasks for managing transactions. Detail steps for handling single/multiple products and listing transactions for users and products.
Introduced a new uploads module with controllers and service methods for handling file uploads and retrievals. Includes route guards, file validations, and error handling for both avatar and product image uploads.
Introduce new "me" endpoints for fetching, updating, and deleting current user data. Update guards to properly inject dependent services using @Inject decorator for better DI handling.
A new import, CredentialsModule, has been added to the Stocks module. This module is now among the imported dependencies in the Stocks module, expanding its functionality with the features provided by CredentialsModule.
This commit introduces a new `findById` asynchronous method in the `ProductsService`. This aims to fetch specific product details using product ID from the `ProductsTable`. Additionally, `ProductsService` is exported in the products module.
This commit enhances the stocks module by adding new import modules, implementing more stock related endpoints and methods, and creating a new dto for stock data validation. The stocks service now includes methods to get a product's stock, create, alter, get the current stock, rank products by stock, get all stocks, decrement and increment product stock. StocksController now holds endpoints to add a new stock, get products with more or less stock, edit a stock, and get a stock of a specific product.
This update introduces several features within the stock service and controller, including creating new stock for a product, altering existing product stock, retrieving current stock, and managing product stocks with pagination.
The AdminGuard constructor is being simplified by using constructor parameter properties, rather than previously setting properties via Reflector in the constructor's body. Additionally, AuthModule now includes AdminGuard in its providers.
Updated products.service.ts to improve product fetching with added console logs and response modifications. Endpoint name in products.controller.ts has been changed from 'new' to 'add' with parameter adjustments for fetching. In products.module.ts, CredentialsModule was imported for enhanced functionality.
A unique constraint has been added to the "slug_name" field in the schema to prevent any duplication. This will ensure data integrity by enforcing uniqueness for each slug_name entry.
Implemented functionality to edit and delete products from the database in the products controller. The functions now throw a BadRequestException when update or deletion fails. The getAllProducts function is now also enabled to support pagination.
The commit refactors how services are injected in UserGuard and AdminGuard inside the auth module. By leveraging the Reflector class from NestJS, it improves the ability to retrieve metadata about these guards, potentially aiding in debugging and understanding code flow.
Added the implementation for Create, Read, Update, and Delete (CRUD) operations in the `ProductsService` and `ProductsController`. These include methods for adding, editing, deleting and listing all products with pagination. All these changes are reflected in the `ProductsModule` and related DTO file.
This commit adds structured TODO comments to the transactions and stocks services and their associated controllers. Each TODO comment provides guidelines on what needs to be done next such as implementing CRUD operations and features specific to admin and users.
The inspection tool for checking DuplicatedCode has been enabled in the Project_Default.xml file. It's set to give a weak warning for duplication in TypeScript code with a minimum size of 67. This should assist in maintaining quality by preventing repetitive code patterns.
Updated the 'fetchUser' function in 'auth.service.ts', removing the specific user ID parameter, and added a return statement. Moreover, 'ProductsModule', 'StocksModule', and 'TransactionsModule' have been imported to 'app.module.ts'.
This commit introduces several TODOs for future operations on the 'products' service and controller. These primarily outline desired functionalities such as adding, editing, and deleting a product, and listing all products with pagination.
This commit introduces new nest.js modules for stocks, transactions and products, along with their respective services and controllers. These provide foundation for further feature development in these areas.
Deleted superfluous "biome-ignore" comments related to lint/style in the drizzle.service.ts, which were marked as required for Nest.js but were not necessary. The code remains functional without these comments.
A signIn method was added to the auth.controller file to handle the signin requests. The SignInDto was also imported from the auth.dto to help facilitate this. Furthermore, the console was imported from node to assist with development debugging.
This commit introduces UserGuard and AdminGuard, two new authorization guards. These guards verify the access permissions of users and admin respectively, by checking the provided token in the authorization header. Unauthorized users will receive UnauthorizedException.
This commit corrects a minor syntax error by adding missing semicolons on two lines. It also tidies up code by improving the formatting in the constructor and function signAuthToken.
This commit adds methods for updating and deleting users in the auth service. Additionally, it includes corresponding validation schemas in the auth schema file. The auth controller code has also been cleaned up for better readability.
This commit reorganizes the insert and select schema declarations for improved readability. The declarations for 'UsersTable', 'ProductsTable', 'StocksTable', and 'CommentsTable' have been moved closer to their respective table schemas.
This commit corrects the order of the imports in the schema file by importing 'zod' correctly. It also removes the extra unnecessary white spaces in between the lines for a cleaner code.
This commit includes upgrading of multiple packages in `pnpm-lock.yaml` and adding new dependencies including `@anatine/zod-nestjs`, `@anatine/zod-openapi`, `class-transformer`, `class-validator`, `openapi3-ts`, and `pure-rand`. The `nestjs` related packages have been updated and certain validation packages were added to their version.
The ZodFilter and ZodPipe classes located under src/pipes have been completely removed. This includes deletion of all features, methods, and imports associated with these classes.
This commit reimplements the hashing, verification, and token signing methods in the CredentialsService. It also adjusts the constructor's parameters, reorders imports, and introduces additional logging for debugging purposes. Finally, it corrects minor formatting and style issues in the credentials.service.ts and credentials.module.ts files.
This commit introduces a new feature for user signup. It creates `auth.controller.ts`, `auth.dto.ts`, and `auth.schema.ts` for handling user registration requests with validation. Moreover, it enhances `auth.service.ts` to handle the database interaction part and also modifies `auth.module.ts` by adding `AuthController`. Now, the application can handle user registration successfully with proper error handling.
This commit reorganizes the insert and select schema declarations for improved readability. The declarations for 'UsersTable', 'ProductsTable', 'StocksTable', and 'CommentsTable' have been moved closer to their respective table schemas.
In the credentials.service.ts file, jose is imported for jwt token operations. Two new methods are added. One method for jwt token verification and another for token signing. Token metadata such as IssuedAt, ExpirationTime, Issuer, Audience, and Subject are configured.
A new "style" configuration has been added to the `biome.json` file. Specifically, the "useImportType" key has been set to "off". This update sets a new rule for JSON style patterns within the project.
This commit introduces two new files: zod.pipe.filter.ts and zod.pipe.ts. The `ZodFilter` catches ZodErrors and defines the HTTP response json format. The `ZodPipe` validates incoming data against a predefined schema.
Introduce the Credentials service which is responsible for hashing and verifying passwords. Added appropriate methods within the service and provided it in a new Credentials module. The module exports the service to allow its use in other parts of the application.
This commit relocates the schema definitions by deleting the existing `drizzle/schema.ts` and creating a new `schema.ts` file. It also enhances these definitions by adding `createInsertSchema` and `createSelectSchema` for each table.
This commit includes drizzle-zod version 0.5.1 to the project's dependencies. It updates the package.json and pnpm-lock.yaml files, ensuring a stable integration of the latest drizzle-zod library.
The main.ts file has been reformatted according to the coding standards. This change includes correcting several indentation issues and ensuring that all imports are properly grouped. There is no impact on functionality.
This commit implements additional operations in AuthService such as user registration, login, fetching, updating, and deletion. It also adds two new dependencies: DrizzleService and CredentialsService. Moreover, AuthService now implements OnModuleInit for executing methods once the module has been initialized. Corresponding changes are reflected in the module structure.
A new authentication service and module were added to the application. The app.module.ts file was updated to include this newly created AuthModule. Also, an initial structure for the AuthService was set up.
A new authentication service and module were added to the application. The app.module.ts file was updated to include this newly created AuthModule. Also, an initial structure for the AuthService was set up.
Implement Drizzle service and integration in the project. A new Drizzle module was added to the nest app. The Drizzle service also includes configuration for postgres database and management of migration client. An adjustment was also made to tsconfig.json to enable ES module interoperation.
A new file logger.service.ts is created which implements the LoggerService from @nestjs/common. This service utilizes the Winston logging library and includes logging functions for different levels of messages such as log, error, warn, debug, and verbose. A logger object with timestamp and simple format is configured to output the logs to both console and a file named "application.log".
This commit adds several new tables to the schema for the drizzle ORM, including tables for users, products, stock, comments, and purchase history. Each table contains defined fields with appropriate data types and constraints. This forms the basis for storage and retrieval of relevant data within the application.
A new .env file has been added with important elements for the application's configuration such as postgres database details, app port, encryption keys and other related data. This essential configuration is crucial for the proper operation of the application in different environments.