Skip to content

Commit

Permalink
Merge pull request #127 from poozlehq/123/notion
Browse files Browse the repository at this point in the history
Notion
  • Loading branch information
saimanoj authored Jul 9, 2023
2 parents 973127a + 492ff60 commit 1f3e7bb
Show file tree
Hide file tree
Showing 53 changed files with 4,772 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ENGINE_VERSION=0.1.4-alpha
ENGINE_VERSION=0.1.5-alpha

# POSTGRES
POSTGRES_USER=docker
Expand Down Expand Up @@ -26,7 +26,7 @@ JWT_ACCESS_SECRET=nestjsPrismaAccessSecret
JWT_REFRESH_SECRET=nestjsPrismaRefreshSecret

FRONTEND_HOST=http://localhost:8000
PUBLIC_FRONTEND_HOST=https://app.poozle.dev
PUBLIC_FRONTEND_HOST=http://localhost:8000
BACKEND_HOST=http://localhost:3000
BACKEND_URL=http://server:3000

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
db:
image: "postgres:latest"
image: "postgres:14-bullseye"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
Expand Down
2 changes: 1 addition & 1 deletion engine-idk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poozle/engine-idk",
"version": "0.1.9",
"version": "0.1.11",
"description": "Used to develop integrations for Poozle",
"license": "MIT",
"author": "Poozle <support@poozle.in>",
Expand Down
95 changes: 95 additions & 0 deletions engine-idk/src/common_models/docs/block.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/** Copyright (c) 2023, Poozle, all rights reserved. **/

export const BlockSchema = {
type: 'object',
properties: {
id: {
type: 'string',
default: '',
},
parent_id: {
type: 'string',
default: '',
},
block_type: {
type: 'string',
default: '',
},
content: {
type: 'array',
default: [],
items: [
{
annotations: {
type: 'array',
default: [],
items: [
{
properties: {
bold: {
type: 'string',
default: '',
},
italic: {
type: 'string',
default: '',
},
strikethrough: {
type: 'string',
default: '',
},
underline: {
type: 'string',
default: '',
},
code: {
type: 'string',
default: '',
},
type: {
type: 'string',
default: '',
},
},
required: ['block_type'],
},
],
},
plain_text: {
type: 'string',
default: '',
},
href: {
type: 'string',
default: '',
},
},
],
},
children: {
type: 'array',
default: [],
},
},
};

export interface Content {
annotations: {
bold: string;
italic: string;
strikethrough: string;
underline: string;
code: string;
color: string;
};
plain_text: string;
href: string;
}

export interface Block {
id: string;
parent_id: string;
block_type: string;
content: Content[];
children: Block[];
}
4 changes: 4 additions & 0 deletions engine-idk/src/common_models/docs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** Copyright (c) 2023, Poozle, all rights reserved. **/

export * from './page';
export * from './block';
46 changes: 46 additions & 0 deletions engine-idk/src/common_models/docs/page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/** Copyright (c) 2023, Poozle, all rights reserved. **/

export const PageSchema = {
type: 'object',
properties: {
id: {
type: 'string',
default: '',
},
parent_id: {
type: 'string',
default: '',
},
created_by: {
type: 'string',
default: '',
},
title: {
type: 'string',
default: '',
},
created_at: {
type: 'string',
default: '',
},
updated_at: {
type: 'string',
default: '',
},
},
};

export interface Page {
id: string;
parent_id: string;
title: string;
created_by: string;
created_at: string;
updated_at: string;
updated_by: string;
}

export interface CreatePage {
parent_id: string;
title: string;
}
1 change: 1 addition & 0 deletions engine-idk/src/common_models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

export * from './ticketing';
export * from './mail';
export * from './docs';
4 changes: 2 additions & 2 deletions engine-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine AS builder
FROM node:18-alpine AS builder

# Create app directory
WORKDIR /app
Expand All @@ -15,7 +15,7 @@ COPY . .

RUN npm run build

FROM node:16-alpine
FROM node:18-alpine

COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
Expand Down
7 changes: 3 additions & 4 deletions engine-server/prisma/dbml/schema.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@ Table IntegrationAccount {
updatedAt DateTime [not null]
fromLinks Link
linkId String

indexes {
(integrationAccountName, workspaceId) [unique]
}
}

