From 379b6a5ab2498d179541d18e6ceaeb9f6585c492 Mon Sep 17 00:00:00 2001 From: radhay Date: Mon, 16 Jan 2023 01:21:58 +0530 Subject: [PATCH 1/6] Initial Commit --- prisma/schema.prisma | 5 ----- 1 file changed, 5 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e11e542..843f6bd 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -10,8 +10,3 @@ datasource db { url = env("DATABASE_URL") } -model User { - id Int @id @default(autoincrement()) - email String @unique - name String? -} From 66c22ce3aafbbfd18315f63a8c026b4e50c4f981 Mon Sep 17 00:00:00 2001 From: radhay Date: Mon, 16 Jan 2023 02:31:08 +0530 Subject: [PATCH 2/6] Added script for local dev setup --- README.md | 17 +++++++++++++++++ docker-compose.yml | 3 ++- run.sh | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 run.sh diff --git a/README.md b/README.md index 8372941..119addb 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,20 @@ [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. +## Local Dev Setup (Complete) +```bash + +# start all microservices and application(watch mode) +$ bash run.sh start + +# stop all microservices +$ bash run.sh stop + +# help +$ bash run.sh --help +``` + > To set up Manually + ## Installation ```bash @@ -35,6 +49,9 @@ $ yarn install ## Running the app ```bash +# docker +$ docker-compose up -d + # development $ yarn run start diff --git a/docker-compose.yml b/docker-compose.yml index 3986dbe..80f3b74 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,8 @@ services: broker: container_name: broker - image: "arm64v8/rabbitmq" + image: "docker.io/bitnami/rabbitmq:latest" + # image: "arm64v8/rabbitmq" environment: - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD} - RABBITMQ_USERNAME=${RABBITMQ_USERNAME} diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..73e9a73 --- /dev/null +++ b/run.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [[ $1 = "start" ]] +then + echo "starting services" + yarn install + docker-compose up -d + yarn start:dev +elif [[ $1 = "stop" ]] +then + echo "not ok" + docker-compose down +elif [[ $1 = "--help" ]] +then + echo "Usage: run.sh [COMMAND]" + echo "Commands:" + echo "start start all services" + echo "stop stop all services" +else + echo "Invalid Command" +fi \ No newline at end of file From 086f5e3667d9e7eb1d9ba4f15d5284d0051bab1d Mon Sep 17 00:00:00 2001 From: radhay Date: Mon, 16 Jan 2023 02:40:44 +0530 Subject: [PATCH 3/6] Fix: Readme --- README.md | 65 +++++-------------------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 119addb..ff0e359 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,16 @@

- Nest Logo -

-[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest +

Doc Generator

-

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us -

- -## Description +[![Build](https://github.com/Samagra-Development/PDF-Package/actions/workflows/docker-push.yml/badge.svg)](https://github.com/Samagra-Development/PDF-Package/actions/workflows/docker-push.yml) + +## About :open_book: -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. +An easily integrable and resusable tool built on OSS, can be easily leveraged to generate single and bulk documents in the any available formats interoperably and at same time it can upload the docs to your CDN and generate a short url for the content, you can integerate any url shortener service like bit.ly, tinyurl, etc (check our own url shortener service [here](https://github.com/Samagra-Development/yaus)). This service is developed on a plugin based model to ensure API federation across service and allow easy development of new plugins with less chances of error. -## Local Dev Setup (Complete) +## Dev Setup ```bash # start all microservices and application(watch mode) @@ -37,29 +21,6 @@ $ bash run.sh stop # help $ bash run.sh --help -``` - > To set up Manually - -## Installation - -```bash -$ yarn install -``` - -## Running the app - -```bash -# docker -$ docker-compose up -d - -# development -$ yarn run start - -# watch mode -$ yarn run start:dev - -# production mode -$ yarn run start:prod ``` ## Test @@ -74,17 +35,3 @@ $ yarn run test:e2e # test coverage $ yarn run test:cov ``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myƛliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](LICENSE). From da08b213623619cbfca6173913302cf5b63e63a1 Mon Sep 17 00:00:00 2001 From: radhay Date: Mon, 16 Jan 2023 02:41:23 +0530 Subject: [PATCH 4/6] Fix: Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff0e359..a4c5f27 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## About :open_book: -An easily integrable and resusable tool built on OSS, can be easily leveraged to generate single and bulk documents in the any available formats interoperably and at same time it can upload the docs to your CDN and generate a short url for the content, you can integerate any url shortener service like bit.ly, tinyurl, etc (check our own url shortener service [here](https://github.com/Samagra-Development/yaus)). This service is developed on a plugin based model to ensure API federation across service and allow easy development of new plugins with less chances of error. +An easy tool for generating single and bulk documents in several supported formats from templates. ## Dev Setup ```bash From 25b50c4e4cb5365628307f74aa2c6d6ba5fade0f Mon Sep 17 00:00:00 2001 From: radhay Date: Mon, 16 Jan 2023 02:47:50 +0530 Subject: [PATCH 5/6] Fix: Readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a4c5f27..4beaad5 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,12 @@ An easy tool for generating single and bulk documents in several supported forma ## Dev Setup ```bash +# create .env file +$ cp .env.copy .env # start all microservices and application(watch mode) $ bash run.sh start +## swagger docs available at /swagger # stop all microservices $ bash run.sh stop From 196e3db08a1476c7c0a7c755949c1b8253927b9d Mon Sep 17 00:00:00 2001 From: radhay Date: Tue, 7 Feb 2023 04:36:08 +0530 Subject: [PATCH 6/6] added types for RequestBody --- src/app.interface.ts | 97 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/app.interface.ts b/src/app.interface.ts index e69de29..2322a10 100644 --- a/src/app.interface.ts +++ b/src/app.interface.ts @@ -0,0 +1,97 @@ +import { ApiProperty } from "@nestjs/swagger" + +export class StringTypeRequestBody { + @ApiProperty({ + description: 'Type of the template', + }) + templateType: TemplateType + @ApiProperty({ + description: 'Input options', + }) + inputType: StringInputType + @ApiProperty({ + description: 'Template to be rendered', + }) + template?: String + @ApiProperty({ + description: 'JWT token if google doc', + }) + token?: String + @ApiProperty({ + description: 'Variables to be replaced in template', + }) + payload?: JSON + outputType: OutputType + deliveryOptions?: DeliveryOptions + storageOptions?: StorageOptions +} + +export enum TemplateType { + ID="ID", + EJS="EJS", + JINJA="JINJA", + JSTL="JSTL", + STATIC="STATIC", +} + +export enum InputType { + STRING="STRING", + FILE="FILE", + URL="URL", +} + +export enum StringInputType { + PDFMAKE="PDFMAKE", + GOOGLEDOC="GOOGLEDOC", + MARKDOWN="MARKDOWN", + MERMAID="MERMAID", + TEMPLATOR="TEMPLATOR" +} + +export enum OutputTypeOptions { + SHORTURL="SHORTURL", + WEBPAGE="WEBPAGE", +} + +export enum OutputType { + png="png", + jpeg="jpeg", + html="html", + pdf="pdf", + qr="qr", +} + +export interface OutputOptions { + type: OutputType, + output: OutputTypeOptions +} + +export enum DeliveryType { + WEBHOOK="WEBHOOK", + EMAIL="EMAIL", +} + +export interface DeliveryTypeOptions { + // TODO +} + +export interface DeliveryOptions { + type: DeliveryType + options: DeliveryTypeOptions +} + +export enum StorageType { + S3="S3", + Minio="Minio", + Dropbox="Dropbox", + GoogleDrive="GoogleDrive" +} + +export interface StorageOptions { + // TODO +} + +export interface StorageOptions { + type: StorageType + options: StorageOptions +} \ No newline at end of file