diff --git a/README.md b/README.md index 8372941..4beaad5 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,29 @@

- 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) -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. +## About :open_book: -## Installation +An easy tool for generating single and bulk documents in several supported formats from templates. +## Dev Setup ```bash -$ yarn install -``` +# create .env file +$ cp .env.copy .env -## Running the app +# start all microservices and application(watch mode) +$ bash run.sh start +## swagger docs available at /swagger -```bash -# development -$ yarn run start +# stop all microservices +$ bash run.sh stop -# watch mode -$ yarn run start:dev - -# production mode -$ yarn run start:prod +# help +$ bash run.sh --help ``` ## Test @@ -57,17 +38,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). 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/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? -} 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 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