The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Setup first hasura schema
Charles Bochet0445c03b5152
diff --git a/README.md b/README.mdindex 77ca507a5ea..8b3891e26b0 100644--- a/README.md+++ b/README.md@@ -6,6 +6,7 @@ Welcome to Twenty documentation!Twenty development stack is composed of 3 different layers- front: our frontend React app+- hasura: our graphql engine exposing our database and server- server: our backend that contain endpoint, crm logic, scripts, jobs...- storages: postgres@@ -29,7 +30,7 @@ cd infra/dev``````-docker-compose up --build --force-recreate+make build```Once this is completed you should have:@@ -46,23 +47,16 @@ If you are using VSCode, please use the `Dev Containers` extension to open the pIf you are using Docker install, make sure to ssh in the docker container during development to execute commands. You can also use `Makefile` to help you-## Development+## Development workflow-### Tests+### Front tests-#### Unit tests:+Run tests: `make front-test`+Run coverage: `make front-coverage`+Run storybook: `make front-storybook`-```-make front-test-# coverage-make front-coverage-```--#### Storybook:-```-make front-storybook-```--## Developping on server+### Hasura development-Section TBD\ No newline at end of file+Open hasura console: `make hasura-console`+Do your changes in hasura console on http://localhost:9695+Commit your changes in gitdiff --git a/hasura/config.yaml b/hasura/config.yamlnew file mode 100644index 00000000000..6d6bb5c2ac8--- /dev/null+++ b/hasura/config.yaml@@ -0,0 +1,6 @@+version: 3+endpoint: http://localhost:8080+metadata_directory: metadata+actions:+ kind: synchronous+ handler_webhook_baseurl: http://localhost:3000\ No newline at end of filediff --git a/hasura/metadata/actions.graphql b/hasura/metadata/actions.graphqlnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/hasura/metadata/actions.yaml b/hasura/metadata/actions.yamlnew file mode 100644index 00000000000..1edb4c2ffc5--- /dev/null+++ b/hasura/metadata/actions.yaml@@ -0,0 +1,6 @@+actions: []+custom_types:+ enums: []+ input_objects: []+ objects: []+ scalars: []diff --git a/hasura/metadata/allow_list.yaml b/hasura/metadata/allow_list.yamlnew file mode 100644index 00000000000..fe51488c706--- /dev/null+++ b/hasura/metadata/allow_list.yaml@@ -0,0 +1 @@+[]diff --git a/hasura/metadata/api_limits.yaml b/hasura/metadata/api_limits.yamlnew file mode 100644index 00000000000..0967ef424bc--- /dev/null+++ b/hasura/metadata/api_limits.yaml@@ -0,0 +1 @@+{}diff --git a/hasura/metadata/backend_configs.yaml b/hasura/metadata/backend_configs.yamlnew file mode 100644index 00000000000..0967ef424bc--- /dev/null+++ b/hasura/metadata/backend_configs.yaml@@ -0,0 +1 @@+{}diff --git a/hasura/metadata/cron_triggers.yaml b/hasura/metadata/cron_triggers.yamlnew file mode 100644index 00000000000..fe51488c706--- /dev/null+++ b/hasura/metadata/cron_triggers.yaml@@ -0,0 +1 @@+[]diff --git a/hasura/metadata/databases/databases.yaml b/hasura/metadata/databases/databases.yamlnew file mode 100644index 00000000000..52ba870ebd4--- /dev/null+++ b/hasura/metadata/databases/databases.yaml@@ -0,0 +1,9 @@+- name: twenty+ kind: postgres+ configuration:+ connection_info:+ database_url:+ from_env: HASURA_GRAPHQL_PG_DATABASE_URL+ isolation_level: read-committed+ use_prepared_statements: false+ tables: "!include twenty/tables/tables.yaml"diff --git a/hasura/metadata/databases/twenty/tables/public_workspaces.yaml b/hasura/metadata/databases/twenty/tables/public_workspaces.yamlnew file mode 100644index 00000000000..9167a335a9f--- /dev/null+++ b/hasura/metadata/databases/twenty/tables/public_workspaces.yaml@@ -0,0 +1,3 @@+table:+ name: workspaces+ schema: publicdiff --git a/hasura/metadata/databases/twenty/tables/tables.yaml b/hasura/metadata/databases/twenty/tables/tables.yamlnew file mode 100644index 00000000000..64aa5e7137a--- /dev/null+++ b/hasura/metadata/databases/twenty/tables/tables.yaml@@ -0,0 +1 @@+- "!include public_workspaces.yaml"diff --git a/hasura/metadata/graphql_schema_introspection.yaml b/hasura/metadata/graphql_schema_introspection.yamlnew file mode 100644index 00000000000..61a4dcac291--- /dev/null+++ b/hasura/metadata/graphql_schema_introspection.yaml@@ -0,0 +1 @@+disabled_for_roles: []diff --git a/hasura/metadata/inherited_roles.yaml b/hasura/metadata/inherited_roles.yamlnew file mode 100644index 00000000000..fe51488c706--- /dev/null+++ b/hasura/metadata/inherited_roles.yaml@@ -0,0 +1 @@+[]diff --git a/hasura/metadata/metrics_config.yaml b/hasura/metadata/metrics_config.yamlnew file mode 100644index 00000000000..0967ef424bc--- /dev/null+++ b/hasura/metadata/metrics_config.yaml@@ -0,0 +1 @@+{}diff --git a/hasura/metadata/network.yaml b/hasura/metadata/network.yamlnew file mode 100644index 00000000000..0967ef424bc--- /dev/null+++ b/hasura/metadata/network.yaml@@ -0,0 +1 @@+{}diff --git a/hasura/metadata/opentelemetry.yaml b/hasura/metadata/opentelemetry.yamlnew file mode 100644index 00000000000..0967ef424bc--- /dev/null+++ b/hasura/metadata/opentelemetry.yaml@@ -0,0 +1 @@+{}diff --git a/hasura/metadata/query_collections.yaml b/hasura/metadata/query_collections.yamlnew file mode 100644index 00000000000..fe51488c706--- /dev/null+++ b/hasura/metadata/query_collections.yaml@@ -0,0 +1 @@+[]diff --git a/hasura/metadata/remote_schemas.yaml b/hasura/metadata/remote_schemas.yamlnew file mode 100644index 00000000000..fe51488c706--- /dev/null+++ b/hasura/metadata/remote_schemas.yaml@@ -0,0 +1 @@+[]diff --git a/hasura/metadata/rest_endpoints.yaml b/hasura/metadata/rest_endpoints.yamlnew file mode 100644index 00000000000..fe51488c706--- /dev/null+++ b/hasura/metadata/rest_endpoints.yaml@@ -0,0 +1 @@+[]diff --git a/hasura/metadata/version.yaml b/hasura/metadata/version.yamlnew file mode 100644index 00000000000..0a70affa4bd--- /dev/null+++ b/hasura/metadata/version.yaml@@ -0,0 +1 @@+version: 3diff --git a/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/down.sql b/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/down.sqlnew file mode 100644index 00000000000..11d8bd7a7d0--- /dev/null+++ b/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/down.sql@@ -0,0 +1 @@+DROP TABLE "public"."workspaces";diff --git a/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/up.sql b/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/up.sqlnew file mode 100644index 00000000000..508cc4454d8--- /dev/null+++ b/hasura/migrations/twenty/1681407878182_create_table_public_workspaces/up.sql@@ -0,0 +1 @@+CREATE TABLE "public"."workspaces" ("id" serial NOT NULL, "name" Text NOT NULL, "display_name" text NOT NULL, PRIMARY KEY ("id") , UNIQUE ("id"), UNIQUE ("name"));diff --git a/infra/dev/Makefile b/infra/dev/Makefileindex dc2a1ccace2..5568250e023 100644--- a/infra/dev/Makefile+++ b/infra/dev/Makefile@@ -1,17 +1,39 @@+build: ##+ @docker-compose up --build --force-recreate+up: ##@docker-compose up -d-logs: ##- @docker-compose logs twenty -f+down: ##+ @docker-compose down++## Front-sh: ##- @docker-compose exec twenty sh+front-logs: ##+ @docker-compose logs twenty-front -f++front-sh: ##+ @docker-compose exec twenty-front shfront-test: ##- @docker-compose exec twenty sh -c "cd front && npm run test"+ @docker-compose exec twenty-front sh -c "npm run test"front-coverage: ##- @docker-compose exec twenty sh -c "cd front && npm run coverage"+ @docker-compose exec twenty-front sh -c "npm run coverage"front-storybook: ##- @docker-compose exec twenty sh -c "cd front && npm run storybook"+ @docker-compose exec twenty-front sh -c "npm run storybook"++## Hasura++hasura-logs: ##+ @docker-compose logs twenty-hasura -f++hasura-sh: ##+ @docker-compose exec twenty-hasura sh++hasura-console: ##+ @docker-compose exec twenty-hasura bash -c " \+ socat TCP-LISTEN:9695,fork,reuseaddr,bind=twenty-hasura TCP:127.0.0.1:9695 & \+ socat TCP-LISTEN:9693,fork,reuseaddr,bind=twenty-hasura TCP:127.0.0.1:9693 & \+ hasura console --log-level DEBUG --address "127.0.0.1" --no-browser || exit 1"\ No newline at end of filediff --git a/infra/dev/docker-compose.yml b/infra/dev/docker-compose.ymlindex 30201f859ab..77aa1f409c0 100644--- a/infra/dev/docker-compose.yml+++ b/infra/dev/docker-compose.yml@@ -26,7 +26,7 @@ services:environment:HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/hasuraHASURA_GRAPHQL_PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/twenty- HASURA_GRAPHQL_ENABLE_CONSOLE: "true"+ HASURA_GRAPHQL_ENABLE_CONSOLE: "false"HASURA_GRAPHQL_DEV_MODE: "true"HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-logtwenty-server:diff --git a/infra/dev/hasura/Dockerfile b/infra/dev/hasura/Dockerfileindex e5c425416bb..bc86e41b71d 100644--- a/infra/dev/hasura/Dockerfile+++ b/infra/dev/hasura/Dockerfile@@ -6,4 +6,6 @@ RUN apt-get install -y socatRUN apt-get install -y vimRUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash+WORKDIR /hasura+CMD ["sh", "-c", "graphql-engine serve"]diff --git a/infra/prod/hasura/Dockerfile b/infra/prod/hasura/Dockerfilenew file mode 100644index 00000000000..f46285b4154--- /dev/null+++ b/infra/prod/hasura/Dockerfile@@ -0,0 +1,9 @@+FROM hasura/graphql-engine:latest as api++RUN apt-get update+RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash++WORKDIR /app/hasura+COPY ./hasura .++CMD ["sh", "-c", "graphql-engine serve"]