Skip to content

Commit 9de6ea5

Browse files
📝 Add docstrings to qa
Docstrings generation was requested by @KambleSahil3. * #1286 (comment) The following files were modified: * `apps/api-gateway/src/main.ts` * `libs/common/src/custom-overrideable-validation-pipe.ts` * `libs/prisma-service/prisma/scripts/update_client_credential_data.sh`
1 parent 52143b0 commit 9de6ea5

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

apps/api-gateway/src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ import { NatsInterceptor } from '@credebl/common';
1717
import { UpdatableValidationPipe } from '@credebl/common/custom-overrideable-validation-pipe';
1818
dotenv.config();
1919

20+
/**
21+
* Bootstraps and starts the NestJS API Gateway application with microservice integration, middleware, API documentation, security, and global configuration.
22+
*
23+
* Initializes the application, connects to a NATS microservice, sets up middleware for request parsing and URL validation, configures Swagger API documentation, applies global exception filters, enables CORS based on environment configuration, serves static files, applies a custom global validation pipe, enables security middleware, and starts listening on the configured host and port.
24+
*/
2025
async function bootstrap(): Promise<void> {
2126
const app = await NestFactory.create(AppModule);
2227

libs/common/src/custom-overrideable-validation-pipe.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ import { Reflector } from '@nestjs/core';
1818

1919
export const REWRITE_VALIDATION_OPTIONS = 'rewrite_validation_options';
2020

21-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
21+
/**
22+
* Decorator that overrides global validation options for a specific route handler or controller.
23+
*
24+
* Attaches custom {@link ValidatorOptions} metadata, allowing selective adjustment of validation behavior such as whitelisting or property checks on a per-handler or per-class basis.
25+
*
26+
* @param options - The validation options to apply for the decorated handler or class.
27+
*/
2228
export function RewriteValidationOptions(options: ValidatorOptions) {
2329
return SetMetadata(REWRITE_VALIDATION_OPTIONS, options);
2430
}

libs/prisma-service/prisma/scripts/update_client_credential_data.sh

100755100644
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,20 @@ DB_URL=$1
55
CLIENT_ID=$2
66
CLIENT_SECRET=$3
77

8-
# Function to update clientId and clientSecret
8+
# Updates the clientId and clientSecret fields in the "user" table where both are NULL.
9+
#
10+
# Globals:
11+
# DB_URL: The database connection URL.
12+
# CLIENT_ID: The new clientId value to set.
13+
# CLIENT_SECRET: The new clientSecret value to set.
14+
#
15+
# Outputs:
16+
# Prints the result of the SQL update operation to STDOUT, including success or failure messages.
17+
#
18+
# Example:
19+
#
20+
# update_client_credentials
21+
# # Updates all users with NULL clientId and clientSecret, setting them to the provided values.
922
update_client_credentials() {
1023
local update_query="UPDATE \"user\" SET \"clientId\" = '${CLIENT_ID}', \"clientSecret\" = '${CLIENT_SECRET}' WHERE \"clientId\" IS NULL AND \"clientSecret\" IS NULL;"
1124

0 commit comments

Comments
 (0)