Skip to content

Commit

Permalink
hotfix: configuration-changes (#1016)
Browse files Browse the repository at this point in the history
* hotfix:configuration-changes

Signed-off-by: pallavicoder <[email protected]>

* fix:fixed-sonar-issues

Signed-off-by: pallavicoder <[email protected]>

* fix:fixed-added-constants

Signed-off-by: pallavicoder <[email protected]>

* fix:fixed-sonar-issues

Signed-off-by: pallavicoder <[email protected]>

* fix:removed import from issunce service

Signed-off-by: pallavicoder <[email protected]>

* fix:resolved sonar lint issues

Signed-off-by: Ankita Patidar <[email protected]>

---------

Signed-off-by: pallavicoder <[email protected]>
Signed-off-by: Ankita Patidar <[email protected]>
Co-authored-by: Ankita Patidar <[email protected]>
  • Loading branch information
pallavighule and ankita-p17 authored Oct 11, 2024
1 parent 435f68a commit 3f55e20
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,8 @@ KEYCLOAK_REALM=xxxxxxx

ENABLE_CORS_IP_LIST="" # Provide a list of domains that are allowed to use this server
SCHEMA_FILE_SERVER_URL= // Please provide schema URL
SCHEMA_FILE_SERVER_TOKEN=xxxxxxxx // Please provide schema file server token for polygon
SCHEMA_FILE_SERVER_TOKEN=xxxxxxxx // Please provide schema file server token for polygon

FILEUPLOAD_CACHE_TTL= //Provide file upload cache ttl

FIELD_UPLOAD_SIZE= //Provide field upload size
5 changes: 4 additions & 1 deletion apps/api-gateway/src/issuance/issuance.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { ForbiddenErrorDto } from '../dtos/forbidden-error.dto';
import { Response } from 'express';
import IResponseType, { IResponse } from '@credebl/common/interfaces/response.interface';
import { IssuanceService } from './issuance.service';
import { CommonConstants } from '../../../../libs/common/src/common.constant';
import {
ClientDetails,
CredentialQuery,
Expand Down Expand Up @@ -400,7 +401,9 @@ async downloadBulkIssuanceCSVTemplate(
},
required: true
})
@UseInterceptors(FileInterceptor('file'))
@UseInterceptors(FileInterceptor('file', {
limits: { fieldSize: Number(process.env.FIELD_UPLOAD_SIZE) || CommonConstants.DEFAULT_FIELD_UPLOAD_SIZE }
}))

async issueBulkCredentials(
@Body() clientDetails: ClientDetails,
Expand Down
16 changes: 8 additions & 8 deletions apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export class IssuanceService {
private readonly commonService: CommonService,
private readonly issuanceRepository: IssuanceRepository,
private readonly userActivityRepository: UserActivityRepository,
@Inject(CACHE_MANAGER) private cacheManager: Cache,
@Inject(CACHE_MANAGER) private readonly cacheManager: Cache,
private readonly outOfBandIssuance: OutOfBandIssuance,
private readonly emailData: EmailDto,
private readonly awsService: AwsService,
@InjectQueue('bulk-issuance') private bulkIssuanceQueue: Queue,
@Inject(CACHE_MANAGER) private cacheService: Cache
@InjectQueue('bulk-issuance') private readonly bulkIssuanceQueue: Queue,
@Inject(CACHE_MANAGER) private readonly cacheService: Cache
) { }

async getIssuanceRecords(orgId: string): Promise<number> {
Expand Down Expand Up @@ -253,8 +253,7 @@ export class IssuanceService {

attributesArray.forEach((attribute) => {
if (attribute.attributeName && attribute.isRequired) {

payload.attributes.map((attr) => {
payload.attributes.forEach((attr) => {
if (attr.name === attribute.attributeName && attribute.isRequired && !attr.value) {
schemadetailsResponseError.push(
`Attribute '${attribute.attributeName}' is required but has an empty value.`
Expand Down Expand Up @@ -1173,9 +1172,10 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO
credentialPayload.fileName = fileName;
const newCacheKey = uuidv4();

await this.cacheManager.set(requestId ? requestId : newCacheKey, JSON.stringify(credentialPayload), 60000);

return newCacheKey;
const cacheTTL = Number(process.env.FILEUPLOAD_CACHE_TTL) || CommonConstants.DEFAULT_CACHE_TTL;
await this.cacheManager.set(requestId || newCacheKey, JSON.stringify(credentialPayload), cacheTTL);

return newCacheKey;

} catch (error) {
this.logger.error(`error in validating credentials : ${error.response}`);
Expand Down
6 changes: 5 additions & 1 deletion libs/common/src/common.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export enum CommonConstants {
URL_WALLET_SET_TAGGING_POLICY = '/wallet/tag-policy/#',
URL_WALLET_PROVISION = '/wallet/provision',

DEFAULT_CACHE_TTL = 60000,
DEFAULT_FIELD_UPLOAD_SIZE = 10485760,

// LEDGER SERVICES
URL_LEDG_GET_DID_VERKEY = '/ledger/did-verkey?did=#',
URL_LEDG_REGISTER_NYM = '/ledger/register-nym?did=#&verkey=@&role=$',
Expand Down Expand Up @@ -345,7 +348,8 @@ BATCH_SIZE = 100,
MAX_CONCURRENT_OPERATIONS = 50,
ISSUANCE_BATCH_SIZE = 2000,
ISSUANCE_MAX_CONCURRENT_OPERATIONS = 1000,
ISSUANCE_BATCH_DELAY = 60000, //Intially 60000
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
ISSUANCE_BATCH_DELAY = 60000,


// MICROSERVICES NAMES
Expand Down

0 comments on commit 3f55e20

Please sign in to comment.