From 4b847125da98953d527da0d83267fcb85717193b Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sun, 18 Jul 2021 23:12:51 +0800 Subject: [PATCH 1/7] docs: format Installation page Signed-off-by: Wing-Kam Wong --- packages/noco-docs/content/en/index.md | 128 ++++++++++++------------- 1 file changed, 61 insertions(+), 67 deletions(-) diff --git a/packages/noco-docs/content/en/index.md b/packages/noco-docs/content/en/index.md index a9d3c86e72..c83d7e1f93 100644 --- a/packages/noco-docs/content/en/index.md +++ b/packages/noco-docs/content/en/index.md @@ -4,11 +4,10 @@ description: 'Simple installation - takes about three minutes!' position: 0 category: 'Getting started' fullscreen: true -menuTitle: 'Install' +menuTitle: 'Installation' link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme=dark --- - ## Simple installation - takes about three minutes! ### Prerequisites @@ -18,13 +17,8 @@ link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme * [MySql](https://dev.mysql.com/downloads/mysql/) / [Postgres](https://www.postgresql.org/download/) / [SQLserver](https://www.microsoft.com/en-gb/sql-server/sql-server-downloads) / SQLite Database - Nice to haves - Existing schemas can help to create APIs quickly. - - An example database schema can be found : - here - + - An example database schema can be found : here - - ## Quick try ### 1-Click Deploy @@ -46,6 +40,7 @@ link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme ``` + ```bash @@ -53,13 +48,14 @@ link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme ``` + ```bash -git clone https://github.com/nocodb/nocodb-seed -cd nocodb-seed -npm install -npm start + git clone https://github.com/nocodb/nocodb-seed + cd nocodb-seed + npm install + npm start ``` @@ -78,90 +74,88 @@ And connection params for this database can be specified in `NC_DB` environment ## Docker - + -```shell script -docker run -d -p 8080:8080 \ - -e NC_DB="mysql2://host.docker.internal:3306?u=root&p=password&d=d1" \ - -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ - nocodb/nocodb -``` + ```bash + docker run -d -p 8080:8080 \ + -e NC_DB="mysql2://host.docker.internal:3306?u=root&p=password&d=d1" \ + -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ + nocodb/nocodb + ``` + - -```shell script -docker run -d -p 8080:8080 \ - -e NC_DB="pg://host:port?u=user&p=password&d=database" \ - -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ - nocodb/nocodb -``` + + + ```bash + docker run -d -p 8080:8080 \ + -e NC_DB="pg://host:port?u=user&p=password&d=database" \ + -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ + nocodb/nocodb + ``` - - -```shell script -docker run -d -p 8080:8080 \ - -e NC_DB="mssql://host:port?u=user&p=password&d=database" \ - -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ - nocodb/nocodb -``` + + + + ```bash + docker run -d -p 8080:8080 \ + -e NC_DB="mssql://host:port?u=user&p=password&d=database" \ + -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ + nocodb/nocodb + ``` + ## Docker Compose - + + ```bash + git clone https://github.com/nocodb/nocodb + cd docker-compose + cd mysql + docker-compose up + ``` + + -```shell script -git clone https://github.com/nocodb/nocodb -cd docker-compose -cd mysql -docker-compose up -``` - -```shell script -git clone https://github.com/nocodb/nocodb -cd docker-compose -cd pg -docker-compose up -``` + ```bash + git clone https://github.com/nocodb/nocodb + cd docker-compose + cd pg + docker-compose up + ``` - - + -```shell script -git clone https://github.com/nocodb/nocodb -cd docker-compose -cd mssql -docker-compose up -``` - - - - + + ```bash + git clone https://github.com/nocodb/nocodb + cd docker-compose + cd mssql + docker-compose up + ``` + + - - - ### Sample app - # Sample Demos ### Docker deploying with one command -### Using Npx +### Using NPX ### Heroku Deployment - - + \ No newline at end of file From 10baa50b0dbff9823e3b66e26e68068f39e0c576 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sun, 18 Jul 2021 23:41:54 +0800 Subject: [PATCH 2/7] docs: restructure pages Signed-off-by: Wing-Kam Wong --- packages/noco-docs/content/en/index.md | 159 ++---------------- packages/noco-docs/content/en/setup/index.md | 161 +++++++++++++++++++ 2 files changed, 174 insertions(+), 146 deletions(-) create mode 100644 packages/noco-docs/content/en/setup/index.md diff --git a/packages/noco-docs/content/en/index.md b/packages/noco-docs/content/en/index.md index c83d7e1f93..df63d23531 100644 --- a/packages/noco-docs/content/en/index.md +++ b/packages/noco-docs/content/en/index.md @@ -1,161 +1,28 @@ --- -title: 'Setup and Usage' -description: 'Simple installation - takes about three minutes!' +title: 'NocoDB Documentation' +description: 'NocoDB Documentation' position: 0 category: 'Getting started' fullscreen: true -menuTitle: 'Installation' -link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme=dark +menuTitle: 'Introduction' --- -## Simple installation - takes about three minutes! +## Welcome! -### Prerequisites +NocoDB is an open source Airtable alternative. -- __Must haves__ - * [node.js >= 12](https://nodejs.org/en/download) / [Docker](https://www.docker.com/get-started) - * [MySql](https://dev.mysql.com/downloads/mysql/) / [Postgres](https://www.postgresql.org/download/) / [SQLserver](https://www.microsoft.com/en-gb/sql-server/sql-server-downloads) / SQLite Database -- Nice to haves - - Existing schemas can help to create APIs quickly. - - An example database schema can be found : here - -## Quick try -### 1-Click Deploy - - Deploy NocoDB to Heroku with 1-Click - +NocoDB works by connecting to any relational database and transforming them into a smart spreadsheet interface! This allows you to build no-code applications collaboratively with teams. NocoDB currently works with MySQL, PostgreSQL, Microsoft SQL Server, SQLite, Amazon Aurora & MariaDB databases. -### Node app or docker - - - - - - ```bash - npx create-nocodb-app - ``` - - - - - - ```bash - docker run -d --name nocodb -p 8080:8080 nocodb/nocodb - ``` - - - - - - ```bash - git clone https://github.com/nocodb/nocodb-seed - cd nocodb-seed - npm install - npm start - ``` - - - +Also NocoDB's app store allows you to build business workflows on views with combination of Slack, Microsoft Teams, Discord, Twilio, Whatsapp, Email & any 3rd party APIs too. Plus NocoDB provides programmatic access to APIs so that you can build integrations with Zapier / Integromat and custom applications too. +## Architecture +

