51 Commits

Author SHA1 Message Date
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
62e92f50ea
feat: update .gitignore to ignore .env files
Update the .gitignore file to also ignore all .env files. This ensures that sensitive environment-specific variables are not exposed or accidentally committed to the repository, contributing to enhanced security.
2024-07-09 13:43:44 +02:00
216d2be4f8
feat: Add Drizzle configuration file
This commit introduces a new Drizzle configuration file, 'drizzle.config.ts'. It establishes the schema path, output directory, dialect, and database credentials (such as host, user, password, and database) using environment variables.
2024-07-09 13:43:25 +02:00
b95f5be3a6
feat(app.module): add ThrottlerModule and ConfigModule
A new app.module.ts file was added with ThrottlerModule and ConfigModule imported from NestJS. The throttler is configured with a rate limit and the configuration module is set as global. The LogService was provided and exported for other parts of the application to use.
2024-07-09 13:42:41 +02:00
25d69823fa
feat: Initialize main NestJS application in 'src/main.ts'
This commit introduces 'src/main.ts' which starts up the NestJS application. It uses Fastify as the underlying HTTP server and leverages the helmet middleware for security. The CORS is also enabled for the application that will listen on the specified APP_PORT or default to port 3333.
2024-07-09 13:42:21 +02:00
481727ecf0
feat: Exclude dataSources folder from backend module
This commit updates the .idea/backend-main.iml to exclude the `.idea/dataSources` folder, improving file organization and preventing unnecessary tracking.
2024-07-09 13:42:03 +02:00
411fb981ef
feat: Add initial configuration files
New configuration files have been added for TypeScript, Biome, Nest CLI, Docker-compose, and environment variables. This setup includes TypeScript compiler options, biome schema settings, database container configuration and more. Additionally, a .gitignore file is added to exclude unnecessary files from the git repository.
2024-07-09 13:39:55 +02:00
2e649e6a6d
feat: Add package.json for new project initialization
This commit introduces package.json for setting up the new project titled "should-stick-back". The package.json file includes all necessary scripts, dependencies, devDependencies, and jest configuration for the project. This is a foundational step for establishing the codebase.
2024-07-09 13:38:52 +02:00
71ac0bad1d
feat: Add pnpm-lock.yaml with dependencies
This commit includes a new `pnpm-lock.yaml` file that contains a list of the project's dependencies with their corresponding versions. This ensures that each installation receives an identical set of packages, preventing version inconsistencies across different development environments.
2024-07-09 13:38:32 +02:00
dd80667c13
feat: Add settings for DB navigator, Git toolbox blame and code styles
This commit includes settings for the Database Navigator and Git Toolbox Blame with changes to the IDE's XML files. Also, modifications are made to project's code styles tasking the formatter to maintain a consistent development environment.
2024-07-09 13:37:08 +02:00
38223c7f4d
feat(README): Update content and format
The README.md file has been significantly expanded and formatted. It now includes a more detailed description of the project, installation and running instructions, testing procedures, and additional project support and contact information. Nest framework usage orientation has been enhanced.
2024-07-08 11:43:27 +02:00