diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..134bb548fcd26a933ff4c86272c5a276f6cbe450 --- /dev/null +++ b/config.yaml @@ -0,0 +1,5 @@ +version: 3 +endpoint: http://localhost:8765 +metadata_directory: hasura/metadata +migrations_directory: hasura/migrations +seeds_directory: hasura/seeds diff --git a/docker-compose.yml b/docker-compose.yml index 0bce8ce7df41d44dacec8c66ab4e277c586f3067..7f56b7689eb91ed9b79298e4856dc665a4af59a2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,10 +23,10 @@ services: - "${HASURA_LISTEN_PORT}:8080" environment: HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:${DB_PASSWORD}@postgres:5432/postgres - HASURA_GRAPHQL_ENABLE_CONSOLE: "true" - HASURA_GRAPHQL_DEV_MODE: "true" + HASURA_GRAPHQL_ENABLE_CONSOLE: true + HASURA_GRAPHQL_DEV_MODE: true HASURA_GRAPHQL_UNAUTHORIZED_ROLE: public - HASURA_GRAPHQL_ENABLE_TELEMETRY: "false" + HASURA_GRAPHQL_ENABLE_TELEMETRY: false HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_GRAPHQL_ADMIN_SECRET} volumes: # for local developement, you want to record the database migrations in git - ./hasura/migrations:/hasura-migrations diff --git a/hasura/metadata/databases/default/tables/public_profiles.yaml b/hasura/metadata/databases/default/tables/public_profiles.yaml index f94138f5d872f65ba8ad2ae6f088bbcfbc76d7bd..6d0224065750b39a04ce60b3be2311976a242848 100644 --- a/hasura/metadata/databases/default/tables/public_profiles.yaml +++ b/hasura/metadata/databases/default/tables/public_profiles.yaml @@ -1,25 +1,20 @@ table: name: profiles schema: public -computed_fields: - - name: avatar64 - definition: - function: - name: bytea_to_base64 - schema: public - comment: convert avatar from bytea to base64 select_permissions: - role: public permission: columns: - avatar - - address - - geoloc + - city + - data_cid - description - - created_at - - updated_at - computed_fields: - - avatar64 + - geoloc + - index_request_cid + - pubkey + - socials + - time + - title filter: {} limit: 500 comment: "" diff --git a/hasura/migrations/default/1712828885812_squashed/down.sql b/hasura/migrations/default/1712828885812_squashed/down.sql new file mode 100644 index 0000000000000000000000000000000000000000..fb1c3ff5445bfe62a55a512bf13f061a6ce73ea6 --- /dev/null +++ b/hasura/migrations/default/1712828885812_squashed/down.sql @@ -0,0 +1,43 @@ + +comment on column "public"."profiles"."time" is E'timestamp of the index request or C+ document if imported'; + +comment on column "public"."profiles"."index_request_cid" is E'CID of index request'; + +comment on column "public"."profiles"."data_cid" is NULL; + +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."profiles" add column "data_cid" text +-- null; + +comment on column "public"."profiles"."index_request_cid" is NULL; + +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."profiles" add column "index_request_cid" Text +-- not null unique; + +comment on column "public"."profiles"."time" is NULL; +ALTER TABLE "public"."profiles" ALTER COLUMN "time" TYPE timestamp with time zone; + +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."profiles" add column "time" timestamptz +-- not null; + +alter table "public"."profiles" rename column "pubkey" to "address"; +comment on column "public"."profiles"."address" is NULL; + +alter table "public"."profiles" alter column "updated_at" set default CURRENT_TIMESTAMP; +alter table "public"."profiles" alter column "updated_at" drop not null; +alter table "public"."profiles" add column "updated_at" timestamptz; + +alter table "public"."profiles" alter column "created_at" set default CURRENT_TIMESTAMP; +alter table "public"."profiles" alter column "created_at" drop not null; +alter table "public"."profiles" add column "created_at" timestamptz; + + +comment on column "public"."profiles"."title" is NULL; + +comment on column "public"."profiles"."avatar" is NULL; +ALTER TABLE "public"."profiles" ALTER COLUMN "avatar" TYPE bytea; diff --git a/hasura/migrations/default/1712828885812_squashed/up.sql b/hasura/migrations/default/1712828885812_squashed/up.sql new file mode 100644 index 0000000000000000000000000000000000000000..68fc1151d4e10d2e616ff7684d0726aa5c961beb --- /dev/null +++ b/hasura/migrations/default/1712828885812_squashed/up.sql @@ -0,0 +1,33 @@ + + +ALTER TABLE "public"."profiles" ALTER COLUMN "avatar" TYPE text; +comment on column "public"."profiles"."avatar" is E'cid of avatar'; + +comment on column "public"."profiles"."title" is E'title of c+ profile'; + +alter table "public"."profiles" drop column "created_at" cascade; + +alter table "public"."profiles" drop column "updated_at" cascade; + +comment on column "public"."profiles"."address" is E'base58 pubkey of profile owner'; +alter table "public"."profiles" rename column "address" to "pubkey"; + +alter table "public"."profiles" add column "time" timestamptz + not null; + +ALTER TABLE "public"."profiles" ALTER COLUMN "time" TYPE timestamp with time zone; +comment on column "public"."profiles"."time" is E'timestamp of the index request or C+ document if imported'; + +alter table "public"."profiles" add column "index_request_cid" Text + not null unique; + +comment on column "public"."profiles"."index_request_cid" is E'CID of index request'; + +alter table "public"."profiles" add column "data_cid" text + null; + +comment on column "public"."profiles"."data_cid" is E'CID of the latest data from which this document comes from'; + +comment on column "public"."profiles"."index_request_cid" is E'CID of the latest index request that modified this document'; + +comment on column "public"."profiles"."time" is E'timestamp of the latest index request that modified this document'; diff --git a/package.json b/package.json index 0248acbe5df058213a87bbf8d90bd2cdd57151a5..a9ffc515f87d84c7eb75aefced5a5d221116d3e5 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@vue/tsconfig": "^0.5.1", "eslint": "^8.49.0", "eslint-plugin-vue": "^9.17.0", + "hasura-cli": "2.36.1", "ipfs-core-types": "^0.14.1", "npm-run-all2": "^6.1.2", "prettier": "^3.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 380e4afaf08c0dfdad12be594bcb58e5955df0d7..79368bffbca50fc1c7cfef6b38098cb6a2effae2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,6 +91,9 @@ devDependencies: eslint-plugin-vue: specifier: ^9.17.0 version: 9.24.1(eslint@8.57.0) + hasura-cli: + specifier: 2.36.1 + version: 2.36.1 ipfs-core-types: specifier: ^0.14.1 version: 0.14.1 @@ -1840,6 +1843,13 @@ packages: engines: {node: '>=8'} dev: true + /ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + dependencies: + color-convert: 1.9.3 + dev: true + /ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} @@ -1879,6 +1889,14 @@ packages: tslib: 2.6.2 dev: false + /axios@0.21.4: + resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} + dependencies: + follow-redirects: 1.15.6 + transitivePeerDependencies: + - debug + dev: true + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -1942,6 +1960,15 @@ packages: hasBin: true dev: false + /chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + dev: true + /chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -1950,6 +1977,12 @@ packages: supports-color: 7.2.0 dev: true + /color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + dependencies: + color-name: 1.1.3 + dev: true + /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -1957,6 +1990,10 @@ packages: color-name: 1.1.4 dev: true + /color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + dev: true + /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true @@ -2153,6 +2190,11 @@ packages: '@esbuild/win32-x64': 0.20.2 dev: true + /escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + dev: true + /escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} @@ -2378,6 +2420,16 @@ packages: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} dev: true + /follow-redirects@1.15.6: + resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: true + /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true @@ -2452,6 +2504,11 @@ packages: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true + /has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + dev: true + /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -2460,6 +2517,18 @@ packages: /hashlru@2.3.0: resolution: {integrity: sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A==} + /hasura-cli@2.36.1: + resolution: {integrity: sha512-h8MHlkkgjlnmFsjzJ+FYDecIB0zswtdvFszXLPsSsyOuCuIIGejAx3rSPFVIxyiZVXohbsJcgjJBe7r91BV3Wg==} + engines: {node: '>=8'} + hasBin: true + requiresBuild: true + dependencies: + axios: 0.21.4 + chalk: 2.4.2 + transitivePeerDependencies: + - debug + dev: true + /he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true @@ -3446,6 +3515,13 @@ packages: engines: {node: '>=8'} dev: true + /supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + dependencies: + has-flag: 3.0.0 + dev: true + /supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'}