Table Link {
linkId String [pk]
linkName String [not null]
linkIdentifier String [not null]
expiresIn Int [not null, default: 3600]
category IntegrationType[] [not null]
integrationDefinitionId String
workspace Workspace [not null]
workspaceId String [not null]
createdAt DateTime [default: `now()`, not null]
Expand All @@ -113,6 +111,7 @@ Enum IntegrationType {
CALENDAR
TICKETING
MAIL
DOCS
}

Ref: Workspace.userId > User.userId
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "IntegrationType" ADD VALUE 'DOCS';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:
- Added the required column `linkIdentifier` to the `Link` table without a default value. This is not possible if the table is not empty.
*/
-- DropIndex
DROP INDEX "IntegrationAccount_integrationAccountName_workspaceId_key";

-- AlterTable
ALTER TABLE "Link" ADD COLUMN "integrationDefinitionId" TEXT,
ADD COLUMN "linkIdentifier" TEXT NOT NULL;
18 changes: 11 additions & 7 deletions engine-server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,19 @@ model IntegrationAccount {
updatedAt DateTime @updatedAt
fromLinks Link? @relation(fields: [linkId], references: [linkId])
linkId String?
@@unique([integrationAccountName, workspaceId])
}

model Link {
linkId String @id @default(uuid())
linkName String
expiresIn Int @default(3600)
category IntegrationType[]
workspace Workspace @relation(references: [workspaceId], fields: [workspaceId])
linkId String @id @default(uuid())
linkName String
linkIdentifier String
expiresIn Int @default(3600)
category IntegrationType[]
integrationDefinitionId String?
workspace Workspace @relation(references: [workspaceId], fields: [workspaceId])
workspaceId String
createdAt DateTime @default(now())
Expand All @@ -133,4 +136,5 @@ enum IntegrationType {
CALENDAR
TICKETING
MAIL
DOCS
}
3 changes: 0 additions & 3 deletions engine-server/prisma/seeds/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { PrismaClient } from '@prisma/client';
import axios from 'axios';
import * as readline from 'readline-sync';

// Uncomment this when you are testing in local
// import * as promptSync from 'prompt-sync';

const prisma = new PrismaClient();

// eslint-disable-next-line prefer-const
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@

import {ReleaseStage,IntegrationType} from '@prisma/client'
import {Workspace} from '../../workspace/entities/workspace.entity'
import {IntegrationAccount} from '../../integrationAccount/entities/integrationAccount.entity'
import {IntegrationOAuthApp} from '../../integrationOAuthApp/entities/integrationOAuthApp.entity'

import { ReleaseStage, IntegrationType } from '@prisma/client';
import { Workspace } from '../../workspace/entities/workspace.entity';
import { IntegrationAccount } from '../../integrationAccount/entities/integrationAccount.entity';
import { IntegrationOAuthApp } from '../../integrationOAuthApp/entities/integrationOAuthApp.entity';

export class IntegrationDefinition {
integrationDefinitionId: string ;
name: string ;
key: string ;
icon: string | null;
version: string ;
releaseStage: ReleaseStage ;
sourceUrl: string ;
integrationType: IntegrationType ;
workspace?: Workspace | null;
workspaceId: string | null;
IntegrationAccount?: IntegrationAccount[] ;
IntegrationOAuthApp?: IntegrationOAuthApp[] ;
deleted: Date | null;
createdAt: Date ;
updatedAt: Date ;
integrationDefinitionId: string;
name: string;
key: string;
icon: string | null;
version: string;
releaseStage: ReleaseStage;
sourceUrl: string;
integrationType: IntegrationType;
workspace?: Workspace | null;
workspaceId: string | null;
IntegrationAccount?: IntegrationAccount[];
IntegrationOAuthApp?: IntegrationOAuthApp[];
deleted: Date | null;
createdAt: Date;
updatedAt: Date;
}
2 changes: 2 additions & 0 deletions engine-server/src/modules/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { loggingMiddleware } from 'common/middleware/logging.middleware';
import { AnalyticsModule } from 'modules/analytics/analytics.module';
import { AuthModule } from 'modules/auth/auth.module';
import { MailModule } from 'modules/categories/mail/mail.module';
import { DocsModule } from 'modules/categories/docs/docs.module';
import { TicketingModule } from 'modules/categories/ticketing/ticketing.module';
import { IntegrationAccountModule } from 'modules/integration_account/integration_account.module';
import { IntegrationDefinitionModule } from 'modules/integration_definition/integration_definition.module';
Expand Down Expand Up @@ -43,6 +44,7 @@ import { AppService } from './app.service';
// Categories and their modules
TicketingModule,
MailModule,
DocsModule,
],
controllers: [AppController],
providers: [AppService],
Expand Down
18 changes: 18 additions & 0 deletions engine-server/src/modules/categories/docs/docs.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** Copyright (c) 2022, Poozle, all rights reserved. **/

import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { PrismaModule, PrismaService } from 'nestjs-prisma';

import { IntegrationAccountModule } from 'modules/integration_account/integration_account.module';

import { BlockController } from './models/block/block.controller';
import { PageController } from './models/page/page.controller';

@Module({
imports: [PrismaModule, HttpModule, IntegrationAccountModule],
controllers: [PageController, BlockController],
providers: [PrismaService],
exports: [],
})
export class DocsModule {}
Loading

0 comments on commit 1f3e7bb

Please sign in to comment.