Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/credebl/platform into merge…
Browse files Browse the repository at this point in the history
…/qa-to-prod-August-2024
  • Loading branch information
GHkrishna committed Aug 28, 2024
2 parents 3880e46 + 740146f commit f61b098
Show file tree
Hide file tree
Showing 10 changed files with 475 additions and 25 deletions.
264 changes: 264 additions & 0 deletions .github/ISSUE_TEMPLATE/DMP_2024.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
name: DMP 2024 Project Template
description: List a new project for Dedicated Mentoring Program (DMP) 2024
title: '[DMP 2024]: '
labels: ['DMP 2024']
body:
- type: textarea
id: ticket-description
validations:
required: true
attributes:
label: Ticket Contents
value: |
## Description
[Provide a brief description of the feature, including why it is needed and what it will accomplish.]
- type: textarea
id: ticket-goals
validations:
required: true
attributes:
label: Goals & Mid-Point Milestone
description: List the goals of the feature. Please add the goals that must be achieved by Mid-point check-in i.e 1.5 months into the coding period.
value: |
## Goals
- [ ] [Goal 1]
- [ ] [Goal 2]
- [ ] [Goal 3]
- [ ] [Goal 4]
- [ ] [Goals Achieved By Mid-point Milestone]
- type: textarea
id: ticket-setup
attributes:
label: Setup/Installation
description: Please list or link setup or installation guide (if any)

- type: textarea
id: ticket-expected-outcome
attributes:
label: Expected Outcome
description: Describe in detail what the final product or result should look like and how it should behave.

- type: textarea
id: ticket-acceptance-criteria
attributes:
label: Acceptance Criteria
description: List the acceptance criteria for this feature.

- type: textarea
id: ticket-implementation-details
validations:
required: true
attributes:
label: Implementation Details
description: List any technical details about the proposed implementation, including any specific technologies that will be used.

- type: textarea
id: ticket-mockups
attributes:
label: Mockups/Wireframes
description: Include links to any visual aids, mockups, wireframes, or diagrams that help illustrate what the final product should look like. This is not always necessary, but can be very helpful in many cases.

- type: input
id: ticket-product
attributes:
label: Product Name
placeholder: Enter Product Name
validations:
required: true

- type: dropdown
id: ticket-organisation
attributes:
label: Organisation Name
description: Enter Organisation Name
multiple: false
options:
- Bandhu
- Blockster Labs (CREDEBL)
- Civis
- Dhwani
- Dhiway
- EGov
- EkShop Marketplace
- FIDE
- If Me
- Key Education Foundation
- Norwegian Meteorological Institute
- Planet Read
- Project Second Chance
- Reap Benefit
- SamagraX
- ShikshaLokam
- Tech4Dev
- Tekdi
- The Mifos Initiative
- Tibil
- Ushahidi
- Arghyam
- Piramal Swasthya Management Research Institute
validations:
required: true

- type: dropdown
id: ticket-governance-domain
attributes:
label: Domain
options:
- Healthcare
- Education
- Financial Inclusion
- Livelihoods
- Skilling
- Learning & Development
- Agriculture
- Service Delivery
- Open Source Library
- Water
- Identity & Digital Credentialing
validations:
required: true

- type: dropdown
id: ticket-technical-skills-required
attributes:
label: Tech Skills Needed
description: Select the technologies needed for this ticket (use Ctrl or Command to select multiple)
multiple: true
options:
- .NET
- Angular
- Artificial Intelligence
- ASP.NET
- Astro.js
- AWS
- Babel
- Bootstrap
- C#
- Chart.js
- CI/CD
- Computer Vision
- CORS
- cURL
- Cypress
- D3.js
- Database
- Debugging
- Deno
- Design
- DevOps
- Django
- Docker
- Electron
- ESLint
- Express.js
- Feature
- Flask
- Go
- GraphQL
- HTML
- Ionic
- Jest
- Java
- JavaScript
- Jenkins
- JWT
- Kubernetes
- Laravel
- Machine Learning
- Maintenance
- Markdown
- Material-UI
- Microservices
- MongoDB
- Mobile
- Mockups
- Mocha
- Natural Language Processing
- NATS Messaging
- NestJS
- Next.js
- Node.js
- NUnit
- OAuth
- Performance Improvement
- Prettier
- Python
- Question
- React
- React Native
- Redux
- RESTful APIs
- Ruby
- Ruby on Rails
- Rust
- Scala
- Security
- Selenium
- SEO
- Serverless
- Solidity
- Spring Boot
- SQL
- Swagger
- Tailwind CSS
- Test
- Testing Library
- Three.js
- TypeScript
- UI/UX/Design
- Virtual Reality
- Vue.js
- WebSockets
- Webpack
- Other
validations:
required: true

- type: textarea
id: ticket-mentors
attributes:
label: Mentor(s)
description: Please tag relevant mentors for the ticket
validations:
required: true

