Skip to content

Commit

Permalink
Merge pull request #285 from credebl/develop-main-bulk-issuances
Browse files Browse the repository at this point in the history
feat: bulk issuance feature to main
  • Loading branch information
KulkarniShashank authored Nov 21, 2023
2 parents 31d7e77 + 06229e9 commit aff582e
Show file tree
Hide file tree
Showing 59 changed files with 3,672 additions and 249 deletions.
32 changes: 29 additions & 3 deletions Dockerfiles/Dockerfile.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Stage 1: Build the application
FROM node:18-alpine as build
FROM node:18-slim as build
RUN npm install -g pnpm

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

# RUN apk update && apk list --all-versions chromium
# Set the working directory
WORKDIR /app

Expand All @@ -18,7 +32,19 @@ RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
RUN pnpm run build user

# Stage 2: Create the final image
FROM node:18-alpine
FROM node:18-slim

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app
Expand All @@ -38,4 +64,4 @@ CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx pri

# docker build -t user -f Dockerfiles/Dockerfile.user .
# docker run -d --env-file .env --name user docker.io/library/user
# docker logs -f user
# docker logs -f user
11 changes: 8 additions & 3 deletions apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class AgentServiceService {
return agentSpinUpResponse.then(async (agentDetails) => {
if (agentDetails) {
const controllerEndpoints = JSON.parse(agentDetails);
const agentEndPoint = `${process.env.API_GATEWAY_PROTOCOL}://${controllerEndpoints.CONTROLLER_ENDPOINT}`;
const agentEndPoint = `${process.env.AGENT_PROTOCOL}://${controllerEndpoints.CONTROLLER_ENDPOINT}`;

if (agentEndPoint && agentSpinupDto.clientSocketId) {
const socket = io(`${process.env.SOCKET_HOST}`, {
Expand Down Expand Up @@ -305,7 +305,9 @@ export class AgentServiceService {
if (agentSpinupDto.clientSocketId) {
socket.emit('invitation-url-creation-started', { clientId: agentSpinupDto.clientSocketId });
}
await this._createLegacyConnectionInvitation(orgData.id, user, agentPayload.walletName);

this.logger.log(`orgData.name ::: ${orgData.name}`);
await this._createLegacyConnectionInvitation(orgData.id, user, orgData.name);
if (agentSpinupDto.clientSocketId) {
socket.emit('invitation-url-creation-success', { clientId: agentSpinupDto.clientSocketId });
}
Expand Down Expand Up @@ -551,6 +553,9 @@ export class AgentServiceService {
ledgerId: payload.ledgerId
};

const getOrgAgent = await this.agentServiceRepository.getOrgDetails(payload.orgId);
this.logger.log(`getOrgAgent::: ${JSON.stringify(getOrgAgent)}`);

if (payload.clientSocketId) {
socket.emit('agent-spinup-process-completed', { clientId: payload.clientSocketId });
}
Expand All @@ -561,7 +566,7 @@ export class AgentServiceService {
socket.emit('invitation-url-creation-started', { clientId: payload.clientSocketId });
}

await this._createLegacyConnectionInvitation(payload.orgId, user, storeOrgAgentData.walletName);
await this._createLegacyConnectionInvitation(payload.orgId, user, getOrgAgent.name);

if (payload.clientSocketId) {
socket.emit('invitation-url-creation-success', { clientId: payload.clientSocketId });
Expand Down
12 changes: 11 additions & 1 deletion apps/api-gateway/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { commonNatsOptions } from 'libs/service/nats.options';
import { UserModule } from './user/user.module';
import { ConnectionModule } from './connection/connection.module';
import { EcosystemModule } from './ecosystem/ecosystem.module';
import { BullModule } from '@nestjs/bull';
import { CacheModule } from '@nestjs/cache-manager';
import * as redisStore from 'cache-manager-redis-store';

@Module({
imports: [
Expand All @@ -42,7 +45,14 @@ import { EcosystemModule } from './ecosystem/ecosystem.module';
UserModule,
ConnectionModule,
IssuanceModule,
EcosystemModule
EcosystemModule,
CacheModule.register({ store: redisStore, host: process.env.REDIS_HOST, port: process.env.REDIS_PORT }),
BullModule.forRoot({
redis: {
host: process.env.REDIS_HOST,
port: parseInt(process.env.REDIS_PORT)
}
})
],
controllers: [AppController],
providers: [AppService]
Expand Down
10 changes: 9 additions & 1 deletion apps/api-gateway/src/authz/socket.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@ export class SocketGateway implements OnGatewayConnection {
}

@SubscribeMessage('error-in-wallet-creation-process')
async handleErrorResponse(payload: ISocketInterface): Promise<void> {
async handleErrorResponse(client:string, payload: ISocketInterface): Promise<void> {
this.logger.log(`error-in-wallet-creation-process ${payload.clientId}`);
this.server
.to(payload.clientId)
.emit('error-in-wallet-creation-process', payload.error);
}

@SubscribeMessage('bulk-issuance-process-completed')
async handleBulkIssuance(client:string, payload: ISocketInterface): Promise<void> {
this.logger.log(`bulk-issuance-process-completed ${payload.clientId}`);
this.server
.to(payload.clientId)
.emit('bulk-issuance-process-completed', payload.error);
}
}
3 changes: 2 additions & 1 deletion apps/api-gateway/src/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@ export enum FileUploadType {
export enum FileUploadStatus {
started = 'PROCESS_STARTED',
completed = 'PROCESS_COMPLETED',
interrupted= 'PROCESS INTERRUPTED'
interrupted= 'PROCESS_INTERRUPTED',
retry= 'PROCESS_REINITIATED'
}
37 changes: 37 additions & 0 deletions apps/api-gateway/src/issuance/dtos/issuance.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,35 @@ export class OutOfBandCredentialDto {


export class PreviewFileDetails {
@ApiProperty({ required: false })
@IsOptional()
@Type(() => String)
search = '';

@ApiProperty({ required: false, default: 10 })
@IsOptional()
@Type(() => Number)
@Transform(({ value }) => toNumber(value))
pageSize = 10;

@ApiProperty({ required: false })
@IsOptional()
@Type(() => String)
sortValue = '';

@ApiProperty({ required: false })
@IsOptional()
@Type(() => String)
sortBy = '';

@ApiProperty({ required: false, default: 1 })
@IsOptional()
@Type(() => Number)
@Transform(({ value }) => toNumber(value))
pageNumber = 1;
}

export class FileParameter {
@ApiProperty({ required: false, default: 1 })
@IsOptional()
@Type(() => Number)
Expand Down Expand Up @@ -175,4 +204,12 @@ export class PreviewFileDetails {
@Type(() => String)
sortValue = '';

}

export class ClientDetails {
@ApiProperty({ required: false, example: '68y647ayAv79879' })
@IsOptional()
@Type(() => String)
clientId = '';

}
6 changes: 3 additions & 3 deletions apps/api-gateway/src/issuance/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export class IUserOrg {
export interface FileExportResponse {
response: unknown;
fileContent: string;
fileName : string
fileName: string
}

export interface RequestPayload {
credDefId: string;
filePath: string;
fileKey: string;
fileName: string;
}
}
Loading

0 comments on commit aff582e

Please sign in to comment.