forked from Sunbird-RC/sunbird-rc-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-2.0.0' into credential
- Loading branch information
Showing
83 changed files
with
9,403 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
.env | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DATABASE_URL="" | ||
SHADOW_DATABASE_URL="" | ||
|
||
# Auth related vars | ||
JWKS_URI="" | ||
ENABLE_AUTH=false | ||
|
||
# Core Service Vars | ||
IDENTITY_BASE_URL= # URL of the identity service to facilitate DID creation | ||
|
||
# Service VARS | ||
PORT=3000 | ||
SCHEMA_BASE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir : __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
#Environment files | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM node:16 AS install | ||
WORKDIR /app | ||
COPY package.json yarn.lock ./ | ||
RUN yarn | ||
|
||
FROM node:16 as build | ||
WORKDIR /app | ||
COPY prisma ./prisma/ | ||
COPY --from=install /app/node_modules ./node_modules | ||
RUN npx prisma generate | ||
COPY . . | ||
RUN yarn build | ||
|
||
FROM node:16 | ||
WORKDIR /app | ||
COPY --from=build /app/dist ./dist | ||
COPY --from=build /app/package*.json ./ | ||
COPY --from=build /app/prisma ./prisma | ||
COPY --from=build /app/node_modules ./node_modules | ||
EXPOSE 3000 | ||
CMD [ "npm", "run", "start:migrate:prod" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:16 AS install | ||
WORKDIR /app | ||
COPY package.json yarn.lock ./ | ||
RUN yarn | ||
|
||
FROM node:16 as test | ||
WORKDIR /app | ||
COPY prisma ./prisma/ | ||
COPY --from=install /app/node_modules ./node_modules | ||
RUN npx prisma generate | ||
COPY . . | ||
EXPOSE 3000 | ||
CMD [ "yarn", "test:migrate"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
IMAGE:=dockerhub/sunbird-rc-credential-schema | ||
|
||
.PHONY: docker publish test | ||
|
||
docker: | ||
@docker build -t $(IMAGE) . | ||
|
||
publish: | ||
@docker push $(IMAGE) | ||
|
||
test: | ||
# Resetting vault of identity-service before running the tests | ||
make -C ../identity-service stop | ||
make -C ../identity-service vault-reset | ||
# Creating an external docker network to connnect services in different compose | ||
@docker network create rcw-test || echo "" | ||
# Starting dependent services | ||
make -C ../identity-service compose-init | ||
@docker-compose -f docker-compose-test.yml down | ||
@docker-compose -f docker-compose-test.yml up --build --abort-on-container-exit | ||
make -C ../identity-service stop | ||
make -C ../identity-service vault-reset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Credential Schema Microservice | ||
|
||
## Description | ||
|
||
[Nest](https://github.com/nestjs/nest) based CRUD APIs for handling the schemas of different verifiable credentials used for implementing the [Unified Learner's Passbook](https://github.com/Unified-Learners-Passbook) in the state of Uttar Pradesh, India. | ||
|
||
## Installation | ||
|
||
```bash | ||
|
||
$ npm install | ||
|
||
``` | ||
OR | ||
```bash | ||
|
||
$ npx yarn | ||
|
||
``` | ||
## Running the app | ||
|
||
```bash | ||
# development | ||
$ npm run start | ||
|
||
# watch mode | ||
$ npm run start:dev | ||
|
||
# production mode | ||
$ npm run start:prod | ||
``` | ||
|
||
OR | ||
|
||
```bash | ||
# development | ||
$ npx yarn run start | ||
|
||
# watch mode | ||
$ npx yarn run start:dev | ||
|
||
# production mode | ||
$ npx yarn run start:prod | ||
``` | ||
|
||
## Test | ||
|
||
```bash | ||
# unit tests | ||
$ npm run test | ||
|
||
# e2e tests | ||
$ npm run test:e2e | ||
|
||
# test coverage | ||
$ npm run test:cov | ||
``` | ||
|
||
OR | ||
|
||
```bash | ||
# unit tests | ||
$ npx yarn run test | ||
|
||
# e2e tests | ||
$ npx yarn run test:e2e | ||
|
||
# test coverage | ||
$ npx yarn run test:cov | ||
``` | ||
|
||
## Stay in touch | ||
|
||
- Authors - [Yash Mittal](https://github.com/techsavvyash) and [Chakshu Gautam](https://github.com/ChakshuGautam) | ||
- Website - [https://nestjs.com](https://nestjs.com/) | ||
|
||
## License | ||
|
||
Nest is [MIT licensed](LICENSE). | ||
|
||
## Reference Links | ||
|
||
- [W3C Credential Schema (Currently being used)](https://w3c-ccg.github.io/vc-json-schemas/schema/2.0/schema.json) | ||
- [W3C Credential Schema (initially used)](https://w3c-ccg.github.io/vc-json-schemas/schema/1.0/schema.json) | ||
- [W3C JSON Schemas Website](https://w3c-ccg.github.io/vc-json-schemas/) | ||
- [API Documentation](https://github.com/Sunbird-RC/sunbird-rc-core/tree/main/api-documentation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: '3' | ||
|
||
services: | ||
db-test: | ||
image: postgres:12 | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
networks: | ||
test: | ||
|
||
credential-schema-test: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.test | ||
depends_on: | ||
db-test: | ||
condition: service_healthy | ||
environment: | ||
DATABASE_URL: postgres://postgres:postgres@db-test:5432/postgres | ||
IDENTITY_BASE_URL: "http://identity-service:3332" | ||
ENABLE_AUTH: "false" | ||
networks: | ||
test: | ||
rcw-test: | ||
|
||
networks: | ||
rcw-test: | ||
external: true | ||
test: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
version: '3' | ||
|
||
services: | ||
db: | ||
image: postgres:12 | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
volumes: | ||
- data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
credential-schema: | ||
image: cred | ||
build: . | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
ports: | ||
- '3333:3333' | ||
environment: | ||
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres | ||
IDENTITY_BASE_URL: "http://identity-service:3332" | ||
ENABLE_AUTH: "false" | ||
networks: | ||
rcw-test: | ||
default: | ||
|
||
|
||
networks: | ||
rcw-test: | ||
external: true | ||
|
||
volumes: | ||
data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src" | ||
} |
Oops, something went wrong.