- type: dropdown
id: ticket-category
attributes:
label: Category
description: Choose the categories that best describe your ticket
multiple: true
options:
- API
- Analytics
- Accessibility
- Backend
- Breaking Change
- Beginner Friendly
- Configuration
- CI/CD
- Database
- Data Science
- Deprecation
- Documentation
- Deployment
- Frontend
- Internationalization
- Localization
- Machine Learning
- Maintenance
- Mobile
- Performance Improvement
- Question
- Refactoring
- Research
- Needs Reproduction
- SEO
- Security
- Testing
- AI
- Other
validations:
required: true
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile.verification
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ COPY --from=build /app/libs/ ./libs/
COPY --from=build /app/node_modules ./node_modules

# Set the command to run the microservice
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/verification/main.js"]
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/verification/main.js"]
1 change: 0 additions & 1 deletion apps/api-gateway/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async function bootstrap(): Promise<void> {
}
next();
});

const options = new DocumentBuilder()
.setTitle(`${process.env.PLATFORM_NAME}`)
.setDescription(`${process.env.PLATFORM_NAME} Platform APIs`)
Expand Down
11 changes: 3 additions & 8 deletions apps/api-gateway/src/user/dto/share-certificate.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@ interface Attribute {
value: string;
}
export class CreateCertificateDto {

@ApiProperty()
@IsNotEmpty({ message: 'Please provide valid schemaId' })
@IsNotEmpty({ message: 'Please provide valid credentialId' })
@Transform(({ value }) => trim(value))
@IsString({ message: 'credentialId should be string' })
credentialId: string;

@ApiProperty({ example: 'SchemaId' })
@ApiProperty({ example: 'schemaId' })
@IsNotEmpty({ message: 'Please provide valid schemaId' })
@Transform(({ value }) => trim(value))
@IsString({ message: 'schemaId should be string' })
schemaId: string;

@ApiProperty({ example: 'CredDefId' })
@IsNotEmpty({ message: 'Please provide valid schemaId' })
@Transform(({ value }) => trim(value))
@IsString({ message: 'credDefId should be string' })
credDefId?: string;

@ApiProperty({
example: [
{
Expand Down
40 changes: 34 additions & 6 deletions apps/user/src/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ export class UserService {

async shareUserCertificate(shareUserCertificate: IShareUserCertificate): Promise<string> {

let template;
const attributeArray = [];
let attributeJson = {};
const attributePromises = shareUserCertificate.attributes.map(async (iterator: Attribute) => {
Expand All @@ -902,8 +903,6 @@ export class UserService {
attributeArray.push(attributeJson);
});
await Promise.all(attributePromises);
let template;

switch (shareUserCertificate.schemaId.split(':')[2]) {
case UserCertificateId.WINNER:
// eslint-disable-next-line no-case-declarations
Expand All @@ -925,22 +924,35 @@ export class UserService {
const userWorldRecordTemplate = new WorldRecordTemplate();
template = await userWorldRecordTemplate.getWorldRecordTemplate(attributeArray);
break;
case UserCertificateId.AYANWORKS_EVENT:
// eslint-disable-next-line no-case-declarations
const QRDetails = await this.getShorteningURL(shareUserCertificate, attributeArray);

if (shareUserCertificate.attributes.some(item => item.value.toLocaleLowerCase().includes("pinnacle"))) {
const userPinnacleTemplate = new EventPinnacle();
template = await userPinnacleTemplate.getPinnacleWinner(attributeArray, QRDetails);
} else {
const userCertificateTemplate = new EventCertificate();
template = await userCertificateTemplate.getCertificateWinner(attributeArray, QRDetails);
}
break;
default:
throw new NotFoundException('error in get attributes');
}

const option: IPuppeteerOption = {height: 0, width: 1000};
//Need to handle the option for all type of certificate
const option: IPuppeteerOption = {height: 974, width: 1606};

const imageBuffer =
await this.convertHtmlToImage(template, shareUserCertificate.credentialId, option);
const verifyCode = uuidv4();

const imageUrl = await this.awsService.uploadUserCertificate(
imageBuffer,
'svg',
'certificates',
process.env.AWS_PUBLIC_BUCKET_NAME,
'base64'
'base64',
'certificates'
);
const existCredentialId = await this.userRepository.getUserCredentialsById(shareUserCertificate.credentialId);

Expand All @@ -966,7 +978,7 @@ export class UserService {
const browser = await puppeteer.launch({
executablePath: '/usr/bin/google-chrome',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
protocolTimeout: 200000,
protocolTimeout: 800000, //initial - 200000
headless: true
});

Expand All @@ -980,6 +992,22 @@ export class UserService {
return screenshot;
}

//Need to add interface
async getShorteningURL(shareUserCertificate, attributeArray): Promise<unknown> {
const urlObject = {
schemaId: shareUserCertificate.schemaId,
credDefId: shareUserCertificate.credDefId,
attribute: attributeArray,
credentialId:shareUserCertificate.credentialId,
email:attributeArray.find((attr) => "email" in attr).email
};

const qrCodeOptions = { type: 'image/png' };
const encodedData = Buffer.from(JSON.stringify(shareUserCertificate)).toString('base64');
const qrCode = await QRCode.toDataURL(`https://credebl.id/c_v?${encodedData}`, qrCodeOptions);

return qrCode;
}
/**
*
* @param acceptRejectInvitation
Expand Down
Loading

0 comments on commit f61b098

Please sign in to comment.