Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mit-27/Panora into feat/cur…
Browse files Browse the repository at this point in the history
…sor-pagination
  • Loading branch information
mit-27 committed Jun 11, 2024
2 parents 729a6fd + 1d40a63 commit a53062a
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 31 deletions.
13 changes: 13 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ services:
- frontend
volumes:
- .:/app

ngrok:
image: ngrok/ngrok:latest
restart: always
command:
- "start"
- "--all"
- "--config"
- "/etc/ngrok.yml"
volumes:
- ./ngrok.yml:/etc/ngrok.yml
ports:
- 4040:4040

docs:
build:
Expand Down
10 changes: 10 additions & 0 deletions ngrok.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
authtoken: YOUR_NGROK_KEY_HERE
log_level: debug
log: stdout

tunnels:
api-tunnel:
proto: http
addr: 3000
domain: your_ngrok_domain_here
30 changes: 30 additions & 0 deletions packages/api/Dockerfile.validate-connectors
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
################################################
# 1/ move to the repo root directory
# 2/ build the image : docker build -t validate_connectors -f ./packages/api/Dockerfile.validate-connectors .
# 3/ run with: docker run -v $(pwd):/app/ -e VERTICAL=vertical -e OBJECT_TYPE=object validate_connectors
# note: use lowercase for object and vertical values
################################################

FROM node:20-alpine AS base
# =======================================================================
FROM base AS builder
RUN apk add --no-cache libc6-compat netcat-openbsd curl
RUN apk update

# Set pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

WORKDIR /app
RUN pnpm add -g [email protected]

# Start Script

# Set environment variable
ENV VERTICAL="$VERTICAL"
ENV OBJECT_TYPE="$OBJECT_TYPE"

WORKDIR /app/packages/api

CMD pnpm install && pnpm run validate-connectors --vertical="${VERTICAL}" --objectType="${OBJECT_TYPE}"
215 changes: 193 additions & 22 deletions packages/api/scripts/init.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- ************************* SqlDBM: PostgreSQL *************************
-- *********** Generated by SqlDBM: Panora_DB by [email protected] **********



Expand Down Expand Up @@ -93,6 +95,7 @@ COMMENT ON CONSTRAINT force_stytch_id_unique ON users IS 'force unique on stytch




-- ************************************** tcg_users

CREATE TABLE tcg_users
Expand Down Expand Up @@ -212,6 +215,91 @@ COMMENT ON COLUMN remote_data."format" IS 'can be json, xml';



-- ************************************** managed_webhooks

CREATE TABLE managed_webhooks
(
id_managed_webhook uuid NOT NULL,
active boolean NOT NULL,
id_connection uuid NOT NULL,
endpoint uuid NOT NULL,
api_version text NULL,
active_events text[] NULL,
remote_signing_secret text NULL,
modified_at timestamp NOT NULL,
created_at timestamp NOT NULL,
CONSTRAINT PK_managed_webhooks PRIMARY KEY ( id_managed_webhook )
);



COMMENT ON COLUMN managed_webhooks.endpoint IS 'UUID that will be used in the final URL to help identify where to route data
ex: api.panora.dev/mw/{managed_webhooks.endpoint}';





-- ************************************** fs_shared_links

CREATE TABLE fs_shared_links
(
id_fs_shared_link uuid NOT NULL,
created_at timestamp NOT NULL,
modified_at timestamp NOT NULL,
CONSTRAINT PK_fs_shared_links PRIMARY KEY ( id_fs_shared_link )
);








-- ************************************** fs_permissions

CREATE TABLE fs_permissions
(
id_fs_permission uuid NOT NULL,
remote_id text NULL,
created_at timestamp NOT NULL,
modified_at timestamp NOT NULL,
"user" uuid NOT NULL,
"group" uuid NOT NULL,
type text[] NOT NULL,
roles text[] NOT NULL,
CONSTRAINT PK_fs_permissions PRIMARY KEY ( id_fs_permission )
);



COMMENT ON COLUMN fs_permissions.roles IS 'read, write, owner';





