Compare commits
94 Commits
@nhost/str
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61ee739f88 | ||
|
|
65b7995dda | ||
|
|
30b23eb7a2 | ||
|
|
4e083bcf25 | ||
|
|
6b9d163e82 | ||
|
|
35a6dc6d89 | ||
|
|
c80f4a28f8 | ||
|
|
c03f8d996a | ||
|
|
7f3472963f | ||
|
|
e283ed1884 | ||
|
|
93ad06fcc3 | ||
|
|
d6a229926b | ||
|
|
182d29bc2c | ||
|
|
becde75341 | ||
|
|
b01ba90243 | ||
|
|
1f47c0df4a | ||
|
|
dfbdd340a7 | ||
|
|
3448edb178 | ||
|
|
1c0b9c642a | ||
|
|
62d2eb8c99 | ||
|
|
dc6348df04 | ||
|
|
ac3bdb6ef1 | ||
|
|
e8c095fedc | ||
|
|
d524597557 | ||
|
|
43fb4ada76 | ||
|
|
e44d6af56c | ||
|
|
3a937cae48 | ||
|
|
a60ea128be | ||
|
|
76c9a124c8 | ||
|
|
de558a0150 | ||
|
|
0cacd9f3d2 | ||
|
|
aa7338fcdf | ||
|
|
6da44bf801 | ||
|
|
44cbdf9a68 | ||
|
|
632c1da775 | ||
|
|
bd88ea0912 | ||
|
|
cf38b3d82b | ||
|
|
945adb253d | ||
|
|
afb8a199eb | ||
|
|
6c32e3a3bc | ||
|
|
bd5a6608e9 | ||
|
|
f4eee4b885 | ||
|
|
11a5d1ce71 | ||
|
|
4d8055a4e7 | ||
|
|
be10b474da | ||
|
|
a2d77dad08 | ||
|
|
b4acc44df6 | ||
|
|
19f5ffc5b8 | ||
|
|
42dde0b573 | ||
|
|
4ecd311578 | ||
|
|
1fa1f8080c | ||
|
|
d6be615fc5 | ||
|
|
25f0cb7144 | ||
|
|
ba785da116 | ||
|
|
4402844543 | ||
|
|
f03c458a05 | ||
|
|
2c28cd33be | ||
|
|
ac65fb9dd4 | ||
|
|
3ced63abaa | ||
|
|
12fb5847fb | ||
|
|
ee9ab3f1ef | ||
|
|
d4c2b9870c | ||
|
|
389319582f | ||
|
|
c2f9dcbbbd | ||
|
|
69e701a742 | ||
|
|
25db4fa5dc | ||
|
|
3c70860afa | ||
|
|
0f43b942af | ||
|
|
0ea60a643f | ||
|
|
13c41fe667 | ||
|
|
99bbdc37f9 | ||
|
|
ac214019dc | ||
|
|
06523f2619 | ||
|
|
f9f05b4cd7 | ||
|
|
242a2a97ef | ||
|
|
62a8a968ec | ||
|
|
8d3c83015c | ||
|
|
f783a2d956 | ||
|
|
a8ea4e273e | ||
|
|
4238a6985c | ||
|
|
494b230868 | ||
|
|
7eb7a337ac | ||
|
|
472dcf2b9c | ||
|
|
ac02b38bed | ||
|
|
37e06e1cf7 | ||
|
|
bb2b1f5078 | ||
|
|
1205a89029 | ||
|
|
d498d5d029 | ||
|
|
182dfb0b22 | ||
|
|
3fd9e4601d | ||
|
|
cd7d6ddf11 | ||
|
|
301d9f1710 | ||
|
|
46d54b9f77 | ||
|
|
31671aa7b9 |
10
.github/actions/install-dependencies/action.yaml
vendored
10
.github/actions/install-dependencies/action.yaml
vendored
@@ -3,9 +3,10 @@ description: 'Install Node dependencies with pnpm'
|
|||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v2.2.1
|
- uses: pnpm/action-setup@v2.2.3
|
||||||
with:
|
with:
|
||||||
version: 6.32.14
|
version: 7.9.1
|
||||||
|
run_install: false
|
||||||
- name: Use Node.js 16
|
- name: Use Node.js 16
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
@@ -15,3 +16,8 @@ runs:
|
|||||||
- shell: bash
|
- shell: bash
|
||||||
name: Install packages
|
name: Install packages
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
# * Build all Nhost packages as they are all supposed to be tested.
|
||||||
|
# * They are reused through the Turborepo cache
|
||||||
|
- shell: bash
|
||||||
|
name: Build packages
|
||||||
|
run: pnpm build
|
||||||
|
|||||||
17
.github/workflows/changesets.yaml
vendored
17
.github/workflows/changesets.yaml
vendored
@@ -21,20 +21,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2.1.0
|
# * Install Node and dependencies
|
||||||
with:
|
- name: Install Node and dependencies
|
||||||
version: 6.32.3
|
uses: ./.github/actions/install-dependencies
|
||||||
# run_install: true
|
|
||||||
- name: Use Node.js 17
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: '17.8.0'
|
|
||||||
cache: 'pnpm'
|
|
||||||
- name: Pick the right npm version
|
|
||||||
# * See: https://github.com/pnpm/pnpm/issues/4348
|
|
||||||
run: npm install --global npm@8.4
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
- name: Create PR or Publish release
|
- name: Create PR or Publish release
|
||||||
id: changesets
|
id: changesets
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
|
|||||||
9
.github/workflows/tests.yaml
vendored
9
.github/workflows/tests.yaml
vendored
@@ -29,10 +29,6 @@ jobs:
|
|||||||
# * Install Node and dependencies. Package downloads will be cached for the next jobs.
|
# * Install Node and dependencies. Package downloads will be cached for the next jobs.
|
||||||
- name: Install Node and dependencies
|
- name: Install Node and dependencies
|
||||||
uses: ./.github/actions/install-dependencies
|
uses: ./.github/actions/install-dependencies
|
||||||
# * Build all Nhost packages as they are all supposed to be tested.
|
|
||||||
# * They will be reused through the Turborepo cache
|
|
||||||
- name: Build packages
|
|
||||||
run: pnpm build
|
|
||||||
# * List packagesthat has an `e2e` script, except the root, and return an array of their name and path
|
# * List packagesthat has an `e2e` script, except the root, and return an array of their name and path
|
||||||
- name: List examples with an e2e script
|
- name: List examples with an e2e script
|
||||||
id: set-matrix
|
id: set-matrix
|
||||||
@@ -62,9 +58,12 @@ jobs:
|
|||||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||||
- name: Install Node and dependencies
|
- name: Install Node and dependencies
|
||||||
uses: ./.github/actions/install-dependencies
|
uses: ./.github/actions/install-dependencies
|
||||||
|
# TODO ugly - check CYPRESS_CACHE_FOLDER
|
||||||
|
- name: Install Cypress
|
||||||
|
run: pnpm install -w cypress
|
||||||
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
||||||
- name: Run e2e test
|
- name: Run e2e test
|
||||||
run: pnpm run e2e -- --filter="${{ matrix.package.name }}"
|
run: pnpm --filter="${{ matrix.package.name }}" run e2e
|
||||||
- id: file-name
|
- id: file-name
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
name: Tranform package name into a valid file name
|
name: Tranform package name into a valid file name
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,7 +12,6 @@ logs/
|
|||||||
.idea/
|
.idea/
|
||||||
.npm/
|
.npm/
|
||||||
.vagrant/
|
.vagrant/
|
||||||
/.vscode/
|
|
||||||
.eslintcache
|
.eslintcache
|
||||||
.yarnclean
|
.yarnclean
|
||||||
|
|
||||||
|
|||||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.organizeImports": true
|
||||||
|
}
|
||||||
|
}
|
||||||
55
README.md
55
README.md
@@ -204,21 +204,28 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Pratim</b></sub>
|
<sub><b>Pratim</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/chrtze">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/3797215?v=4" width="100;" alt="chrtze"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Christopher Möller</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/GavanWilhite">
|
<a href="https://github.com/GavanWilhite">
|
||||||
<img src="https://avatars.githubusercontent.com/u/2085119?v=4" width="100;" alt="GavanWilhite"/>
|
<img src="https://avatars.githubusercontent.com/u/2085119?v=4" width="100;" alt="GavanWilhite"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Gavan Wilhite</b></sub>
|
<sub><b>Gavan Wilhite</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/FuzzyReason">
|
<a href="https://github.com/FuzzyReason">
|
||||||
<img src="https://avatars.githubusercontent.com/u/62517920?v=4" width="100;" alt="FuzzyReason"/>
|
<img src="https://avatars.githubusercontent.com/u/62517920?v=4" width="100;" alt="FuzzyReason"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Vadim Smirnov</b></sub>
|
<sub><b>Vadim Smirnov</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/ejkkan">
|
<a href="https://github.com/ejkkan">
|
||||||
<img src="https://avatars.githubusercontent.com/u/32518962?v=4" width="100;" alt="ejkkan"/>
|
<img src="https://avatars.githubusercontent.com/u/32518962?v=4" width="100;" alt="ejkkan"/>
|
||||||
@@ -247,13 +254,6 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Christian Gambardella</b></sub>
|
<sub><b>Christian Gambardella</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
|
||||||
<a href="https://github.com/chrtze">
|
|
||||||
<img src="https://avatars.githubusercontent.com/u/3797215?v=4" width="100;" alt="chrtze"/>
|
|
||||||
<br />
|
|
||||||
<sub><b>Christopher Möller</b></sub>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/dbarrosop">
|
<a href="https://github.com/dbarrosop">
|
||||||
<img src="https://avatars.githubusercontent.com/u/6246622?v=4" width="100;" alt="dbarrosop"/>
|
<img src="https://avatars.githubusercontent.com/u/6246622?v=4" width="100;" alt="dbarrosop"/>
|
||||||
@@ -305,6 +305,13 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/piromsurang">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/17776837?v=4" width="100;" alt="piromsurang"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Piromsurang Rungserichai</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/Savinvadim1312">
|
<a href="https://github.com/Savinvadim1312">
|
||||||
<img src="https://avatars.githubusercontent.com/u/16936043?v=4" width="100;" alt="Savinvadim1312"/>
|
<img src="https://avatars.githubusercontent.com/u/16936043?v=4" width="100;" alt="Savinvadim1312"/>
|
||||||
@@ -339,15 +346,15 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Anders Kjær Damgaard</b></sub>
|
<sub><b>Anders Kjær Damgaard</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/Sonichigo">
|
<a href="https://github.com/Sonichigo">
|
||||||
<img src="https://avatars.githubusercontent.com/u/53110238?v=4" width="100;" alt="Sonichigo"/>
|
<img src="https://avatars.githubusercontent.com/u/53110238?v=4" width="100;" alt="Sonichigo"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Animesh Pathak</b></sub>
|
<sub><b>Animesh Pathak</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/rustyb">
|
<a href="https://github.com/rustyb">
|
||||||
<img src="https://avatars.githubusercontent.com/u/53086?v=4" width="100;" alt="rustyb"/>
|
<img src="https://avatars.githubusercontent.com/u/53086?v=4" width="100;" alt="rustyb"/>
|
||||||
@@ -355,6 +362,13 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<sub><b>Colin Broderick</b></sub>
|
<sub><b>Colin Broderick</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/d4g0">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/34744883?v=4" width="100;" alt="d4g0"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Dago</b></sub>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/dminkovsky">
|
<a href="https://github.com/dminkovsky">
|
||||||
<img src="https://avatars.githubusercontent.com/u/218725?v=4" width="100;" alt="dminkovsky"/>
|
<img src="https://avatars.githubusercontent.com/u/218725?v=4" width="100;" alt="dminkovsky"/>
|
||||||
@@ -375,7 +389,8 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Gaurav Agrawal</b></sub>
|
<sub><b>Gaurav Agrawal</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/alveshelio">
|
<a href="https://github.com/alveshelio">
|
||||||
<img src="https://avatars.githubusercontent.com/u/8176422?v=4" width="100;" alt="alveshelio"/>
|
<img src="https://avatars.githubusercontent.com/u/8176422?v=4" width="100;" alt="alveshelio"/>
|
||||||
@@ -389,8 +404,7 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Hoang Do</b></sub>
|
<sub><b>Hoang Do</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/eltociear">
|
<a href="https://github.com/eltociear">
|
||||||
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100;" alt="eltociear"/>
|
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100;" alt="eltociear"/>
|
||||||
@@ -418,7 +432,8 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Lucas Bois</b></sub>
|
<sub><b>Lucas Bois</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/MarcelloTheArcane">
|
<a href="https://github.com/MarcelloTheArcane">
|
||||||
<img src="https://avatars.githubusercontent.com/u/21159570?v=4" width="100;" alt="MarcelloTheArcane"/>
|
<img src="https://avatars.githubusercontent.com/u/21159570?v=4" width="100;" alt="MarcelloTheArcane"/>
|
||||||
@@ -432,8 +447,7 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Nacho Aldama</b></sub>
|
<sub><b>Nacho Aldama</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/ghoshnirmalya">
|
<a href="https://github.com/ghoshnirmalya">
|
||||||
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
|
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
|
||||||
@@ -461,7 +475,8 @@ Here are some ways of contributing to making Nhost better:
|
|||||||
<br />
|
<br />
|
||||||
<sub><b>Tapas Adhikary</b></sub>
|
<sub><b>Tapas Adhikary</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/uulwake">
|
<a href="https://github.com/uulwake">
|
||||||
<img src="https://avatars.githubusercontent.com/u/22399181?v=4" width="100;" alt="uulwake"/>
|
<img src="https://avatars.githubusercontent.com/u/22399181?v=4" width="100;" alt="uulwake"/>
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/docs
|
# @nhost/docs
|
||||||
|
|
||||||
|
## 0.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- ba785da1: Bump dependencies versions
|
||||||
|
|
||||||
## 0.0.3
|
## 0.0.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ auth:
|
|||||||
|
|
||||||
Your custom claim will be automatically prefixed with `x-hasura-`, therefore, the example above results in a custom permission variable named `x-hasura-organisation-id`.
|
Your custom claim will be automatically prefixed with `x-hasura-`, therefore, the example above results in a custom permission variable named `x-hasura-organisation-id`.
|
||||||
|
|
||||||
|
### Limitation on JSON/JSONB columns
|
||||||
|
|
||||||
|
JSON columns cannot be used in custom claims, with the exception of the `users.metadata` column.
|
||||||
|
|
||||||
## Roles
|
## Roles
|
||||||
|
|
||||||
Every GraphQL request is resolved based on a **single role**. Roles are added in the Hasura Console when selecting a table and clicking **Permisisons**.
|
Every GraphQL request is resolved based on a **single role**. Roles are added in the Hasura Console when selecting a table and clicking **Permisisons**.
|
||||||
|
|||||||
@@ -95,12 +95,16 @@ Serverless functions are billed per GB-sec or GB-hour. 1 GB-hour is 3600 GB-seco
|
|||||||
|
|
||||||
1 GB-sec is 1 function with 1 GB of RAM running for 1 second. If 1 function with 1 GB of RAM runs for 3600 seconds, that's the equivalent of 1 GB-hour.
|
1 GB-sec is 1 function with 1 GB of RAM running for 1 second. If 1 function with 1 GB of RAM runs for 3600 seconds, that's the equivalent of 1 GB-hour.
|
||||||
|
|
||||||
All serverless functions in production are running with 128 MB of RAM.
|
All serverless functions in production are running with 1 GB of RAM.
|
||||||
|
|
||||||
## Node Version
|
## Node Version
|
||||||
|
|
||||||
All serverless functions in production are running Node.js version 14.x.
|
All serverless functions in production are running Node.js version 16.x.
|
||||||
|
|
||||||
## Regions
|
## Regions
|
||||||
|
|
||||||
Serverless Functions are always deployed to the same region as your project.
|
Serverless Functions are always deployed to the same region as your project.
|
||||||
|
|
||||||
|
## Local Debugging
|
||||||
|
|
||||||
|
To see the output of `console.log` in your terminal, you can use `nhost logs -f functions`.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: signUp()
|
|||||||
sidebar_label: signUp()
|
sidebar_label: signUp()
|
||||||
slug: /reference/javascript/auth/sign-up
|
slug: /reference/javascript/auth/sign-up
|
||||||
description: Use `nhost.auth.signUp` to sign up a user using email and password. If you want to sign up a user using passwordless email (Magic Link), SMS, or an OAuth provider, use the `signIn` function instead.
|
description: Use `nhost.auth.signUp` to sign up a user using email and password. If you want to sign up a user using passwordless email (Magic Link), SMS, or an OAuth provider, use the `signIn` function instead.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L107
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L108
|
||||||
---
|
---
|
||||||
|
|
||||||
# `signUp()`
|
# `signUp()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: signIn()
|
|||||||
sidebar_label: signIn()
|
sidebar_label: signIn()
|
||||||
slug: /reference/javascript/auth/sign-in
|
slug: /reference/javascript/auth/sign-in
|
||||||
description: Use `nhost.auth.signIn` to sign in a user using email and password, passwordless (email or sms) or an external provider. `signIn` can be used to sign in a user in various ways depending on the parameters.
|
description: Use `nhost.auth.signIn` to sign in a user using email and password, passwordless (email or sms) or an external provider. `signIn` can be used to sign in a user in various ways depending on the parameters.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L156
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L170
|
||||||
---
|
---
|
||||||
|
|
||||||
# `signIn()`
|
# `signIn()`
|
||||||
@@ -22,7 +22,7 @@ nhost.auth.signIn({
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`SignInParams`](/reference/docgen/javascript/auth/types/sign-in-params)
|
**<span className="parameter-name">params</span>** <span className="optional-status">optional</span> [`SignInParams`](/reference/docgen/javascript/auth/types/sign-in-params)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -58,3 +58,16 @@ nhost.auth.signIn({ phoneNumber: '+11233213123' })
|
|||||||
// [step 2/2] Finish passwordless sign in using SMS (OTP)
|
// [step 2/2] Finish passwordless sign in using SMS (OTP)
|
||||||
nhost.auth.signIn({ phoneNumber: '+11233213123', otp: '123456' })
|
nhost.auth.signIn({ phoneNumber: '+11233213123', otp: '123456' })
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Sign in anonymously
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Sign in anonymously
|
||||||
|
nhost.auth.signIn()
|
||||||
|
|
||||||
|
// Later in the application, the user can complete their registration
|
||||||
|
nhost.auth.signUp({
|
||||||
|
email: 'joe@example.com',
|
||||||
|
password: 'secret-password'
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: signOut()
|
|||||||
sidebar_label: signOut()
|
sidebar_label: signOut()
|
||||||
slug: /reference/javascript/auth/sign-out
|
slug: /reference/javascript/auth/sign-out
|
||||||
description: Use `nhost.auth.signOut` to sign out the user.
|
description: Use `nhost.auth.signOut` to sign out the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L252
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L270
|
||||||
---
|
---
|
||||||
|
|
||||||
# `signOut()`
|
# `signOut()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: resetPassword()
|
|||||||
sidebar_label: resetPassword()
|
sidebar_label: resetPassword()
|
||||||
slug: /reference/javascript/auth/reset-password
|
slug: /reference/javascript/auth/reset-password
|
||||||
description: Use `nhost.auth.resetPassword` to reset the password for a user. This will send a reset-password link in an email to the user. When the user clicks the reset-password link the user is automatically signed-in. Once signed-in, the user can change their password using `nhost.auth.changePassword()`.
|
description: Use `nhost.auth.resetPassword` to reset the password for a user. This will send a reset-password link in an email to the user. When the user clicks the reset-password link the user is automatically signed-in. Once signed-in, the user can change their password using `nhost.auth.changePassword()`.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L268
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L286
|
||||||
---
|
---
|
||||||
|
|
||||||
# `resetPassword()`
|
# `resetPassword()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: changePassword()
|
|||||||
sidebar_label: changePassword()
|
sidebar_label: changePassword()
|
||||||
slug: /reference/javascript/auth/change-password
|
slug: /reference/javascript/auth/change-password
|
||||||
description: Use `nhost.auth.changePassword` to change the password for the signed-in user. The old password is not needed. In case the user is not signed-in, a password reset ticket needs to be provided.
|
description: Use `nhost.auth.changePassword` to change the password for the signed-in user. The old password is not needed. In case the user is not signed-in, a password reset ticket needs to be provided.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L284
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L302
|
||||||
---
|
---
|
||||||
|
|
||||||
# `changePassword()`
|
# `changePassword()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: sendVerificationEmail()
|
|||||||
sidebar_label: sendVerificationEmail()
|
sidebar_label: sendVerificationEmail()
|
||||||
slug: /reference/javascript/auth/send-verification-email
|
slug: /reference/javascript/auth/send-verification-email
|
||||||
description: Use `nhost.auth.sendVerificationEmail` to send a verification email to the specified email. The email contains a verification-email link. When the user clicks the verification-email link their email is verified.
|
description: Use `nhost.auth.sendVerificationEmail` to send a verification email to the specified email. The email contains a verification-email link. When the user clicks the verification-email link their email is verified.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L303
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L321
|
||||||
---
|
---
|
||||||
|
|
||||||
# `sendVerificationEmail()`
|
# `sendVerificationEmail()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: changeEmail()
|
|||||||
sidebar_label: changeEmail()
|
sidebar_label: changeEmail()
|
||||||
slug: /reference/javascript/auth/change-email
|
slug: /reference/javascript/auth/change-email
|
||||||
description: Use `nhost.auth.changeEmail` to change a user's email. This will send a confirm-email-change link in an email to the new email. Once the user clicks on the confirm-email-change link the email will be change to the new email.
|
description: Use `nhost.auth.changeEmail` to change a user's email. This will send a confirm-email-change link in an email to the new email. Once the user clicks on the confirm-email-change link the email will be change to the new email.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L322
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L340
|
||||||
---
|
---
|
||||||
|
|
||||||
# `changeEmail()`
|
# `changeEmail()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: deanonymize()
|
|||||||
sidebar_label: deanonymize()
|
sidebar_label: deanonymize()
|
||||||
slug: /reference/javascript/auth/deanonymize
|
slug: /reference/javascript/auth/deanonymize
|
||||||
description: Use `nhost.auth.deanonymize` to deanonymize a user.
|
description: Use `nhost.auth.deanonymize` to deanonymize a user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L338
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L356
|
||||||
---
|
---
|
||||||
|
|
||||||
# `deanonymize()`
|
# `deanonymize()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: addSecurityKey()
|
|||||||
sidebar_label: addSecurityKey()
|
sidebar_label: addSecurityKey()
|
||||||
slug: /reference/javascript/auth/add-security-key
|
slug: /reference/javascript/auth/add-security-key
|
||||||
description: Use `nhost.auth.addSecurityKey to add a security key to the user, using the WebAuthn API.
|
description: Use `nhost.auth.addSecurityKey to add a security key to the user, using the WebAuthn API.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L376
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L394
|
||||||
---
|
---
|
||||||
|
|
||||||
# `addSecurityKey()`
|
# `addSecurityKey()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: onTokenChanged()
|
|||||||
sidebar_label: onTokenChanged()
|
sidebar_label: onTokenChanged()
|
||||||
slug: /reference/javascript/auth/on-token-changed
|
slug: /reference/javascript/auth/on-token-changed
|
||||||
description: Use `nhost.auth.onTokenChanged` to add a custom function that runs every time the access or refresh token is changed.
|
description: Use `nhost.auth.onTokenChanged` to add a custom function that runs every time the access or refresh token is changed.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L394
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L412
|
||||||
---
|
---
|
||||||
|
|
||||||
# `onTokenChanged()`
|
# `onTokenChanged()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: onAuthStateChanged()
|
|||||||
sidebar_label: onAuthStateChanged()
|
sidebar_label: onAuthStateChanged()
|
||||||
slug: /reference/javascript/auth/on-auth-state-changed
|
slug: /reference/javascript/auth/on-auth-state-changed
|
||||||
description: Use `nhost.auth.onAuthStateChanged` to add a custom function that runs every time the authentication status of the user changes. E.g. add a custom function that runs every time the authentication status changes from signed-in to signed-out.
|
description: Use `nhost.auth.onAuthStateChanged` to add a custom function that runs every time the authentication status of the user changes. E.g. add a custom function that runs every time the authentication status changes from signed-in to signed-out.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L429
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L447
|
||||||
---
|
---
|
||||||
|
|
||||||
# `onAuthStateChanged()`
|
# `onAuthStateChanged()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: isAuthenticated()
|
|||||||
sidebar_label: isAuthenticated()
|
sidebar_label: isAuthenticated()
|
||||||
slug: /reference/javascript/auth/is-authenticated
|
slug: /reference/javascript/auth/is-authenticated
|
||||||
description: Use `nhost.auth.isAuthenticated` to check if the user is authenticated or not.
|
description: Use `nhost.auth.isAuthenticated` to check if the user is authenticated or not.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L471
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L489
|
||||||
---
|
---
|
||||||
|
|
||||||
# `isAuthenticated()`
|
# `isAuthenticated()`
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ title: isAuthenticatedAsync()
|
|||||||
sidebar_label: isAuthenticatedAsync()
|
sidebar_label: isAuthenticatedAsync()
|
||||||
slug: /reference/javascript/auth/is-authenticated-async
|
slug: /reference/javascript/auth/is-authenticated-async
|
||||||
description: Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
description: Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L489
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L510
|
||||||
---
|
---
|
||||||
|
|
||||||
# `isAuthenticatedAsync()`
|
# `isAuthenticatedAsync()`
|
||||||
|
|
||||||
Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
||||||
|
|
||||||
|
The promise won't resolve until the authentication status is known.
|
||||||
|
Attention: when using auto-signin and a refresh token is present in the client storage, the promise won't resolve if the server can't be reached (e.g. offline) or if it returns an internal error.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const isAuthenticated = await nhost.auth.isAuthenticatedAsync()
|
const isAuthenticated = await nhost.auth.isAuthenticatedAsync()
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getAuthenticationStatus()
|
|||||||
sidebar_label: getAuthenticationStatus()
|
sidebar_label: getAuthenticationStatus()
|
||||||
slug: /reference/javascript/auth/get-authentication-status
|
slug: /reference/javascript/auth/get-authentication-status
|
||||||
description: Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the user.
|
description: Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L515
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L538
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getAuthenticationStatus()`
|
# `getAuthenticationStatus()`
|
||||||
@@ -14,6 +14,8 @@ Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the
|
|||||||
If `isLoading` is `true`, the client doesn't know whether the user is authenticated yet or not
|
If `isLoading` is `true`, the client doesn't know whether the user is authenticated yet or not
|
||||||
because some internal authentication network requests have not been resolved yet.
|
because some internal authentication network requests have not been resolved yet.
|
||||||
|
|
||||||
|
The `connectionAttempts` returns the number of times the client has tried to connect to the server with no success (offline, or the server retruned an internal error).
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const { isAuthenticated, isLoading } = nhost.auth.getAuthenticationStatus()
|
const { isAuthenticated, isLoading } = nhost.auth.getAuthenticationStatus()
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getAccessToken()
|
|||||||
sidebar_label: getAccessToken()
|
sidebar_label: getAccessToken()
|
||||||
slug: /reference/javascript/auth/get-access-token
|
slug: /reference/javascript/auth/get-access-token
|
||||||
description: Use `nhost.auth.getAccessToken` to get the access token of the user.
|
description: Use `nhost.auth.getAccessToken` to get the access token of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L545
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L575
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getAccessToken()`
|
# `getAccessToken()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getDecodedAccessToken()
|
|||||||
sidebar_label: getDecodedAccessToken()
|
sidebar_label: getDecodedAccessToken()
|
||||||
slug: /reference/javascript/auth/get-decoded-access-token
|
slug: /reference/javascript/auth/get-decoded-access-token
|
||||||
description: Use `nhost.auth.getDecodedAccessToken` to get the decoded access token of the user.
|
description: Use `nhost.auth.getDecodedAccessToken` to get the decoded access token of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L560
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L590
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getDecodedAccessToken()`
|
# `getDecodedAccessToken()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getHasuraClaims()
|
|||||||
sidebar_label: getHasuraClaims()
|
sidebar_label: getHasuraClaims()
|
||||||
slug: /reference/javascript/auth/get-hasura-claims
|
slug: /reference/javascript/auth/get-hasura-claims
|
||||||
description: Use `nhost.auth.getHasuraClaims` to get the Hasura claims of the user.
|
description: Use `nhost.auth.getHasuraClaims` to get the Hasura claims of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L577
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L607
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getHasuraClaims()`
|
# `getHasuraClaims()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getHasuraClaim()
|
|||||||
sidebar_label: getHasuraClaim()
|
sidebar_label: getHasuraClaim()
|
||||||
slug: /reference/javascript/auth/get-hasura-claim
|
slug: /reference/javascript/auth/get-hasura-claim
|
||||||
description: Use `nhost.auth.getHasuraClaim` to get the value of a specific Hasura claim of the user.
|
description: Use `nhost.auth.getHasuraClaim` to get the value of a specific Hasura claim of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L595
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L625
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getHasuraClaim()`
|
# `getHasuraClaim()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: refreshSession()
|
|||||||
sidebar_label: refreshSession()
|
sidebar_label: refreshSession()
|
||||||
slug: /reference/javascript/auth/refresh-session
|
slug: /reference/javascript/auth/refresh-session
|
||||||
description: Use `nhost.auth.refreshSession` to refresh the session with either the current internal refresh token or an external refresh token.
|
description: Use `nhost.auth.refreshSession` to refresh the session with either the current internal refresh token or an external refresh token.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L618
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L648
|
||||||
---
|
---
|
||||||
|
|
||||||
# `refreshSession()`
|
# `refreshSession()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getSession()
|
|||||||
sidebar_label: getSession()
|
sidebar_label: getSession()
|
||||||
slug: /reference/javascript/auth/get-session
|
slug: /reference/javascript/auth/get-session
|
||||||
description: Use `nhost.auth.getSession()` to get the session of the user.
|
description: Use `nhost.auth.getSession()` to get the session of the user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L659
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L689
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getSession()`
|
# `getSession()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: getUser()
|
|||||||
sidebar_label: getUser()
|
sidebar_label: getUser()
|
||||||
slug: /reference/javascript/auth/get-user
|
slug: /reference/javascript/auth/get-user
|
||||||
description: Use `nhost.auth.getUser()` to get the signed-in user.
|
description: Use `nhost.auth.getUser()` to get the signed-in user.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L674
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L704
|
||||||
---
|
---
|
||||||
|
|
||||||
# `getUser()`
|
# `getUser()`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: HasuraAuthClient
|
|||||||
sidebar_label: Auth
|
sidebar_label: Auth
|
||||||
description: No description provided.
|
description: No description provided.
|
||||||
slug: /reference/javascript/auth
|
slug: /reference/javascript/auth
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L64
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L65
|
||||||
---
|
---
|
||||||
|
|
||||||
# `HasuraAuthClient`
|
# `HasuraAuthClient`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: useSignUpEmailPassword()
|
|||||||
sidebar_label: useSignUpEmailPassword()
|
sidebar_label: useSignUpEmailPassword()
|
||||||
slug: /reference/vue/use-sign-up-email-password
|
slug: /reference/vue/use-sign-up-email-password
|
||||||
description: Use the composable `useSignUpEmailPassword` to sign up a user using email and password.
|
description: Use the composable `useSignUpEmailPassword` to sign up a user using email and password.
|
||||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/useSignUpEmailPassword.ts#L46
|
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/useSignUpEmailPassword.ts#L45
|
||||||
---
|
---
|
||||||
|
|
||||||
# `useSignUpEmailPassword()`
|
# `useSignUpEmailPassword()`
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ const config = {
|
|||||||
favicon: 'img/favicon.png',
|
favicon: 'img/favicon.png',
|
||||||
organizationName: 'nhost',
|
organizationName: 'nhost',
|
||||||
projectName: 'docs',
|
projectName: 'docs',
|
||||||
|
scripts: [
|
||||||
|
{ src: 'https://plausible.io/js/script.js', defer: true, 'data-domain': 'docs.nhost.io' }
|
||||||
|
],
|
||||||
plugins: [require.resolve('docusaurus-plugin-image-zoom')],
|
plugins: [require.resolve('docusaurus-plugin-image-zoom')],
|
||||||
presets: [
|
presets: [
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/docs",
|
"name": "@nhost/docs",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
@@ -19,18 +19,18 @@
|
|||||||
"@docusaurus/plugin-sitemap": "2.0.0-beta.20",
|
"@docusaurus/plugin-sitemap": "2.0.0-beta.20",
|
||||||
"@docusaurus/preset-classic": "2.0.0-beta.20",
|
"@docusaurus/preset-classic": "2.0.0-beta.20",
|
||||||
"@mdx-js/react": "^1.6.22",
|
"@mdx-js/react": "^1.6.22",
|
||||||
"clsx": "^1.1.1",
|
"clsx": "^1.2.1",
|
||||||
"docusaurus-plugin-image-zoom": "^0.1.1",
|
"docusaurus-plugin-image-zoom": "^0.1.1",
|
||||||
"mdx-mermaid": "^1.2.1",
|
"mdx-mermaid": "^1.3.2",
|
||||||
"mermaid": "^8.14.0",
|
"mermaid": "^8.14.0",
|
||||||
"prism-react-renderer": "^1.3.1",
|
"prism-react-renderer": "^1.3.5",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2"
|
"react-dom": "^17.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.0.0-beta.20",
|
"@docusaurus/module-type-aliases": "2.0.0-beta.20",
|
||||||
"@tsconfig/docusaurus": "^1.0.5",
|
"@tsconfig/docusaurus": "^1.0.6",
|
||||||
"typescript": "^4.6.3"
|
"typescript": "^4.8.2"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
|||||||
11
examples/codegen-react-apollo/CHANGELOG.md
Normal file
11
examples/codegen-react-apollo/CHANGELOG.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# @nhost-examples/codegen-react-apollo
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- ba785da1: Bump dependencies versions
|
||||||
|
- Updated dependencies [ba785da1]
|
||||||
|
- Updated dependencies [6da44bf8]
|
||||||
|
- @nhost/react@0.14.0
|
||||||
|
- @nhost/react-apollo@5.0.0
|
||||||
@@ -5,9 +5,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.13.2
|
image: nhost/hasura-auth:0.15.0
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.5
|
||||||
auth:
|
auth:
|
||||||
access_control:
|
access_control:
|
||||||
email:
|
email:
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/codegen-react-apollo",
|
"name": "@nhost-examples/codegen-react-apollo",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.6.9",
|
"@apollo/client": "^3.6.9",
|
||||||
"@nhost/react": "*",
|
"@nhost/react": "*",
|
||||||
"@nhost/react-apollo": "*",
|
"@nhost/react-apollo": "*",
|
||||||
"graphql": "^16.5.0",
|
"graphql": "15.7.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
@@ -35,15 +35,15 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@graphql-codegen/cli": "^2.6.2",
|
"@graphql-codegen/cli": "^2.12.0",
|
||||||
"@graphql-codegen/typescript-operations": "^2.4.2",
|
"@graphql-codegen/typescript-operations": "^2.5.3",
|
||||||
"@graphql-codegen/typescript-react-apollo": "^3.2.16",
|
"@graphql-codegen/typescript-react-apollo": "^3.3.3",
|
||||||
"@types/node": "^16.7.13",
|
"@types/node": "^16.11.56",
|
||||||
"@types/react": "^18.0.0",
|
"@types/react": "^18.0.18",
|
||||||
"@types/react-dom": "^18.0.0",
|
"@types/react-dom": "^18.0.6",
|
||||||
"eslint": "^8.0.0",
|
"eslint": "^8.23.0",
|
||||||
"eslint-config-react-app": "^7.0.1",
|
"eslint-config-react-app": "^7.0.1",
|
||||||
"typescript": "^4.4.2",
|
"typescript": "^4.8.2",
|
||||||
"vite": "^2.9.7"
|
"vite": "^2.9.15"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
examples/codegen-react-query/CHANGELOG.md
Normal file
10
examples/codegen-react-query/CHANGELOG.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# @nhost-examples/codegen-react-query
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- ba785da1: Bump dependencies versions
|
||||||
|
- Updated dependencies [ba785da1]
|
||||||
|
- Updated dependencies [6da44bf8]
|
||||||
|
- @nhost/react@0.14.0
|
||||||
@@ -5,9 +5,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.13.2
|
image: nhost/hasura-auth:0.15.0
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.5
|
||||||
auth:
|
auth:
|
||||||
access_control:
|
access_control:
|
||||||
email:
|
email:
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/codegen-react-query",
|
"name": "@nhost-examples/codegen-react-query",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nhost/react": "*",
|
"@nhost/react": "*",
|
||||||
"@tanstack/react-query": "^4.0.10",
|
"@tanstack/react-query": "^4.2.3",
|
||||||
"@tanstack/react-query-devtools": "^4.0.10",
|
"@tanstack/react-query-devtools": "^4.2.3",
|
||||||
"graphql": "^16.5.0",
|
"graphql": "15.7.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
@@ -35,14 +35,14 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@graphql-codegen/cli": "^2.8.1",
|
"@graphql-codegen/cli": "^2.12.0",
|
||||||
"@graphql-codegen/typescript-operations": "^2.5.1",
|
"@graphql-codegen/typescript-operations": "^2.5.3",
|
||||||
"@graphql-codegen/typescript-react-query": "^4.0.0",
|
"@graphql-codegen/typescript-react-query": "^4.0.1",
|
||||||
"@types/node": "^16.7.13",
|
"@types/node": "^16.11.56",
|
||||||
"@types/react": "^18.0.0",
|
"@types/react": "^18.0.18",
|
||||||
"@types/react-dom": "^18.0.0",
|
"@types/react-dom": "^18.0.6",
|
||||||
"eslint": "^8.0.0",
|
"eslint": "^8.23.0",
|
||||||
"typescript": "^4.4.2",
|
"typescript": "^4.8.2",
|
||||||
"vite": "^2.9.7"
|
"vite": "^2.9.15"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
examples/multi-tenant-one-to-many/CHANGELOG.md
Normal file
9
examples/multi-tenant-one-to-many/CHANGELOG.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# @nhost-examples/multi-tenant-one-to-many
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- ba785da1: Bump dependencies versions
|
||||||
|
- Updated dependencies [ba785da1]
|
||||||
|
- @nhost/nhost-js@1.5.1
|
||||||
@@ -5,9 +5,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.13.2
|
image: nhost/hasura-auth:0.15.0
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.5
|
||||||
auth:
|
auth:
|
||||||
access_control:
|
access_control:
|
||||||
email:
|
email:
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/multi-tenant-one-to-many",
|
"name": "@nhost-examples/multi-tenant-one-to-many",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {},
|
||||||
},
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.13",
|
||||||
"express": "^4.17.2",
|
"express": "^4.18.1",
|
||||||
"typescript": "^4.5.4"
|
"typescript": "^4.8.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nhost/nhost-js": "^0.3.3"
|
"@nhost/nhost-js": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,16 @@
|
|||||||
# @nhost-examples/nextjs
|
# @nhost-examples/nextjs
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- ba785da1: Bump dependencies versions
|
||||||
|
- Updated dependencies [ba785da1]
|
||||||
|
- Updated dependencies [6da44bf8]
|
||||||
|
- @nhost/nextjs@2.0.0
|
||||||
|
- @nhost/react@0.14.0
|
||||||
|
- @nhost/react-apollo@5.0.0
|
||||||
|
|
||||||
## 0.0.2
|
## 0.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
hasura_graphql_enable_remote_schema_permissions: false
|
||||||
auth:
|
auth:
|
||||||
image: nhost/hasura-auth:0.13.2
|
image: nhost/hasura-auth:0.15.0
|
||||||
storage:
|
storage:
|
||||||
image: nhost/hasura-storage:0.2.4
|
image: nhost/hasura-storage:0.2.5
|
||||||
auth:
|
auth:
|
||||||
access_control:
|
access_control:
|
||||||
email:
|
email:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/nextjs",
|
"name": "@nhost-examples/nextjs",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@@ -16,27 +16,27 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.6.9",
|
"@apollo/client": "^3.6.9",
|
||||||
"@mantine/core": "^4.2.2",
|
"@mantine/core": "^4.2.12",
|
||||||
"@mantine/hooks": "^4.2.2",
|
"@mantine/hooks": "^4.2.12",
|
||||||
"@mantine/next": "^4.2.2",
|
"@mantine/next": "^4.2.12",
|
||||||
"@mantine/notifications": "^4.2.2",
|
"@mantine/notifications": "^4.2.12",
|
||||||
"@nhost/nextjs": "*",
|
"@nhost/nextjs": "*",
|
||||||
"@nhost/react": "*",
|
"@nhost/react": "*",
|
||||||
"@nhost/react-apollo": "*",
|
"@nhost/react-apollo": "*",
|
||||||
"graphql": "^16.3.0",
|
"graphql": "15.7.2",
|
||||||
"next": "12.1.6",
|
"next": "12.1.6",
|
||||||
"react": "18.1.0",
|
"react": "18.1.0",
|
||||||
"react-dom": "18.1.0",
|
"react-dom": "18.1.0",
|
||||||
"react-icons": "^4.3.1"
|
"react-icons": "^4.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next/bundle-analyzer": "^12.1.5",
|
"@next/bundle-analyzer": "^12.2.5",
|
||||||
"@types/node": "17.0.23",
|
"@types/node": "17.0.23",
|
||||||
"@types/react": "18.0.8",
|
"@types/react": "18.0.8",
|
||||||
"@xstate/inspect": "^0.6.2",
|
"@xstate/inspect": "^0.6.2",
|
||||||
"eslint-config-next": "12.0.10",
|
"eslint-config-next": "12.0.10",
|
||||||
"typescript": "4.5.5",
|
"typescript": "4.5.5",
|
||||||
"ws": "^8.5.0",
|
"ws": "^8.8.1",
|
||||||
"xstate": "^4.32.1"
|
"xstate": "^4.33.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../config/tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
@@ -16,6 +19,12 @@
|
|||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"incremental": true
|
"incremental": true
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
"include": [
|
||||||
"exclude": ["node_modules"]
|
"next-env.d.ts",
|
||||||
}
|
"**/*.ts",
|
||||||
|
"**/*.tsx"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
VITE_NHOST_URL=http://localhost:1337
|
|
||||||
27
examples/react-apollo-crm/.gitignore
vendored
27
examples/react-apollo-crm/.gitignore
vendored
@@ -1,27 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
.env
|
|
||||||
.env.local
|
|
||||||
.env.development.local
|
|
||||||
.env.development
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
|
|
||||||
.nhost
|
|
||||||
11
examples/react-apollo-crm/CHANGELOG.md
Normal file
11
examples/react-apollo-crm/CHANGELOG.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# @nhost-examples/react-apollo-crm
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- ba785da1: Bump dependencies versions
|
||||||
|
- Updated dependencies [ba785da1]
|
||||||
|
- Updated dependencies [6da44bf8]
|
||||||
|
- @nhost/react@0.14.0
|
||||||
|
- @nhost/react-apollo@5.0.0
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
# CRM Example App with Nhost [WIP]
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Using the following technologies:
|
|
||||||
|
|
||||||
- [Nhost](https://nhost.io) (obviously)
|
|
||||||
- [React](https://reactjs.org/)
|
|
||||||
- [React Router v6](https://reactrouter.com/docs/en/v6)
|
|
||||||
- [TypeScript](https://www.typescriptlang.org/)
|
|
||||||
- [GraphQL Codegen](https://www.graphql-code-generator.com/)
|
|
||||||
- [Tailwind CSS](https://tailwindcss.com/)
|
|
||||||
- [Tailwind UI](https://tailwindui.com/)
|
|
||||||
|
|
||||||
### Some features showcased in this example
|
|
||||||
|
|
||||||
- Postgres
|
|
||||||
- GraphQL
|
|
||||||
- Permissions
|
|
||||||
- Authentication
|
|
||||||
- Sign Up
|
|
||||||
- Sign In
|
|
||||||
- Reset Password
|
|
||||||
- Storage
|
|
||||||
- Upload
|
|
||||||
- Download (with presigned URLs)
|
|
||||||
- Serverless functions
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Todo
|
|
||||||
|
|
||||||
This example app has some work in progress:
|
|
||||||
|
|
||||||
### Customers: New
|
|
||||||
|
|
||||||
- [ ] Add zipcode, town and country to new users
|
|
||||||
- [ ] Toast for submits
|
|
||||||
|
|
||||||
### Customers: Customer
|
|
||||||
|
|
||||||
- [ ] Render single customer
|
|
||||||
|
|
||||||
### Customers: List
|
|
||||||
|
|
||||||
- [ ] Show correct current and total results
|
|
||||||
- [ ] Correct pagination
|
|
||||||
|
|
||||||
## Orders: List
|
|
||||||
|
|
||||||
- [ ] List existing orders
|
|
||||||
|
|
||||||
## Orders: New
|
|
||||||
|
|
||||||
- [ ] Create new order
|
|
||||||
|
|
||||||
## Orders: Order
|
|
||||||
|
|
||||||
- [ ] Render single order
|
|
||||||
|
|
||||||
## Settings
|
|
||||||
|
|
||||||
- [ ] Update company name and address
|
|
||||||
- [ ] Add company logo
|
|
||||||
- [ ] ~ Client-side cropping to company logo before uploading
|
|
||||||
|
|
||||||
## Search:
|
|
||||||
|
|
||||||
- [ ] Make top-level search bar working
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Get started
|
|
||||||
|
|
||||||
1. Clone the repository
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/nhost/nhost
|
|
||||||
cd nhost
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Install dependencies
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd examples/react-apollo-crm
|
|
||||||
pnpm install
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Terminal 1: Start Nhost
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nhost dev
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Terminal 2: Start React App
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pnpm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
5. Terminal 3: Start GraphQL Codegens
|
|
||||||
|
|
||||||
> Make sure that the Nhost backend in step 2 has started and is available before you run this command
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run codegen -- -w
|
|
||||||
```
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
client: {
|
|
||||||
service: {
|
|
||||||
name: 'backend',
|
|
||||||
url: 'http://localhost:1337/v1/graphql',
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': 'nhost-admin-secret'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
includes: ['src/**/*.graphql', 'src/**/*.gql']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 728 KiB |
@@ -1,15 +0,0 @@
|
|||||||
overwrite: true
|
|
||||||
schema: http://localhost:1337/v1/graphql
|
|
||||||
headers:
|
|
||||||
x-hasura-admin-secret: nhost-admin-secret
|
|
||||||
documents:
|
|
||||||
- 'src/**/*.graphql'
|
|
||||||
- 'src/**/*.gql'
|
|
||||||
generates:
|
|
||||||
src/utils/__generated__/graphql.ts:
|
|
||||||
plugins:
|
|
||||||
- 'typescript'
|
|
||||||
- 'typescript-operations'
|
|
||||||
- 'typescript-react-apollo'
|
|
||||||
config:
|
|
||||||
withRefetchFn: true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { NhostClient } from '@nhost/nhost-js'
|
|
||||||
|
|
||||||
const nhost = new NhostClient({
|
|
||||||
backendUrl: process.env.NHOST_BACKEND_URL!
|
|
||||||
})
|
|
||||||
|
|
||||||
export { nhost }
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
import { Request, Response } from 'express'
|
|
||||||
import { nhost } from '../../_utils/nhost'
|
|
||||||
|
|
||||||
const handler = async (req: Request, res: Response) => {
|
|
||||||
if (req.headers['nhsot-webhook-secret'] !== process.env.NHSOT_WEBHOOK_SECRET) {
|
|
||||||
return res.status(401).send('Unauthorized')
|
|
||||||
}
|
|
||||||
|
|
||||||
// User who just signed up
|
|
||||||
const user = req.body.event.data.new
|
|
||||||
|
|
||||||
// Get the user's email domain
|
|
||||||
const emailDomain = user.email.split('@')[1]
|
|
||||||
|
|
||||||
// Check if a company with the user's email domain already exists.
|
|
||||||
const GET_COMPANY_WITH_EMAIL_DOMAIN = `
|
|
||||||
query getCompanyWithEmailDomain($emailDomain: String!) {
|
|
||||||
companies(where: { emailDomain: { _eq: $emailDomain } }) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await nhost.graphql.request(
|
|
||||||
GET_COMPANY_WITH_EMAIL_DOMAIN,
|
|
||||||
{
|
|
||||||
emailDomain
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': process.env.NHOST_ADMIN_SECRET
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return res.status(500).send(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
const { companies } = data as any
|
|
||||||
|
|
||||||
let companyId
|
|
||||||
if (companies.length === 1) {
|
|
||||||
// if a company already exists, use that company's id
|
|
||||||
companyId = companies[0].id
|
|
||||||
} else {
|
|
||||||
// else, create a new company for the newly created user with the same email domain as the user
|
|
||||||
const CREATE_NEW_COMPANY = `
|
|
||||||
mutation insertCompany($emailDomain: String!) {
|
|
||||||
insertCompany(object: { name: $emailDomain, emailDomain: $emailDomain }) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await nhost.graphql.request(
|
|
||||||
CREATE_NEW_COMPANY,
|
|
||||||
{
|
|
||||||
emailDomain
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': process.env.NHOST_ADMIN_SECRET
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return res.status(500).send(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
const { insertCompany } = data as any
|
|
||||||
|
|
||||||
companyId = insertCompany.id
|
|
||||||
}
|
|
||||||
|
|
||||||
// We now have the company id of an existing, or a newly created company.
|
|
||||||
// Now let's add the user to the company.
|
|
||||||
|
|
||||||
const ADD_USER_TO_COMPANY = `
|
|
||||||
mutation addUserToCompany($userId: uuid!, $companyId: uuid!) {
|
|
||||||
insertCompanyUser(object: {userId: $userId, companyId: $companyId}) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { error: addUserToCompanyError } = await nhost.graphql.request(
|
|
||||||
ADD_USER_TO_COMPANY,
|
|
||||||
{
|
|
||||||
userId: user.id,
|
|
||||||
companyId
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': process.env.NHOST_ADMIN_SECRET
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (addUserToCompanyError) {
|
|
||||||
return res.status(500).send(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
res.status(200).send(`OK`)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default handler
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="icon" href="/favicon.ico" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
<meta name="description" content="Web site created using create-react-app" />
|
|
||||||
<link rel="apple-touch-icon" href="/logo192.png" />
|
|
||||||
<link rel="manifest" href="/manifest.json" />
|
|
||||||
<title>React App</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
<script type="module" src="/src/index.tsx"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
metadata_directory: metadata
|
|
||||||
services:
|
|
||||||
hasura:
|
|
||||||
image: hasura/graphql-engine:v2.10.1
|
|
||||||
environment:
|
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
|
||||||
auth:
|
|
||||||
image: nhost/hasura-auth:0.13.2
|
|
||||||
storage:
|
|
||||||
image: nhost/hasura-storage:0.2.4
|
|
||||||
auth:
|
|
||||||
access_control:
|
|
||||||
email:
|
|
||||||
allowed_email_domains: ''
|
|
||||||
allowed_emails: ''
|
|
||||||
blocked_email_domains: ''
|
|
||||||
blocked_emails: ''
|
|
||||||
allowed_redirect_urls: ''
|
|
||||||
anonymous_users_enabled: false
|
|
||||||
client_url: http://localhost:3000
|
|
||||||
disable_new_users: false
|
|
||||||
email:
|
|
||||||
enabled: false
|
|
||||||
passwordless:
|
|
||||||
enabled: false
|
|
||||||
template_fetch_url: ''
|
|
||||||
signin_email_verified_required: false
|
|
||||||
gravatar:
|
|
||||||
default: ''
|
|
||||||
enabled: true
|
|
||||||
rating: ''
|
|
||||||
locale:
|
|
||||||
allowed: en
|
|
||||||
default: en
|
|
||||||
password:
|
|
||||||
hibp_enabled: false
|
|
||||||
min_length: 3
|
|
||||||
provider:
|
|
||||||
apple:
|
|
||||||
client_id: ''
|
|
||||||
enabled: false
|
|
||||||
key_id: ''
|
|
||||||
private_key: ''
|
|
||||||
scope: name,email
|
|
||||||
team_id: ''
|
|
||||||
bitbucket:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
facebook:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: email,photos,displayName
|
|
||||||
github:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: user:email
|
|
||||||
token_url: ''
|
|
||||||
user_profile_url: ''
|
|
||||||
gitlab:
|
|
||||||
base_url: ''
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: read_user
|
|
||||||
google:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: email,profile
|
|
||||||
linkedin:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: r_emailaddress,r_liteprofile
|
|
||||||
spotify:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: user-read-email,user-read-private
|
|
||||||
strava:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
twilio:
|
|
||||||
account_sid: ''
|
|
||||||
auth_token: ''
|
|
||||||
enabled: false
|
|
||||||
messaging_service_id: ''
|
|
||||||
twitter:
|
|
||||||
consumer_key: ''
|
|
||||||
consumer_secret: ''
|
|
||||||
enabled: false
|
|
||||||
windows_live:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: wl.basic,wl.emails,wl.contacts_emails
|
|
||||||
sms:
|
|
||||||
enabled: false
|
|
||||||
passwordless:
|
|
||||||
enabled: false
|
|
||||||
provider:
|
|
||||||
twilio:
|
|
||||||
account_sid: ''
|
|
||||||
auth_token: ''
|
|
||||||
from: ''
|
|
||||||
messaging_service_id: ''
|
|
||||||
smtp:
|
|
||||||
host: mailhog
|
|
||||||
method: ''
|
|
||||||
pass: password
|
|
||||||
port: 1025
|
|
||||||
secure: false
|
|
||||||
sender: hasura-auth@example.com
|
|
||||||
user: user
|
|
||||||
token:
|
|
||||||
access:
|
|
||||||
expires_in: 900
|
|
||||||
refresh:
|
|
||||||
expires_in: 43200
|
|
||||||
user:
|
|
||||||
allowed_roles: user,me
|
|
||||||
default_allowed_roles: user,me
|
|
||||||
default_role: user
|
|
||||||
mfa:
|
|
||||||
enabled: false
|
|
||||||
issuer: nhost
|
|
||||||
storage:
|
|
||||||
force_download_for_content_types: text/html,application/javascript
|
|
||||||
version: 3
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h2>Confirm Email Change</h2>
|
|
||||||
<p>Use this link to confirm changing email:</p>
|
|
||||||
<p>
|
|
||||||
<a
|
|
||||||
href="${serverUrl}/verify?&ticket=${ticket}&type=emailConfirmChange&redirectTo=${redirectTo}"
|
|
||||||
>
|
|
||||||
Change email
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Change your email address
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h2>Verify Email</h2>
|
|
||||||
<p>Use this link to verify your email:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${serverUrl}/verify?&ticket=${ticket}&type=emailVerify&redirectTo=${redirectTo}">
|
|
||||||
Verify Email
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Verify your email
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h2>Reset Password</h2>
|
|
||||||
<p>Use this link to reset your password:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${serverUrl}/verify?&ticket=${ticket}&type=passwordReset&redirectTo=${redirectTo}">
|
|
||||||
Reset password
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Reset your password
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h2>Magic Link</h2>
|
|
||||||
<p>Use this link to securely sign in:</p>
|
|
||||||
<p>
|
|
||||||
<a
|
|
||||||
href="${serverUrl}/verify?&ticket=${ticket}&type=signinPasswordless&redirectTo=${redirectTo}"
|
|
||||||
>
|
|
||||||
Sign In
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Secure sign-in link
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
type Mutation {
|
|
||||||
actionName(
|
|
||||||
arg1: SampleInput!
|
|
||||||
): SampleOutput
|
|
||||||
}
|
|
||||||
|
|
||||||
input SampleInput {
|
|
||||||
username: String!
|
|
||||||
password: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type SampleOutput {
|
|
||||||
accessToken: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
actions:
|
|
||||||
- name: actionName
|
|
||||||
definition:
|
|
||||||
kind: synchronous
|
|
||||||
handler: http://host.docker.internal:3000
|
|
||||||
permissions:
|
|
||||||
- role: user
|
|
||||||
custom_types:
|
|
||||||
enums: []
|
|
||||||
input_objects:
|
|
||||||
- name: SampleInput
|
|
||||||
objects:
|
|
||||||
- name: SampleOutput
|
|
||||||
scalars: []
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
- name: default
|
|
||||||
kind: postgres
|
|
||||||
configuration:
|
|
||||||
connection_info:
|
|
||||||
database_url:
|
|
||||||
from_env: HASURA_GRAPHQL_DATABASE_URL
|
|
||||||
isolation_level: read-committed
|
|
||||||
pool_settings:
|
|
||||||
connection_lifetime: 600
|
|
||||||
idle_timeout: 180
|
|
||||||
max_connections: 50
|
|
||||||
retries: 20
|
|
||||||
use_prepared_statements: true
|
|
||||||
tables: "!include default/tables/tables.yaml"
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
table:
|
|
||||||
name: provider_requests
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config: {}
|
|
||||||
custom_column_names: {}
|
|
||||||
custom_name: authProviderRequests
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthProviderRequests
|
|
||||||
delete_by_pk: deleteAuthProviderRequest
|
|
||||||
insert: insertAuthProviderRequests
|
|
||||||
insert_one: insertAuthProviderRequest
|
|
||||||
select: authProviderRequests
|
|
||||||
select_aggregate: authProviderRequestsAggregate
|
|
||||||
select_by_pk: authProviderRequest
|
|
||||||
update: updateAuthProviderRequests
|
|
||||||
update_by_pk: updateAuthProviderRequest
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
table:
|
|
||||||
name: providers
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config: {}
|
|
||||||
custom_column_names: {}
|
|
||||||
custom_name: authProviders
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthProviders
|
|
||||||
delete_by_pk: deleteAuthProvider
|
|
||||||
insert: insertAuthProviders
|
|
||||||
insert_one: insertAuthProvider
|
|
||||||
select: authProviders
|
|
||||||
select_aggregate: authProvidersAggregate
|
|
||||||
select_by_pk: authProvider
|
|
||||||
update: updateAuthProviders
|
|
||||||
update_by_pk: updateAuthProvider
|
|
||||||
array_relationships:
|
|
||||||
- name: userProviders
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: provider_id
|
|
||||||
table:
|
|
||||||
name: user_providers
|
|
||||||
schema: auth
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
table:
|
|
||||||
name: refresh_tokens
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
expires_at:
|
|
||||||
custom_name: expiresAt
|
|
||||||
refresh_token:
|
|
||||||
custom_name: refreshToken
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
expires_at: expiresAt
|
|
||||||
refresh_token: refreshToken
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authRefreshTokens
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthRefreshTokens
|
|
||||||
delete_by_pk: deleteAuthRefreshToken
|
|
||||||
insert: insertAuthRefreshTokens
|
|
||||||
insert_one: insertAuthRefreshToken
|
|
||||||
select: authRefreshTokens
|
|
||||||
select_aggregate: authRefreshTokensAggregate
|
|
||||||
select_by_pk: authRefreshToken
|
|
||||||
update: updateAuthRefreshTokens
|
|
||||||
update_by_pk: updateAuthRefreshToken
|
|
||||||
object_relationships:
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
table:
|
|
||||||
name: roles
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config: {}
|
|
||||||
custom_column_names: {}
|
|
||||||
custom_name: authRoles
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthRoles
|
|
||||||
delete_by_pk: deleteAuthRole
|
|
||||||
insert: insertAuthRoles
|
|
||||||
insert_one: insertAuthRole
|
|
||||||
select: authRoles
|
|
||||||
select_aggregate: authRolesAggregate
|
|
||||||
select_by_pk: authRole
|
|
||||||
update: updateAuthRoles
|
|
||||||
update_by_pk: updateAuthRole
|
|
||||||
array_relationships:
|
|
||||||
- name: userRoles
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: role
|
|
||||||
table:
|
|
||||||
name: user_roles
|
|
||||||
schema: auth
|
|
||||||
- name: usersByDefaultRole
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: default_role
|
|
||||||
table:
|
|
||||||
name: users
|
|
||||||
schema: auth
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
table:
|
|
||||||
name: user_providers
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
access_token:
|
|
||||||
custom_name: accessToken
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
provider_id:
|
|
||||||
custom_name: providerId
|
|
||||||
provider_user_id:
|
|
||||||
custom_name: providerUserId
|
|
||||||
refresh_token:
|
|
||||||
custom_name: refreshToken
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
access_token: accessToken
|
|
||||||
created_at: createdAt
|
|
||||||
provider_id: providerId
|
|
||||||
provider_user_id: providerUserId
|
|
||||||
refresh_token: refreshToken
|
|
||||||
updated_at: updatedAt
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authUserProviders
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthUserProviders
|
|
||||||
delete_by_pk: deleteAuthUserProvider
|
|
||||||
insert: insertAuthUserProviders
|
|
||||||
insert_one: insertAuthUserProvider
|
|
||||||
select: authUserProviders
|
|
||||||
select_aggregate: authUserProvidersAggregate
|
|
||||||
select_by_pk: authUserProvider
|
|
||||||
update: updateAuthUserProviders
|
|
||||||
update_by_pk: updateAuthUserProvider
|
|
||||||
object_relationships:
|
|
||||||
- name: provider
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: provider_id
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
table:
|
|
||||||
name: user_roles
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authUserRoles
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthUserRoles
|
|
||||||
delete_by_pk: deleteAuthUserRole
|
|
||||||
insert: insertAuthUserRoles
|
|
||||||
insert_one: insertAuthUserRole
|
|
||||||
select: authUserRoles
|
|
||||||
select_aggregate: authUserRolesAggregate
|
|
||||||
select_by_pk: authUserRole
|
|
||||||
update: updateAuthUserRoles
|
|
||||||
update_by_pk: updateAuthUserRole
|
|
||||||
object_relationships:
|
|
||||||
- name: roleByRole
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: role
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
table:
|
|
||||||
name: users
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
active_mfa_type:
|
|
||||||
custom_name: activeMfaType
|
|
||||||
avatar_url:
|
|
||||||
custom_name: avatarUrl
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
default_role:
|
|
||||||
custom_name: defaultRole
|
|
||||||
display_name:
|
|
||||||
custom_name: displayName
|
|
||||||
email_verified:
|
|
||||||
custom_name: emailVerified
|
|
||||||
is_anonymous:
|
|
||||||
custom_name: isAnonymous
|
|
||||||
last_seen:
|
|
||||||
custom_name: lastSeen
|
|
||||||
new_email:
|
|
||||||
custom_name: newEmail
|
|
||||||
otp_hash:
|
|
||||||
custom_name: otpHash
|
|
||||||
otp_hash_expires_at:
|
|
||||||
custom_name: otpHashExpiresAt
|
|
||||||
otp_method_last_used:
|
|
||||||
custom_name: otpMethodLastUsed
|
|
||||||
password_hash:
|
|
||||||
custom_name: passwordHash
|
|
||||||
phone_number:
|
|
||||||
custom_name: phoneNumber
|
|
||||||
phone_number_verified:
|
|
||||||
custom_name: phoneNumberVerified
|
|
||||||
ticket_expires_at:
|
|
||||||
custom_name: ticketExpiresAt
|
|
||||||
totp_secret:
|
|
||||||
custom_name: totpSecret
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
webauthn_current_challenge:
|
|
||||||
custom_name: currentChallenge
|
|
||||||
custom_column_names:
|
|
||||||
active_mfa_type: activeMfaType
|
|
||||||
avatar_url: avatarUrl
|
|
||||||
created_at: createdAt
|
|
||||||
default_role: defaultRole
|
|
||||||
display_name: displayName
|
|
||||||
email_verified: emailVerified
|
|
||||||
is_anonymous: isAnonymous
|
|
||||||
last_seen: lastSeen
|
|
||||||
new_email: newEmail
|
|
||||||
otp_hash: otpHash
|
|
||||||
otp_hash_expires_at: otpHashExpiresAt
|
|
||||||
otp_method_last_used: otpMethodLastUsed
|
|
||||||
password_hash: passwordHash
|
|
||||||
phone_number: phoneNumber
|
|
||||||
phone_number_verified: phoneNumberVerified
|
|
||||||
ticket_expires_at: ticketExpiresAt
|
|
||||||
totp_secret: totpSecret
|
|
||||||
updated_at: updatedAt
|
|
||||||
webauthn_current_challenge: currentChallenge
|
|
||||||
custom_name: users
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteUsers
|
|
||||||
delete_by_pk: deleteUser
|
|
||||||
insert: insertUsers
|
|
||||||
insert_one: insertUser
|
|
||||||
select: users
|
|
||||||
select_aggregate: usersAggregate
|
|
||||||
select_by_pk: user
|
|
||||||
update: updateUsers
|
|
||||||
update_by_pk: updateUser
|
|
||||||
object_relationships:
|
|
||||||
- name: companyUser
|
|
||||||
using:
|
|
||||||
manual_configuration:
|
|
||||||
column_mapping:
|
|
||||||
id: user_id
|
|
||||||
insertion_order: null
|
|
||||||
remote_table:
|
|
||||||
name: company_users
|
|
||||||
schema: public
|
|
||||||
- name: defaultRoleByRole
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: default_role
|
|
||||||
array_relationships:
|
|
||||||
- name: authenticators
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_authenticators
|
|
||||||
schema: auth
|
|
||||||
- name: customer_comments
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: customer_comments
|
|
||||||
schema: public
|
|
||||||
- name: customers
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: customers
|
|
||||||
schema: public
|
|
||||||
- name: refreshTokens
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: refresh_tokens
|
|
||||||
schema: auth
|
|
||||||
- name: roles
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_roles
|
|
||||||
schema: auth
|
|
||||||
- name: userProviders
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_providers
|
|
||||||
schema: auth
|
|
||||||
select_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- avatar_url
|
|
||||||
- display_name
|
|
||||||
- email
|
|
||||||
- id
|
|
||||||
filter:
|
|
||||||
companyUser:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
event_triggers:
|
|
||||||
- name: users-insert-create-company-connection
|
|
||||||
definition:
|
|
||||||
enable_manual: false
|
|
||||||
insert:
|
|
||||||
columns: '*'
|
|
||||||
retry_conf:
|
|
||||||
interval_sec: 10
|
|
||||||
num_retries: 0
|
|
||||||
timeout_sec: 60
|
|
||||||
webhook: '{{NHOST_BACKEND_URL}}/v1/functions/users/insert/create-company-connection'
|
|
||||||
headers:
|
|
||||||
- name: nhost-webhook-secret
|
|
||||||
value_from_env: NHOST_WEBHOOK_SECRET
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
table:
|
|
||||||
name: companies
|
|
||||||
schema: public
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
email_domain:
|
|
||||||
custom_name: emailDomain
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
email_domain: emailDomain
|
|
||||||
updated_at: updatedAt
|
|
||||||
custom_name: companies
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteCompanies
|
|
||||||
delete_by_pk: deleteCompany
|
|
||||||
insert: insertCompanies
|
|
||||||
insert_one: insertCompany
|
|
||||||
select: companies
|
|
||||||
select_aggregate: companiesAggregate
|
|
||||||
select_by_pk: company
|
|
||||||
update: updateCompanies
|
|
||||||
update_by_pk: updateCompany
|
|
||||||
array_relationships:
|
|
||||||
- name: companyUsers
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: company_id
|
|
||||||
table:
|
|
||||||
name: company_users
|
|
||||||
schema: public
|
|
||||||
- name: customers
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: company_id
|
|
||||||
table:
|
|
||||||
name: customers
|
|
||||||
schema: public
|
|
||||||
select_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- name
|
|
||||||
filter:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
table:
|
|
||||||
name: company_users
|
|
||||||
schema: public
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
company_id:
|
|
||||||
custom_name: companyId
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
company_id: companyId
|
|
||||||
created_at: createdAt
|
|
||||||
id: id
|
|
||||||
updated_at: updatedAt
|
|
||||||
user_id: userId
|
|
||||||
custom_name: companyUsers
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteCompanyUsers
|
|
||||||
delete_by_pk: deleteCompanyUser
|
|
||||||
insert: insertCompanyUsers
|
|
||||||
insert_one: insertCompanyUser
|
|
||||||
select: companyUsers
|
|
||||||
select_aggregate: companyUserAggregate
|
|
||||||
select_by_pk: companyUser
|
|
||||||
update: updateCompanyUsers
|
|
||||||
update_by_pk: updateCompanyUser
|
|
||||||
object_relationships:
|
|
||||||
- name: company
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: company_id
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
select_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- company_id
|
|
||||||
- user_id
|
|
||||||
filter:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
table:
|
|
||||||
name: customer_comments
|
|
||||||
schema: public
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
customer_id:
|
|
||||||
custom_name: customerId
|
|
||||||
file_id:
|
|
||||||
custom_name: fileId
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
customer_id: customerId
|
|
||||||
file_id: fileId
|
|
||||||
updated_at: updatedAt
|
|
||||||
user_id: userId
|
|
||||||
custom_name: customerComments
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteCustomerComments
|
|
||||||
delete_by_pk: deleteCustomerComment
|
|
||||||
insert: insertCustomerComments
|
|
||||||
insert_one: insertCustomerComment
|
|
||||||
select: customerComments
|
|
||||||
select_by_pk: customerComment
|
|
||||||
update: updateCustomerComments
|
|
||||||
update_by_pk: updateCustomerComment
|
|
||||||
object_relationships:
|
|
||||||
- name: customer
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: customer_id
|
|
||||||
- name: file
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: file_id
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
insert_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
check:
|
|
||||||
customer:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
set:
|
|
||||||
user_id: x-hasura-user-id
|
|
||||||
columns:
|
|
||||||
- customer_id
|
|
||||||
- file_id
|
|
||||||
- text
|
|
||||||
select_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- created_at
|
|
||||||
- customer_id
|
|
||||||
- file_id
|
|
||||||
- id
|
|
||||||
- text
|
|
||||||
- updated_at
|
|
||||||
- user_id
|
|
||||||
filter:
|
|
||||||
customer:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
update_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns: []
|
|
||||||
filter:
|
|
||||||
customer:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
check: null
|
|
||||||
delete_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
backend_only: false
|
|
||||||
filter:
|
|
||||||
customer:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
table:
|
|
||||||
name: customers
|
|
||||||
schema: public
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
address_line_1:
|
|
||||||
custom_name: addressLine1
|
|
||||||
company_id:
|
|
||||||
custom_name: companyId
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
address_line_1: addressLine1
|
|
||||||
company_id: companyId
|
|
||||||
created_at: createdAt
|
|
||||||
updated_at: updatedAt
|
|
||||||
user_id: userId
|
|
||||||
custom_name: customers
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteCustomers
|
|
||||||
delete_by_pk: deleteCustomer
|
|
||||||
insert: insertCustomers
|
|
||||||
insert_one: insertCustomer
|
|
||||||
select: customers
|
|
||||||
select_aggregate: customersAggregate
|
|
||||||
select_by_pk: customer
|
|
||||||
update: updateCustomers
|
|
||||||
update_by_pk: updateCustomer
|
|
||||||
object_relationships:
|
|
||||||
- name: company
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: company_id
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
array_relationships:
|
|
||||||
- name: customerComments
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: customer_id
|
|
||||||
table:
|
|
||||||
name: customer_comments
|
|
||||||
schema: public
|
|
||||||
insert_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
check:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
set:
|
|
||||||
user_id: x-hasura-user-id
|
|
||||||
columns:
|
|
||||||
- address_line_1
|
|
||||||
- company_id
|
|
||||||
- name
|
|
||||||
select_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- name
|
|
||||||
- address_line_1
|
|
||||||
- company_id
|
|
||||||
- user_id
|
|
||||||
filter:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
table:
|
|
||||||
name: buckets
|
|
||||||
schema: storage
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
cache_control:
|
|
||||||
custom_name: cacheControl
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
download_expiration:
|
|
||||||
custom_name: downloadExpiration
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
max_upload_file_size:
|
|
||||||
custom_name: maxUploadFileSize
|
|
||||||
min_upload_file_size:
|
|
||||||
custom_name: minUploadFileSize
|
|
||||||
presigned_urls_enabled:
|
|
||||||
custom_name: presignedUrlsEnabled
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
custom_column_names:
|
|
||||||
cache_control: cacheControl
|
|
||||||
created_at: createdAt
|
|
||||||
download_expiration: downloadExpiration
|
|
||||||
id: id
|
|
||||||
max_upload_file_size: maxUploadFileSize
|
|
||||||
min_upload_file_size: minUploadFileSize
|
|
||||||
presigned_urls_enabled: presignedUrlsEnabled
|
|
||||||
updated_at: updatedAt
|
|
||||||
custom_name: buckets
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteBuckets
|
|
||||||
delete_by_pk: deleteBucket
|
|
||||||
insert: insertBuckets
|
|
||||||
insert_one: insertBucket
|
|
||||||
select: buckets
|
|
||||||
select_aggregate: bucketsAggregate
|
|
||||||
select_by_pk: bucket
|
|
||||||
update: updateBuckets
|
|
||||||
update_by_pk: updateBucket
|
|
||||||
array_relationships:
|
|
||||||
- name: files
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: bucket_id
|
|
||||||
table:
|
|
||||||
name: files
|
|
||||||
schema: storage
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
table:
|
|
||||||
name: files
|
|
||||||
schema: storage
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
bucket_id:
|
|
||||||
custom_name: bucketId
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
etag:
|
|
||||||
custom_name: etag
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
is_uploaded:
|
|
||||||
custom_name: isUploaded
|
|
||||||
mime_type:
|
|
||||||
custom_name: mimeType
|
|
||||||
name:
|
|
||||||
custom_name: name
|
|
||||||
size:
|
|
||||||
custom_name: size
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
uploaded_by_user_id:
|
|
||||||
custom_name: uploadedByUserId
|
|
||||||
custom_column_names:
|
|
||||||
bucket_id: bucketId
|
|
||||||
created_at: createdAt
|
|
||||||
etag: etag
|
|
||||||
id: id
|
|
||||||
is_uploaded: isUploaded
|
|
||||||
mime_type: mimeType
|
|
||||||
name: name
|
|
||||||
size: size
|
|
||||||
updated_at: updatedAt
|
|
||||||
uploaded_by_user_id: uploadedByUserId
|
|
||||||
custom_name: files
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteFiles
|
|
||||||
delete_by_pk: deleteFile
|
|
||||||
insert: insertFiles
|
|
||||||
insert_one: insertFile
|
|
||||||
select: files
|
|
||||||
select_aggregate: filesAggregate
|
|
||||||
select_by_pk: file
|
|
||||||
update: updateFiles
|
|
||||||
update_by_pk: updateFile
|
|
||||||
object_relationships:
|
|
||||||
- name: bucket
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: bucket_id
|
|
||||||
array_relationships:
|
|
||||||
- name: customerCommentFiles
|
|
||||||
using:
|
|
||||||
manual_configuration:
|
|
||||||
column_mapping:
|
|
||||||
id: file_id
|
|
||||||
insertion_order: null
|
|
||||||
remote_table:
|
|
||||||
name: customer_comments
|
|
||||||
schema: public
|
|
||||||
insert_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
check:
|
|
||||||
_or:
|
|
||||||
- bucket_id:
|
|
||||||
_eq: customerComments
|
|
||||||
columns:
|
|
||||||
- bucket_id
|
|
||||||
- id
|
|
||||||
- mime_type
|
|
||||||
- name
|
|
||||||
select_permissions:
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- bucket_id
|
|
||||||
- name
|
|
||||||
- size
|
|
||||||
- mime_type
|
|
||||||
- etag
|
|
||||||
- is_uploaded
|
|
||||||
- uploaded_by_user_id
|
|
||||||
filter:
|
|
||||||
_or:
|
|
||||||
- customerCommentFiles:
|
|
||||||
customer:
|
|
||||||
company:
|
|
||||||
companyUsers:
|
|
||||||
user_id:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
- "!include auth_provider_requests.yaml"
|
|
||||||
- "!include auth_providers.yaml"
|
|
||||||
- "!include auth_refresh_tokens.yaml"
|
|
||||||
- "!include auth_roles.yaml"
|
|
||||||
- "!include auth_user_authenticators.yaml"
|
|
||||||
- "!include auth_user_providers.yaml"
|
|
||||||
- "!include auth_user_roles.yaml"
|
|
||||||
- "!include auth_users.yaml"
|
|
||||||
- "!include public_companies.yaml"
|
|
||||||
- "!include public_company_users.yaml"
|
|
||||||
- "!include public_customer_comments.yaml"
|
|
||||||
- "!include public_customers.yaml"
|
|
||||||
- "!include storage_buckets.yaml"
|
|
||||||
- "!include storage_files.yaml"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
version: 3
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE "public"."companies";
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
CREATE TABLE "public"."companies" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "name" text NOT NULL, PRIMARY KEY ("id") );
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
|
||||||
RETURNS TRIGGER AS $$
|
|
||||||
DECLARE
|
|
||||||
_new record;
|
|
||||||
BEGIN
|
|
||||||
_new := NEW;
|
|
||||||
_new."updated_at" = NOW();
|
|
||||||
RETURN _new;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
CREATE TRIGGER "set_public_companies_updated_at"
|
|
||||||
BEFORE UPDATE ON "public"."companies"
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
|
||||||
COMMENT ON TRIGGER "set_public_companies_updated_at" ON "public"."companies"
|
|
||||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE "public"."company_users";
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
CREATE TABLE "public"."company_users" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "copmany_id" uuid NOT NULL, "user_id" uuid NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("copmany_id") REFERENCES "public"."companies"("id") ON UPDATE restrict ON DELETE cascade, FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON UPDATE restrict ON DELETE cascade, UNIQUE ("user_id"));
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
|
||||||
RETURNS TRIGGER AS $$
|
|
||||||
DECLARE
|
|
||||||
_new record;
|
|
||||||
BEGIN
|
|
||||||
_new := NEW;
|
|
||||||
_new."updated_at" = NOW();
|
|
||||||
RETURN _new;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
CREATE TRIGGER "set_public_company_users_updated_at"
|
|
||||||
BEFORE UPDATE ON "public"."company_users"
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
|
||||||
COMMENT ON TRIGGER "set_public_company_users_updated_at" ON "public"."company_users"
|
|
||||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE "public"."customers";
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
CREATE TABLE "public"."customers" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "name" text NOT NULL, "address_line_1" text NOT NULL, "company_id" uuid NOT NULL, "user_id" uuid, PRIMARY KEY ("id") , FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON UPDATE restrict ON DELETE cascade, FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON UPDATE restrict ON DELETE set null);
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
|
||||||
RETURNS TRIGGER AS $$
|
|
||||||
DECLARE
|
|
||||||
_new record;
|
|
||||||
BEGIN
|
|
||||||
_new := NEW;
|
|
||||||
_new."updated_at" = NOW();
|
|
||||||
RETURN _new;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
CREATE TRIGGER "set_public_customers_updated_at"
|
|
||||||
BEFORE UPDATE ON "public"."customers"
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
|
||||||
COMMENT ON TRIGGER "set_public_customers_updated_at" ON "public"."customers"
|
|
||||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
alter table "public"."company_users" rename column "company_id" to "copmany_id";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
alter table "public"."company_users" rename column "copmany_id" to "company_id";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE "public"."customer_comments";
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
CREATE TABLE "public"."customer_comments" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "user_id" uuid NOT NULL, "customer_id" uuid NOT NULL, "text" text NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("customer_id") REFERENCES "public"."customers"("id") ON UPDATE restrict ON DELETE cascade, FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON UPDATE restrict ON DELETE cascade);
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
|
||||||
RETURNS TRIGGER AS $$
|
|
||||||
DECLARE
|
|
||||||
_new record;
|
|
||||||
BEGIN
|
|
||||||
_new := NEW;
|
|
||||||
_new."updated_at" = NOW();
|
|
||||||
RETURN _new;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
CREATE TRIGGER "set_public_customer_comments_updated_at"
|
|
||||||
BEFORE UPDATE ON "public"."customer_comments"
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
|
||||||
COMMENT ON TRIGGER "set_public_customer_comments_updated_at" ON "public"."customer_comments"
|
|
||||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
-- Could not auto-generate a down migration.
|
|
||||||
-- Please write an appropriate down migration for the SQL below:
|
|
||||||
-- alter table "public"."customer_comments" add column "file_id" uuid
|
|
||||||
-- null;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user