61 Commits

Author SHA1 Message Date
4b335ad0a4
build(package): add file-type and multer dependencies
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.
2024-07-24 20:29:33 +02:00
fab662ba44
feat(app): add UploadsModule
Included UploadsModule in the app module imports array. This addition facilitates handling file upload capabilities within the application.
2024-07-24 20:28:57 +02:00
b558d344e1
fix(credentials): handle token verification errors
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.
2024-07-24 20:26:53 +02:00
b8a472bfcd
refactor(products): remove unused import from DTO file
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.
2024-07-24 20:26:37 +02:00
38009bfbcb
docs(transactions.service): update TODO comments for transactions
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.
2024-07-24 20:26:16 +02:00
314625bd9c
feat(uploads): add file upload and retrieval capabilities
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.
2024-07-24 20:26:04 +02:00
27f79d4e46
feat(auth): add user management endpoint and update guards
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.
2024-07-24 20:25:46 +02:00
5d24f36133
feat(stocks.module): add CredentialsModule to imports
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.
2024-07-15 14:37:01 +02:00
b62bf79221
feat(products): add find by id method in product service
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.
2024-07-15 14:35:05 +02:00
e2f7ae8b88
feat(stocks): implement new endpoints and methods for stock management
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.
2024-07-15 14:34:45 +02:00
3451f17123
docs(stocks): implement CRUD operations for product stocks
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.
2024-07-15 12:25:58 +02:00
3b201d63fe
refactor(auth): simplify AdminGuard constructor and register it in AuthModule
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.
2024-07-15 12:16:51 +02:00
b9b2adb804
feat(products): update products service, controller and module
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.
2024-07-15 12:16:25 +02:00
5ee51daf82
feat(schema): add unique constraint to slug_name of a product.
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.
2024-07-15 11:47:28 +02:00
c3bac6d348
feat(products): implement edit and delete product functions of the controller.
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.
2024-07-15 11:43:46 +02:00
dea5f8c48b
feat(auth): use reflector for service injection in guards
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.
2024-07-15 11:41:39 +02:00
007cee5951
feat(products): implement CRUD operations and pagination
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.
2024-07-15 11:41:18 +02:00
1618bee00d
docs: Add TODO comments to transactions and stocks services
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.
2024-07-12 14:28:15 +02:00
fb0b7c7036
feat: enable DuplicatedCode inspection tool in the project
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.
2024-07-12 14:25:16 +02:00
2a879c71f1
feat: Update fetchUser function and add new modules
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'.
2024-07-12 14:25:05 +02:00
b03b178fe3
docs(products): add TODOs for future functionalities
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.
2024-07-12 14:24:02 +02:00
cb8de798c3
feat: Add new modules and services for stocks, transactions, and products
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.
2024-07-12 14:20:48 +02:00
5d696a9118
refactor(drizzle): remove unnecessary lint/style comments from the service
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.
2024-07-12 14:09:33 +02:00
af2f7da066
feat(auth): add signIn method to the controller.
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.
2024-07-12 14:08:44 +02:00
a157553b78
feat(auth): add UserGuard and AdminGuard
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.
2024-07-12 14:08:09 +02:00
a4096d291d
0.1.0 2024-07-11 14:59:19 +02:00
5a5a8c1114
style(credentials): correct syntax and improve formatting in CredentialsService
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.
2024-07-11 14:59:15 +02:00
f681dd77bd
feat(auth): add user update and delete methods in auth service
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.
2024-07-11 14:58:34 +02:00
6fb474172a
0.0.2 2024-07-11 13:56:06 +02:00
63c165f5cc
refactor(schema): Reorganize insert and select schema declarations
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.
2024-07-11 13:55:47 +02:00
32f01ec058
fix(schema): correct order of imports and remove extra spaces
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.
2024-07-11 13:55:02 +02:00
7ccd247e92
build: Update several package dependencies
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.
2024-07-11 13:54:41 +02:00
ed19be6369
feat: Remove ZodFilter and ZodPipe classes
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.
2024-07-11 13:51:40 +02:00
6905e8faee
feat(credentials): refactor hashing, verification, and token signing methods
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.
2024-07-11 13:51:13 +02:00
de3d1cca05
feat(auth): Implement user signup functionality
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.
2024-07-11 13:50:43 +02:00
1990bedcfd
refactor(schema): Reorganize insert and select schema declarations
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.
2024-07-10 10:13:04 +02:00
3ac89964ab
feat(credentials): add jwt token verification and signing
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.
2024-07-09 16:03:20 +02:00
17b07e9432
build(biome): Add style configuration to JSON
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.
2024-07-09 16:02:44 +02:00
763217dfdf
feat(pipes): add zod filter and zod pipe
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.
2024-07-09 16:02:17 +02:00
cac7d4cfd3
feat(credentials): add new Credentials service and module
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.
2024-07-09 15:06:37 +02:00
2aa793c91d
feat(schema): Move and enhance schema definitions
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.
2024-07-09 15:06:18 +02:00
ed2fc3dbf9
feat: add drizzle-zod to dependencies
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.
2024-07-09 15:05:43 +02:00
da99165531
style(main): Reformat code for readability
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.
2024-07-09 15:02:54 +02:00
e1909791ac
feat(auth): Enhance AuthService with additional functionalities and dependencies
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.
2024-07-09 15:02:25 +02:00
bb482fb896
feat(auth): add Auth service and module
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.
2024-07-09 15:01:36 +02:00
3c57098bbe
feat(auth): add Auth service and module
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.
2024-07-09 14:11:13 +02:00
e575b669ce
feat: add Drizzle module and service
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.
2024-07-09 14:08:03 +02:00
1971a0dcfd
feat(logger): Add new Logger service
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".
2024-07-09 13:45:05 +02:00
573d4eac9c
feat(schema): add user, product, stock, comment and purchase tables
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.
2024-07-09 13:44:50 +02:00
a3433bf5da
feat: Add .env configuration file
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.
2024-07-09 13:44:07 +02:00