-- ************************************** fs_drives

CREATE TABLE fs_drives
(
id_fs_drive uuid NOT NULL,
remote_created_at timestamp NULL,
drive_url text NULL,
created_at timestamp NOT NULL,
modified_at timestamp NOT NULL,
remote_id text NULL,
CONSTRAINT PK_fs_drives PRIMARY KEY ( id_fs_drive )
);








-- ************************************** entity

CREATE TABLE entity
Expand Down Expand Up @@ -325,6 +413,31 @@ CREATE TABLE crm_deals_stages



-- ************************************** connector_sets

CREATE TABLE connector_sets
(
id_connector_set uuid NOT NULL,
crm_hubspot boolean NOT NULL,
crm_freshsales boolean NOT NULL,
crm_zoho boolean NOT NULL,
crm_attio boolean NOT NULL,
crm_pipedrive boolean NOT NULL,
tcg_zendesk boolean NOT NULL,
tcg_jira boolean NOT NULL,
tcg_gorgias boolean NOT NULL,
tcg_gitlab boolean NOT NULL,
tcg_front boolean NOT NULL,
CONSTRAINT PK_project_connector PRIMARY KEY ( id_connector_set )
);








-- ************************************** connection_strategies

CREATE TABLE connection_strategies
Expand Down Expand Up @@ -427,16 +540,23 @@ CREATE INDEX FK_tcg_contact_tcg_account_id ON tcg_contacts

CREATE TABLE projects
(
id_project uuid NOT NULL,
name text NOT NULL,
sync_mode text NOT NULL,
pull_frequency bigint NULL,
redirect_url text NULL,
id_user uuid NOT NULL,
id_project uuid NOT NULL,
name text NOT NULL,
sync_mode text NOT NULL,
pull_frequency bigint NULL,
redirect_url text NULL,
id_user uuid NOT NULL,
id_connector_set uuid NOT NULL,
CONSTRAINT PK_projects PRIMARY KEY ( id_project ),
CONSTRAINT FK_project_connectorsetid FOREIGN KEY ( id_connector_set ) REFERENCES connector_sets ( id_connector_set ),
CONSTRAINT FK_46_1 FOREIGN KEY ( id_user ) REFERENCES users ( id_user )
);

CREATE INDEX FK_connectors_sets ON projects
(
id_connector_set
);



COMMENT ON COLUMN projects.sync_mode IS 'can be realtime or periodic_pull';
Expand All @@ -445,27 +565,43 @@ COMMENT ON COLUMN projects.pull_frequency IS 'frequency in seconds for pulls
ex 3600 for one hour';


-- ************************************** project_connectors

CREATE TABLE project_connectors


-- ************************************** fs_folders

CREATE TABLE fs_folders
(
id_fs_folder uuid NOT NULL,
folder_url text NULL,
"size" bigint NULL,
description text NULL,
parent_folder uuid NULL,
remote_id text NULL,
created_at timestamp NOT NULL,
modified_at timestamp NOT NULL,
id_fs_drive uuid NULL,
id_fs_permission uuid NOT NULL,
CONSTRAINT PK_fs_folders PRIMARY KEY ( id_fs_folder )
);

CREATE INDEX FK_fs_folder_driveID ON fs_folders
(
id_fs_drive
);

CREATE INDEX FK_fs_folder_permissionID ON fs_folders
(
id_project_connector uuid NOT NULL,
id_project uuid NOT NULL,
crm_hubspot boolean NOT NULL,
crm_zoho boolean NOT NULL,
crm_zendesk boolean NOT NULL,
crm_pipedrive boolean NOT NULL,
crm_attio boolean NOT NULL,
tcg_zendesk boolean NOT NULL,
tcg_gorgias boolean NOT NULL,
tcg_front boolean NOT NULL,
tcg_jira boolean NOT NULL,
tcg_gitlab boolean NOT NULL,
CONSTRAINT PK_project_connectors PRIMARY KEY ( id_project_connector ),
CONSTRAINT FK_project_connectors FOREIGN KEY ( id_project ) REFERENCES projects ( id_project )
id_fs_permission
);