-# Production Setup -NocoDB requires a database to store metadata of spreadsheets views and external databases. -And connection params for this database can be specified in `NC_DB` environment variable. - - -## Docker - - - - - ```bash - docker run -d -p 8080:8080 \ - -e NC_DB="mysql2://host.docker.internal:3306?u=root&p=password&d=d1" \ - -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ - nocodb/nocodb - ``` - - - - - - ```bash - docker run -d -p 8080:8080 \ - -e NC_DB="pg://host:port?u=user&p=password&d=database" \ - -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ - nocodb/nocodb - ``` - - - - - - ```bash - docker run -d -p 8080:8080 \ - -e NC_DB="mssql://host:port?u=user&p=password&d=database" \ - -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ - nocodb/nocodb - ``` - - - - -## Docker Compose - - - - - ```bash - git clone https://github.com/nocodb/nocodb - cd docker-compose - cd mysql - docker-compose up - ``` - - - - - - ```bash - git clone https://github.com/nocodb/nocodb - cd docker-compose - cd pg - docker-compose up - ``` - - - - - - ```bash - git clone https://github.com/nocodb/nocodb - cd docker-compose - cd mssql - docker-compose up - ``` - - - - -### Sample app - - -# Sample Demos -### Docker deploying with one command - - - -### Using NPX - - - -### Heroku Deployment - \ No newline at end of file +| Project Type | Metadata stored in | Data stored in | +|---------|-----------|--------| +| Create new project | NC_DB | NC_DB | +| Create new project with external DB | NC_DB | External database | \ No newline at end of file diff --git a/packages/noco-docs/content/en/setup/index.md b/packages/noco-docs/content/en/setup/index.md new file mode 100644 index 0000000000..c83d7e1f93 --- /dev/null +++ b/packages/noco-docs/content/en/setup/index.md @@ -0,0 +1,161 @@ +--- +title: 'Setup and Usage' +description: 'Simple installation - takes about three minutes!' +position: 0 +category: 'Getting started' +fullscreen: true +menuTitle: 'Installation' +link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme=dark +--- + +## Simple installation - takes about three minutes! + +### Prerequisites + +- __Must haves__ + * [node.js >= 12](https://nodejs.org/en/download) / [Docker](https://www.docker.com/get-started) + * [MySql](https://dev.mysql.com/downloads/mysql/) / [Postgres](https://www.postgresql.org/download/) / [SQLserver](https://www.microsoft.com/en-gb/sql-server/sql-server-downloads) / SQLite Database +- Nice to haves + - Existing schemas can help to create APIs quickly. + - An example database schema can be found : here + +## Quick try +### 1-Click Deploy + + Deploy NocoDB to Heroku with 1-Click + + +### Node app or docker + + + + + + ```bash + npx create-nocodb-app + ``` + + + + + + ```bash + docker run -d --name nocodb -p 8080:8080 nocodb/nocodb + ``` + + + + + + ```bash + git clone https://github.com/nocodb/nocodb-seed + cd nocodb-seed + npm install + npm start + ``` + + + + + + +
+
+ +# Production Setup +NocoDB requires a database to store metadata of spreadsheets views and external databases. +And connection params for this database can be specified in `NC_DB` environment variable. + + +## Docker + + + + + ```bash + docker run -d -p 8080:8080 \ + -e NC_DB="mysql2://host.docker.internal:3306?u=root&p=password&d=d1" \ + -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ + nocodb/nocodb + ``` + + + + + + ```bash + docker run -d -p 8080:8080 \ + -e NC_DB="pg://host:port?u=user&p=password&d=database" \ + -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ + nocodb/nocodb + ``` + + + + + + ```bash + docker run -d -p 8080:8080 \ + -e NC_DB="mssql://host:port?u=user&p=password&d=database" \ + -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ + nocodb/nocodb + ``` + + + + +## Docker Compose + + + + + ```bash + git clone https://github.com/nocodb/nocodb + cd docker-compose + cd mysql + docker-compose up + ``` + + + + + + ```bash + git clone https://github.com/nocodb/nocodb + cd docker-compose + cd pg + docker-compose up + ``` + + + + + + ```bash + git clone https://github.com/nocodb/nocodb + cd docker-compose + cd mssql + docker-compose up + ``` + + + + +### Sample app + + +# Sample Demos +### Docker deploying with one command + + + +### Using NPX + + + +### Heroku Deployment + \ No newline at end of file From 84e5029bf7d24e92d89be57c0195506bd5bea0ea Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sun, 18 Jul 2021 23:43:54 +0800 Subject: [PATCH 3/7] docs: rename package name Signed-off-by: Wing-Kam Wong --- packages/noco-docs/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/noco-docs/package-lock.json b/packages/noco-docs/package-lock.json index aa3205a2c9..4bc517fb10 100644 --- a/packages/noco-docs/package-lock.json +++ b/packages/noco-docs/package-lock.json @@ -1,5 +1,5 @@ { - "name": "nc-doc-md-theme", + "name": "noco-docs", "version": "1.0.0", "lockfileVersion": 1, "requires": true, From e6648dd7de8c8066f08ccba87e481354aa667369 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sun, 18 Jul 2021 23:44:04 +0800 Subject: [PATCH 4/7] docs: restructure pages Signed-off-by: Wing-Kam Wong --- .../en/apis/graphql/gql-apis-generated.md | 800 -------------- .../en/apis/rest/rest-apis-generated.md | 973 ------------------ packages/noco-docs/content/en/demos.md | 11 - packages/noco-docs/content/en/introduction.md | 36 - packages/noco-docs/content/en/setup/index.md | 161 --- 5 files changed, 1981 deletions(-) delete mode 100644 packages/noco-docs/content/en/apis/graphql/gql-apis-generated.md delete mode 100644 packages/noco-docs/content/en/apis/rest/rest-apis-generated.md delete mode 100644 packages/noco-docs/content/en/demos.md delete mode 100644 packages/noco-docs/content/en/introduction.md delete mode 100644 packages/noco-docs/content/en/setup/index.md diff --git a/packages/noco-docs/content/en/apis/graphql/gql-apis-generated.md b/packages/noco-docs/content/en/apis/graphql/gql-apis-generated.md deleted file mode 100644 index 6945cfced0..0000000000 --- a/packages/noco-docs/content/en/apis/graphql/gql-apis-generated.md +++ /dev/null @@ -1,800 +0,0 @@ ---- -title: 'GraphQL APIs' -position: 2 -category: 'API' -fullscreen: true -menuTitle: 'GraphQL APIs' ---- -# Features -* APIs - * Generates GraphQL APIs for **ANY** MySql, Postgres, MSSQL, Sqlite database :fire: - * Serves GraphQL queries irrespective of naming conventions of primary keys, foreign keys, tables etc :fire: - * Support for composite primary keys :fire: - * Usual suspects : CRUD, List, FindOne, Count, Exists, Distinct - * Pagination - * Sorting - * Column filtering - Fields :fire: - * Row filtering - Where :fire: - * Bulk insert, Bulk delete, Bulk read :fire: - * Relations - automatically detected - * Aggregate functions - * More - * Upload single file - * Upload multiple files - * Download file -* Authentication -* Access Control - - -# GraphQL API Overview - -### Query - -| **Resolver** | **Arguments** | **Returns** | **Description** | -|---|---|---|---| -| [TableName**List**](#tablenamelist) | where: String, limit: Int, offset: Int, sort: String | [TableName] | List of table rows | -| [TableName**Read**](#tablenameread) | id:String | TableName | Get row by primary key | -| [TableName**Exists**](#tablenameexists) | id: String | Boolean | Check row exists by primary key | -| [TableName**FindOne**](#tablenamefindone) | where: String | TableName | Find row by where conditions | -| [TableName**Count**](#tablenamecount) | where: String | Int | Get rows count | -| [TableName**Distinct**](#tablenamedistinct) | columnName: String, where: String, limit: Int, offset: Int, sort: String | [TableName] | Get distinct rows based on provided column names | -| [TableName**GroupBy**](#tablenamegroupby) | fields: String, having: String, limit: Int, offset: Int, sort: String | [TableNameGroupBy] | Group rows by provided columns | -| [TableName**Aggregate**](#tablenameaggregate) | columnName: String!, having: String, limit: Int, offset: Int, sort: String, func: String! | [TableNameAggregate] | Do aggregation based on provided column name aggregate function | -| [TableName**Distribution**](#tablenamedistribution) | min: Int, max: Int, step: Int, steps: String, columnName: String! | [distribution] | Get distributed list | - - -### Mutations - -| **Resolver** | **Arguments** | **Returns** | **Description** | -|---|---|---|---| -| [TableName**Create**](#tablenamecreate) | data:TableNameInput | TableName | Insert row into table | -| [TableName**Update**](#tablenameupdate) | id:String,data:TableNameInput | TableName | Update table row using primary key | -| [TableName**Delete**](#tablenamedelete) | id:String | TableName | Delete table row using primary id | -| [TableName**CreateBulk**](#tabelenamecreatebulk) | data: [TableNameInput] | [Int] | Bulk row insert | -| [TableName**UpdateBulk**](#tablenamebulk) | data: [TableNameInput] | [Int] | Bulk row update | -| [TableName**DeleteBulk**](#tablenamedeletebulk) | data: [TableNameInput] | [Int] | Bulk row delete | - -## Query Arguments - -| **Param** | **Description** | **Default value** |**Example Value**| -|---|---|---|---| -| where | Logical Expression | | `(colName,eq,colValue)~or(colName2,gt,colValue2)`
[Usage: Comparison operators](#comparison-operators)
[Usage: Logical operators](#logical-operators) | -| limit | Number of rows to get(SQL limit value) | 10 | 20 | -| offset | Offset for pagination(SQL offset value) | 0 | 20 | -| sort | Sort column name, where use `-` as prefix for descending sort | | column_name | -| fields | Required column names in result | * | column_name_1,column_name_2 | - -#### Comparison operators - -``` -eq - '=' - (colName,eq,colValue) -not - '!=' - (colName,ne,colValue) -gt - '>' - (colName,gt,colValue) -ge - '>=' - (colName,ge,colValue) -lt - '<' - (colName,lt,colValue) -le - '<=' - (colName,le,colValue) -is - 'is' - (colName,is,true/false/null) -isnot - 'is not' - (colName,isnot,true/false/null) -in - 'in' - (colName,in,val1,val2,val3,val4) -btw - 'between' - (colName,btw,val1,val2) -nbtw - 'not between'- (colName,nbtw,val1,val2) -like - 'like' - (colName,like,%name) -``` - -#### Example use of comparison operators - complex example -``` -PaymentList(where:"(checkNumber,eq,JM555205)~or((amount,gt,200)~and(amount,lt,2000))") -``` - - -#### Logical operators -``` -~or - 'or' -~and - 'and' -~not - 'not' -``` - -### TableNameList - - - - -``` -CountryList { - country_id - country - last_update -} -``` - - - -```json -{ - "data": { - "CountryList": [ - { - "country_id": 1, - "country": "Afghanistan", - "last_update": "1139978640000", - "CityCount": 1 - }, - { - "country_id": 2, - "country": "Algeria", - "last_update": "1139978640000", - "CityCount": 3 - }, - { - "country_id": 3, - "country": "American Samoa", - "last_update": "1139978640000", - "CityCount": 1 - } - ] - } -} -``` - - - - - -#### List + where - - - -``` -{ - CountryList(where:"(country,like,United%)") { - country_id - country - last_update - CityCount - } -} -``` - - - - - -```json -{ - "data": { - "CountryList": [ - { - "country_id": 101, - "country": "United Arab Emirates", - "last_update": "1139958840000", - "CityCount": 3 - }, - { - "country_id": 102, - "country": "United Kingdom", - "last_update": "1139958840000", - "CityCount": 8 - }, - { - "country_id": 103, - "country": "United States", - "last_update": "1139958840000", - "CityCount": 35 - } - ] - } -} -``` - - - - -[Usage : comparison operators](#comparison-operators) - - - - - -#### List + where + sort - - - -``` -{ - CountryList(where:"(country,like,United%)",sort:"-country") { - country_id - country - last_update - CityCount - } -} -``` - - - - -```json -{ - "data": { - "CountryList": [ - { - "country_id": 103, - "country": "United States", - "last_update": "1139958840000", - "CityCount": 35 - }, - { - "country_id": 102, - "country": "United Kingdom", - "last_update": "1139958840000", - "CityCount": 8 - }, - { - "country_id": 101, - "country": "United Arab Emirates", - "last_update": "1139958840000", - "CityCount": 3 - } - ] - } -} -``` - - - - - - - - - - - -#### List + where + sort + offset - - - -``` -{ - CountryList(where:"(country,like,United%)",sort:"-country",offset:1) { - country_id - country - last_update - CityCount - } -} -``` - - - - -```json -{ - "data": { - "CountryList": [ - { - "country_id": 102, - "country": "United Kingdom", - "last_update": "1139958840000", - "CityCount": 8 - }, - { - "country_id": 101, - "country": "United Arab Emirates", - "last_update": "1139958840000", - "CityCount": 3 - } - ] - } -} -``` - - - - - - -#### List + limit - - - - -``` -{ - CountryList(limit:6) { - country - } -} -``` - - - - -```json -{ - "data": { - "CountryList": [ - { - "country": "Afghanistan" - }, - { - "country": "Algeria" - }, - { - "country": "American Samoa" - }, - { - "country": "Angola" - }, - { - "country": "Anguilla" - }, - { - "country": "Argentina" - } - ] - } -} -``` - - - - - - - - -[⤴](#query) - -### TableNameRead - - - -``` - CountryRead(id:"1") { - country_id - country - last_update - } -``` - - - - -```json - "data": { - "CountryRead": { - "country_id": 1, - "country": "Afghanistan", - "last_update": "1139978640000", - "CityCount": 1 - } - } -``` - - - - -[⤴](#query) - -### TableNameExists - - - -``` - CountryExists(id:"1") -``` - - - - -```json - "data": { - "CountryExists": true - } -``` - - - - -[⤴](#query) - -### TableNameFindOne - - - -``` - CountryFindOne(where:"(country_id,eq,1)") { - country_id - country - last_update - CityCount - } -``` - - - - -```json - "data": { - "CountryFindOne": { - "country_id": 1, - "country": "Afghanistan", - "last_update": "1139978640000", - "CityCount": 1 - } - } -``` - - - - -[⤴](#query) - -### TableNameCount - - - -``` -CountryCount -``` - - - - -```json -{ - "data": { - "CountryCount": 109 - } -} -``` - - - - - -[⤴](#query) - -### TableNameDistinct - - - -``` -{ - CountryDistinct(columnName:"last_update",limit:3) { - last_update - } -} -``` - - - - -```json -{ - "data": { - "CountryDistinct": [ - { - "last_update": "1139958840000" - }, - { - "last_update": "1578323893000" - }, - { - "last_update": "1578321201000" - } - ] - } -} -``` - - - - -[⤴](#query) - -### TableNameGroupBy - - - -``` -{ - CountryGroupBy(fields:"last_update",limit:1) { - country_id - country - last_update - count - } -} -``` - - - - -```json -{ - "data": { - "CountryGroupBy": [ - { - "country_id": null, - "country": null, - "last_update": "1139958840000", - "count": 109 - } - ] - } -} -``` - - - - -[⤴](#query) - -### TableNameAggregate - - - -``` -{ - PaymentAggregate(columnName:"amount",func:"min,max,avg,count") { - count - avg - min - } -} -``` - - - - -```json -{ - "data": { - "PaymentAggregate": [ - { - "count": 16048, - "avg": 4.200743, - "min": 0 - } - ] - } -} -``` - -[⤴](#query) - -### TableNameDistribution - - - -``` -{ - PaymentDistribution (columnName:"amount"){ - range - count - } -} -``` - - - - -```json -{ - "data": { - "PaymentDistribution": [ - { - "range": "0-4", - "count": 8302 - }, - { - "range": "5-8", - "count": 3100 - }, - { - "range": "9-11.99", - "count": 371 - } - ] - } -} -``` - - - - -[⤴](#mutations) - -### TableNameCreate - - - -``` -mutation { - CountryCreate(data: {country: "test"}) { - country_id - country - last_update - CityCount - } -} -``` - - - - -```json -{ - "data": { - "CountryCreate": { - "country_id": 10264, - "country": "test", - "last_update": null, - "CityCount": 0 - } - } -} -``` - - - - -[⤴](#mutations) - -### TableNameUpdate - - - -``` -mutation { - CountryUpdate(data: {country: "test_new"}, id: "10264") { - country_id - country - last_update - CityCount - } -} -``` - - - - -```json -{ - "data": { - "CountryUpdate": { - "country_id": null, - "country": null, - "last_update": null, - "CityCount": null - } - } -} -``` - - - - -[⤴](#mutations) - -### TableNameDelete - - - -``` -mutation { - CountryDelete(id: "10264") { - country_id - country - last_update - CityCount - } -} -``` - - - - -```json -{ - "data": { - "CountryDelete": { - "country_id": null, - "country": null, - "last_update": null, - "CityCount": null - } - } -} -``` - - - - -[⤴](#mutations) - -### TableNameCreateBulk - - - -``` -mutation { - CountryCreateBulk(data:[{country:"test 2"},{country:"test 3"}]) -} -``` - - - - -```json -{ - "data": { - "CountryCreateBulk": [ - 10265 - ] - } -} -``` - - - - -[⤴](#mutations) - -### TableNameUpdateBulk - - - -``` -mutation { - CountryUpdateBulk(data: [{country: "test 2", country_id: 10265}, {country: "test 3", country_id: 10266}]) -} -``` - - - - -```json -{ - "data": { - "CountryUpdateBulk": [ - 1, - 1 - ] - } -} -``` - - - - -[⤴](#mutations) - -### TableNameDeleteBulk - - - -``` -mutation { - CountryDeleteBulk(data: [{country_id: 10265}, {country_id: 10266}]) -} -``` - - - - -```json -{ - "data": { - "CountryDeleteBulk": [ - 1, - 1 - ] - } -} -``` - - - diff --git a/packages/noco-docs/content/en/apis/rest/rest-apis-generated.md b/packages/noco-docs/content/en/apis/rest/rest-apis-generated.md deleted file mode 100644 index 64d1c54bce..0000000000 --- a/packages/noco-docs/content/en/apis/rest/rest-apis-generated.md +++ /dev/null @@ -1,973 +0,0 @@ ---- -title: 'REST APIs' -position: 1 -category: 'API' -fullscreen: true -menuTitle: 'REST APIs' ---- -# Table of Content -* [Features](#features) -* [APIs overview](#api-overview) -* [Authentication](#authentication) -* [Access Control](#acess-control) -* [Migrations](#migrations) - -# Features -* **Automatic REST APIs for any SQL database** - * Generates REST APIs for **ANY** MySql, Postgres, MSSQL, Sqlite database :fire: - * Serves APIs irrespective of naming conventions of primary keys, foreign keys, tables etc :fire: - * Support for composite primary keys :fire: - * REST APIs : - * CRUD, List, FindOne, Count, Exists, Distinct (Usual suspects) - * Pagination - * Sorting - * Column filtering - Fields :fire: - * Row filtering - Where :fire: - * Bulk insert, Bulk delete, Bulk read :fire: - * Relations - automatically detected - * Aggregate functions - * More - * Upload single file - * Upload multiple files - * Download file -* **Authentication** -* **Access Control** - - -# API Overview - -| **Method** | **Path** | **Query Params** | **Description** | -|---|---|---|---| -| **GET** | [/api/v1/tableName](#list) | [where, limit, offset, sort, fields](#query-params) | List rows of the table | -| **POST** | [/api/v1/tableName](#create) | | Insert row into table | -| **PUT** | [/api/v1/tableName/:id](#update) | | Update existing row in table | -| **GET** | [/api/v1/tableName/:id](#get-by-primary-key) | | Get row by primary key | -| **GET** | [/api/v1/tableName/:id/exists](#exists) | | Check row with provided primary key exists or not | -| **DELETE** | [/api/v1/tableName/:id](#delete) | | Delete existing row in table | -| **GET** | [/api/v1/tableName/findOne](#find-one) | [where, limit, offset, sort, fields](#query-params) | Find first row which matches the conditions in table | -| **GET** | [/api/v1/tableName/groupby/:columnName](#group-by) | | Group by columns | -| **GET** | [/api/v1/tableName/distribution/:columnName](#distribution) | | Distribute data based on column | -| **GET** | [/api/v1/tableName/distinct/:columnName](#distinct) | | Find distinct column values | -| **GET** | [/api/v1/tableName/aggregate/:columnName](#aggregate) | | Do aggregation on columns | -| **GET** | [/api/v1/tableName/count](#count) | [where](#query-params) | Get total rows count | -| **POST** | [/api/v1/tableName/bulk](#bulk-insert) | | Bulk row insert | -| **PUT** | [/api/v1/tableName/bulk](#bulk-update) | | Bulk row update | -| **DELETE** | [/api/v1/tableName/bulk](#bulk-delete) | | Bulk row delete | - - - - - * tableName - Alias of the corresponding table
- * columnName - Alias of the column in table -
-
- - -### HasMany APIs - -| **Method** | **Path** | **Query Params** | **Description** | -|---|---|---|---| -| **GET** | [/api/v1/tableName/has/childTableName](#with-children) | [where, limit, offset, sort, fields, fields1](#query-params) | List rows of the table with children | -| **GET** | [/api/v1/tableName/:parentId/childTableName](#children-of-parent) | [where, limit, offset, sort, fields, fields1](#query-params) | Get children under a certain parent | -| **POST** | [/api/v1/tableName/:parentId/childTableName](#insert-to-child-table) | | Insert children under a certain parent | -| **GET** | [/api/v1/tableName/:parentId/childTableName/findOne](#findone-under-parent) | where, limit, offset, sort, fields | Find children under a parent with conditions | -| **GET** | [/api/v1/tableName/:parentId/childTableName/count](#child-count) | | Find children count | -| **GET** | [/api/v1/tableName/:parentId/childTableName/:id](#get-child-by-primary-key) | | Find child by id | -| **PUT** | [/api/v1/tableName/:parentId/childTableName/:id](#update-child-by-primary-key) | | Update child by id | - - - - * tableName - Name of the parent table
- * parentId - Id in parent table
- * childTableName - Name of the child table - * id - Id in child table -
-
- -### BelongsTo APIs - -| **Method** | **Path** | **Query Params** | **Description** | -|---|---|---|---| -| **GET** | [/api/v1/childTableName/belongs/parentTablename](#with-parent) | where, limit, offset, sort, fields | List rows of the table with parent | - - - - - * tableName - Name of the parent table
- * childTableName - Name of the child table -
-
- -## Query params - - -| **Name** | **Alias** | **Use case** | **Default value** |**Example value** | -|---|---|---|---|---| -| [where](#comparison-operators) | [w](#comparison-operators) | Complicated where conditions | | `(colName,eq,colValue)~or(colName2,gt,colValue2)`
[Usage: Comparison operators](#comparison-operators)
[Usage: Logical operators](#logical-operators) | -| limit | l | Number of rows to get(SQL limit value) | 10 | 20 | -| offset | o | Offset for pagination(SQL offset value) | 0 | 20 | -| sort | s | Sort by column name, Use `-` as prefix for descending sort | | column_name | -| fields | f | Required column names in result | * | column_name1,column_name2 | -| fields1 | f1 | Required column names in child result | * | column_name1,column_name2 | - -#### Comparison operators - -``` -eq - '=' - (colName,eq,colValue) -not - '!=' - (colName,ne,colValue) -gt - '>' - (colName,gt,colValue) -ge - '>=' - (colName,ge,colValue) -lt - '<' - (colName,lt,colValue) -le - '<=' - (colName,le,colValue) -is - 'is' - (colName,is,true/false/null) -isnot - 'is not' - (colName,isnot,true/false/null) -in - 'in' - (colName,in,val1,val2,val3,val4) -btw - 'between' - (colName,btw,val1,val2) -nbtw - 'not between'- (colName,nbtw,val1,val2) -like - 'like' - (colName,like,%name) -``` - -#### Example use of comparison operators - complex example -``` -/api/payments?where=(checkNumber,eq,JM555205)~or((amount,gt,200)~and(amount,lt,2000)) -``` - -#### Logical operators -``` -~or - 'or' -~and - 'and' -~not - 'not' -``` - - -### Examples - -#### List - - - - - - ```text - GET /api/v1/country - ``` - - - - - ```json -[ - { - "country_id": 1, - "country": "Afghanistan", - "last_update": "2006-02-14T23:14:00.000Z" - } -] - ``` - - - - - -#### List + where - - - - - ```text - GET /api/v1/country?where=(country,like,United%) - ``` - - - - - ```json -[ - { - "country_id": 101, - "country": "United Arab Emirates", - "last_update": "2006-02-15T04:44:00.000Z" - }, - { - "country_id": 102, - "country": "United Kingdom", - "last_update": "2006-02-15T04:44:00.000Z" - }, - { - "country_id": 103, - "country": "United States", - "last_update": "2006-02-15T04:44:00.000Z" - } -] - ``` - - -Usage : comparison operators - -#### List + where + sort - - - - -``` -GET /api/v1/country?where=(country,like,United%)&sort=-country -``` - - - - -``` -[ - { - country_id: 103, - country: "United States", - last_update: "2006-02-15T04:44:00.000Z" - }, - { - country_id: 102, - country: "United Kingdom", - last_update: "2006-02-15T04:44:00.000Z" - }, - { - country_id: 101, - country: "United Arab Emirates", - last_update: "2006-02-15T04:44:00.000Z" - } -] -``` - - - - - -#### List + where + sort + offset - - - - -``` -GET /api/v1/country?where=(country,like,United%)&sort=-country&offset=1 -``` - - - - -```json -[ - { - country_id: 102, - country: "United Kingdom", - last_update: "2006-02-15T04:44:00.000Z" - }, - { - country_id: 101, - country: "United Arab Emirates", - last_update: "2006-02-15T04:44:00.000Z" - } -] -``` - - - - -#### List + limit - - - - - -``` -GET /api/v1/country?limit=6 -``` - - - - -```json -[ - { - "country_id": 1, - "country": "Afghanistan", - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "country_id": 2, - "country": "Algeria", - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "country_id": 3, - "country": "American Samoa", - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "country_id": 4, - "country": "Angola", - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "country_id": 5, - "country": "Anguilla", - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "country_id": 6, - "country": "Argentina", - "last_update": "2006-02-14T23:14:00.000Z" - } -] -``` - - - -[⤴️](#api-overview) - - -### Get By Primary Key - - - - - -``` -GET /api/v1/country/1 -``` - - - - - -```json -{ - "country_id": 1, - "country": "Afghanistan", - "last_update": "2006-02-14T23:14:00.000Z" -} -``` - - - -[⤴️](#api-overview) - - -### Create - - - - - -``` -POST /api/v1/country -``` - -```json -{ - "country": "Afghanistan" -} -``` - - - - - -```json -{ - "country_id": 1, - "country": "Afghanistan", - "last_update": "2006-02-14T23:14:00.000Z" -} -``` - - - - -[⤴️](#api-overview) - - -### Update - - - - -```PUT /api/v1/country/1``` -``` -{ - "country": "Afghanistan1" -} -``` - - - - -```json -{ - "country_id": 1, - "country": "Afghanistan1", - "last_update": "20020-02-14T23:14:00.000Z" -} -``` - - - -[⤴️](#api-overview) - - -### Exists - - - - -``` -DELETE /api/v1/country/1/exists -``` - - - - -```json -true -``` - - -[⤴️](#api-overview) - - -### Delete - - - - - -``` -DELETE /api/v1/country/1 -``` - - - - -```json -1 -``` - - - - - -[⤴️](#api-overview) - - -### Find One - - - - -``` -GET /api/v1/country/findOne?where=(country_id,eq,1) -``` - - - - -```json -{ - "country_id": 1, - "country": "Afghanistan", - "last_update": "2006-02-14T23:14:00.000Z" -} -``` - - - -[⤴️](#api-overview) - - -### Group By - - - - -``` -GET /api/v1/country/groupby/last_update -``` - - - - -```json -[ - { - "count": 109, - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "count": 1, - "last_update": "2020-01-06T15:18:13.000Z" - }, - { - "count": 1, - "last_update": "2020-01-06T14:33:21.000Z" - } -] - ``` - - - -[⤴️](#api-overview) - - -### Distribution - - - - -``` -GET /api/v1/payment/distribution/amount -``` - - - - -```json -[ - { - "count": 8302, - "range": "0-4" - }, - { - "count": 3100, - "range": "5-8" - }, - { - "count": 371, - "range": "9-11.99" - } -] -``` - - - -[⤴️](#api-overview) - - -### Distinct - - - - -``` -GET /api/v1/country/distinct/last_update -``` - - - - -```json -[ - { - "last_update": "2006-02-14T23:14:00.000Z" - }, - { - "last_update": "2020-01-06T15:18:13.000Z" - }, - { - "last_update": "2020-01-06T14:33:21.000Z" - }, - { - "last_update": "2020-01-07T13:42:01.000Z" - } -] -``` - - - -[⤴️](#api-overview) - - -### Aggregate - - - - -``` -GET /api/v1/payment/aggregate/amount?func=min,max,avg,sum,count -``` - - - - -```json -[ - { - "min": 0, - "max": 11.99, - "avg": 4.200743, - "sum": 67413.52, - "count": 16048 - } -] -``` - - - -[⤴️](#api-overview) - - -### Count - - - - -``` -GET /api/v1/country/count -``` - - - - -```json -{ - "count": 161 -} -``` -[⤴️](#api-overview) - - -### Bulk Insert - - - - -```POST /api/v1/country/bulk``` -```json - [ - { - "country": "test 1" - }, - { - "country": "test 2" - } - ] -``` - - - - -```json -[ - 10262 -] -``` - - -[⤴️](#api-overview) - - -### Bulk Update - - - -```PUT /api/v1/country/bulk``` -```json -[ - { - "country_id" : 10261, - "country": "test 3" - }, - { - "country_id" : 10262, - "country": "test 4" - } -] -``` - - - -```json -[ - 1, - 1 -] -``` - - -[⤴️](#api-overview) - - -### Bulk Delete - - - - -```DELETE /api/v1/country/bulk``` -```json -[ - { - "country_id" : 10261 - }, - { - "country_id" : 10262 - } -] -``` - - - -```json -[ - 1, - 1 -] -``` - - -[⤴️](#api-overview) - - -### With Children - - - - -``` -GET /api/v1/country/has/city -``` - - - - -```json -[ - { - "country_id": 1, - "country": "Afghanistan", - "last_update": "2006-02-14T23:14:00.000Z", - "city": [ - { - "city_id": 251, - "city": "Kabul", - "country_id": 1, - "last_update": "2006-02-14T23:15:25.000Z" - }, - ... - ] - } -] -``` - - - -[⤴️](#hasmany-apis) - -### Children of parent - - - - -``` -GET /api/v1/country/1/city -``` - - - - -```json -[ - { - "city_id": 251, - "city": "Kabul", - "country_id": 1, - "last_update": "2006-02-14T23:15:25.000Z" - } -] -``` - - - -[⤴️](#hasmany-apis) - -### Insert to child table - - - - -```POST /api/v1/country/1/city``` -```json - { - "city": "test" - } -``` - - - - -```json -{ - "city": "test", - "country_id": "1", - "city_id": 10000 -} -``` - - - -[⤴️](#hasmany-apis) - -### Findone under parent - - - - -```GET /api/v1/country/1/city/findOne?where=(city,like,ka%)``` - - - - -```json -{ - "city": "test", - "country_id": "1", - "city_id": 10000 -} -``` - - - - -[⤴️](#hasmany-apis) - -### Child count - - - - -``` -GET /api/v1/country/1/city/count -``` - - - - -```json -{ - "count": 37 -} -``` - - - - -[⤴️](#hasmany-apis) - -### Get Child By Primary key - - - - -``` -GET /api/v1/country/1/city/251 -``` - - - - -```json -[ - { - "city_id": 251, - "city": "Kabul", - "country_id": 1, - "last_update": "2006-02-14T23:15:25.000Z" - } -] -``` - - - - -[⤴️](#hasmany-apis) - -### Update Child By Primary key - - - - -```POST /api/v1/country/1/city/251``` -``` -{ - "city": "Kabul-1" -} -``` - - - - -```json -1 -``` - - - - -[⤴️](#hasmany-apis) - -### Get parent and chlidren within - - - - -``` -GET /api/v1/country/has/city -``` - - - - -```json -[ - { - "city_id": 1, - "city": "sdsdsdsd", - "country_id": 87, - "last_update": "2020-01-02T14:50:49.000Z", - "country": { - "country_id": 87, - "country": "Spain", - "last_update": "2006-02-14T23:14:00.000Z" - } - }, - ... -] -``` - - - - -[⤴️](#belongsto-apis) -### Get table and parent class within - - - - -``` -GET /api/v1/city/belongs/country -``` - - - - -```json5 -[ - { - city_id: 1, - city: "A Corua (La Corua)", - country_id: 87, - last_update: "2006-02-15T04:45:25.000Z", - country: { - country_id: 87, - country: "Spain", - last_update: "2006-02-15T04:44:00.000Z" - } -] -``` - - diff --git a/packages/noco-docs/content/en/demos.md b/packages/noco-docs/content/en/demos.md deleted file mode 100644 index 813bf3a27d..0000000000 --- a/packages/noco-docs/content/en/demos.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: 'Demos' -position: 2 -category: 'Demos' -fullscreen: true -menuTitle: 'Demos' ---- - -[Demos](https://nocodb.com/demos) - -