-- ************************************** crm_contacts

CREATE TABLE crm_contacts
Expand Down Expand Up @@ -709,6 +845,41 @@ COMMENT ON COLUMN linked_users.alias IS 'human-readable alias, for UI (ex ACME c



-- ************************************** fs_files

CREATE TABLE fs_files
(
id_fs_file uuid NOT NULL,
name text NULL,
type text NULL,
"path" text NULL,
mime_type text NULL,
"size" bigint NULL,
remote_id text NULL,
id_fs_folder uuid NULL,
created_at timestamp NOT NULL,
modified_at timestamp NOT NULL,
id_fs_permission uuid NOT NULL,
CONSTRAINT PK_fs_files PRIMARY KEY ( id_fs_file )
);

CREATE INDEX FK_fs_file_FolderID ON fs_files
(
id_fs_folder
);

CREATE INDEX FK_fs_file_permissionID ON fs_files
(
id_fs_permission
);








-- ************************************** crm_phone_numbers

CREATE TABLE crm_phone_numbers
Expand Down
19 changes: 10 additions & 9 deletions packages/api/scripts/seed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
INSERT INTO users (id_user, identification_strategy, email, password_hash, first_name, last_name) VALUES
('0ce39030-2901-4c56-8db0-5e326182ec6b', 'b2c','[email protected]', '$2b$10$Y7Q8TWGyGuc5ecdIASbBsuXMo3q/Rs3/cnY.mLZP4tUgfGUOCUBlG', 'local', 'Panora');

-- First, insert connector sets
INSERT INTO connector_sets (id_connector_set, crm_hubspot, crm_freshsales, crm_zoho, crm_pipedrive, crm_attio, tcg_zendesk, tcg_gorgias, tcg_front, tcg_jira, tcg_gitlab) VALUES
('1709da40-17f7-4d3a-93a0-96dc5da6ddd7', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE),
('852dfff8-ab63-4530-ae49-e4b2924407f8', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE),
('aed0f856-f802-4a79-8640-66d441581a99', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);

INSERT INTO projects (id_project, name, sync_mode, id_user) VALUES
('1e468c15-aa57-4448-aa2b-7fed640d1e3d', 'Project 1', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b'),
('4c641a21-a7f8-4ffe-b7e8-e7d32db87557', 'Project 2', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b'),
('2b198012-c79c-4bb6-971e-9635830e8c15', 'Project 3', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b');

INSERT INTO project_connectors (id_project_connector,id_project,crm_hubspot,crm_zoho,crm_zendesk,crm_pipedrive,crm_attio,tcg_zendesk,tcg_gorgias,tcg_front,tcg_jira,tcg_gitlab) VALUES
('1709da40-17f7-4d3a-93a0-96dc5da6ddd7','1e468c15-aa57-4448-aa2b-7fed640d1e3d',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE),
('852dfff8-ab63-4530-ae49-e4b2924407f8','4c641a21-a7f8-4ffe-b7e8-e7d32db87557',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE),
('aed0f856-f802-4a79-8640-66d441581a99','2b198012-c79c-4bb6-971e-9635830e8c15',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE);
-- Then, insert projects with a reference to the connector sets
INSERT INTO projects (id_project, name, sync_mode, id_user, id_connector_set) VALUES
('1e468c15-aa57-4448-aa2b-7fed640d1e3d', 'Project 1', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', '1709da40-17f7-4d3a-93a0-96dc5da6ddd7'),
('4c641a21-a7f8-4ffe-b7e8-e7d32db87557', 'Project 2', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', '852dfff8-ab63-4530-ae49-e4b2924407f8'),
('2b198012-c79c-4bb6-971e-9635830e8c15', 'Project 3', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', 'aed0f856-f802-4a79-8640-66d441581a99');

-- DO $$
-- DECLARE
Expand Down

0 comments on commit a53062a

Please sign in to comment.