[{"_path":"/getting-started/quick-start","_draft":false,"_partial":false,"_empty":false,"title":"Quick start","description":"Get started with core fundamentals of Avandajs. To get familiar with the essential building blocks of an Avanda application, we'll breakdown the installation to each Avanda Components","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"quick-start"},"children":[{"type":"text","value":"Quick start"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Get started with "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"core fundamentals"}]},{"type":"text","value":" of Avandajs. To get familiar with the essential building blocks of an Avanda application, we'll breakdown the installation to each Avanda Components"}]},{"type":"element","tag":"h2","props":{"id":"language"},"children":[{"type":"text","value":"Language"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"We're in love with "},{"type":"element","tag":"a","props":{"href":"https://www.typescriptlang.org/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"TypeScript"}]},{"type":"text","value":", but above all - we love "},{"type":"element","tag":"a","props":{"href":"https://nodejs.org/en/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Node.js"}]},{"type":"text","value":", utilizing "},{"type":"element","tag":"a","props":{"href":"https://www.npmjs.com/package/esno","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"esno"}]},{"type":"text","value":" to compile in ms. Avanda takes advantage of the latest typescript features and enables custom typing for your application which makes it less prone to errors."}]},{"type":"element","tag":"h2","props":{"id":"prerequisites"},"children":[{"type":"text","value":"Prerequisites"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Please make sure that "},{"type":"element","tag":"a","props":{"href":"https://nodejs.org","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Node.js"}]},{"type":"text","value":" (version >= 16) is installed on your operating system."}]},{"type":"element","tag":"h2","props":{"id":"setup"},"children":[{"type":"text","value":"Setup"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Setting up a new project is quite simple with the "},{"type":"element","tag":"a","props":{"href":"/components/cli/overview"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code-group","props":{"toggle-text":"npm,yarn"},"children":[{"type":"element","tag":"template","props":{"v-slot:npm":""},"children":[{"type":"element","tag":"code","props":{"code":"$ npm install @avanda/cli -g\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ npm install @avanda/cli -g\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:yarn":""},"children":[{"type":"element","tag":"code","props":{"code":"$ yarn global add @avanda/cli\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn global add @avanda/cli\n"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"create-a-new-project"},"children":[{"type":"text","value":"Create a new Project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With "},{"type":"element","tag":"a","props":{"href":"/components/cli/overview"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":" installed, you can create a new Avanda project with the following commands in your OS terminal:"}]},{"type":"element","tag":"code","props":{"code":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Note:"}]},{"type":"text","value":" To create a new project Avanda CLI must be installed."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"project-name"}]},{"type":"text","value":" directory will be created, and boilerplate files will be installed, and a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app/"}]},{"type":"text","value":" directory will be created and populated with several core files for you to get started with."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here's a brief overview of those core files:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Directories/file"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"app"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Core folders for you to work with includes: the controllers, middleware, models, seeders..."}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"build"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This directory contains all "},{"type":"element","tag":"a","props":{"href":"/guide/buid"},"children":[{"type":"text","value":"build"}]},{"type":"text","value":" files created when you build your avanda project"}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"configs"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This directory contains the files you need to configure your database and server"}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":".env"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This contains all your environment variables"}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda.ts"}]},{"type":"text","value":" includes an async function, which will "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"boot"}]},{"type":"text","value":" our application:"}]},{"type":"element","tag":"code","props":{"code":"import Avanda from \"@avanda/cli\";\nimport Models from \"./app/models/.boot\";\nimport Seeders from \"./app/seeders/.boot\";\nimport Commands from \"./app/commands/.boot\";\nimport { Connection } from \"@avanda/app\";\nimport Config from \"./configs/database\";\n\nasync function boot() {\n  return Avanda(Commands, Models, Seeders, await Connection(Config));\n}\n\nboot();\n","filename":"avanda.ts","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import Avanda from \"@avanda/cli\";\nimport Models from \"./app/models/.boot\";\nimport Seeders from \"./app/seeders/.boot\";\nimport Commands from \"./app/commands/.boot\";\nimport { Connection } from \"@avanda/app\";\nimport Config from \"./configs/database\";\n\nasync function boot() {\n  return Avanda(Commands, Models, Seeders, await Connection(Config));\n}\n\nboot();\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"running-the-application"},"children":[{"type":"text","value":"Running the application"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When installation of your app is complete, you can run the following command to install "},{"type":"element","tag":"a","props":{"href":"https://www.npmjs.com/package/esno","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"esno"}]},{"type":"text","value":" for easy compilation of your project."}]},{"type":"element","tag":"code-group","props":{"toggle-text":"npm,yarn"},"children":[{"type":"element","tag":"template","props":{"v-slot:npm":""},"children":[{"type":"element","tag":"code","props":{"code":"$ npm i -g esno\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ npm i -g esno\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:yarn":""},"children":[{"type":"element","tag":"code","props":{"code":"$ yarn global add esno\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn global add esno\n"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Once the installation process is complete, you can run the following command at your OS command prompt to start the application listening for inbound HTTP requests:"}]},{"type":"element","tag":"code","props":{"code":"$ npm run dev\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ npm run dev\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This command will watch your files, automatically recompiling and reloading the server."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This command starts the app with the HTTP server listening on the port defined in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".env"}]},{"type":"text","value":" file. Once the application is running, open your browser and navigate to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"http://localhost:4000/"}]},{"type":"text","value":". You should see the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Hello World!"}]},{"type":"text","value":" message."}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"quick-start"},"children":[{"type":"text","value":"Quick start"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Get started with "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"core fundamentals"}]},{"type":"text","value":" of Avandajs. To get familiar with the essential building blocks of an Avanda application, we'll breakdown the installation to each Avanda Components"}]},{"type":"element","tag":"h2","props":{"id":"language"},"children":[{"type":"text","value":"Language"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"We're in love with "},{"type":"element","tag":"a","props":{"href":"https://www.typescriptlang.org/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"TypeScript"}]},{"type":"text","value":", but above all - we love "},{"type":"element","tag":"a","props":{"href":"https://nodejs.org/en/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Node.js"}]},{"type":"text","value":", utilizing "},{"type":"element","tag":"a","props":{"href":"https://www.npmjs.com/package/esno","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"esno"}]},{"type":"text","value":" to compile in ms. Avanda takes advantage of the latest typescript features and enables custom typing for your application which makes it less prone to errors."}]},{"type":"element","tag":"h2","props":{"id":"prerequisites"},"children":[{"type":"text","value":"Prerequisites"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Please make sure that "},{"type":"element","tag":"a","props":{"href":"https://nodejs.org","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Node.js"}]},{"type":"text","value":" (version >= 16) is installed on your operating system."}]},{"type":"element","tag":"h2","props":{"id":"setup"},"children":[{"type":"text","value":"Setup"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Setting up a new project is quite simple with the "},{"type":"element","tag":"a","props":{"href":"/components/cli/overview"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":"."}]},{"type":"element","tag":"code-group","props":{"toggle-text":"npm,yarn"},"children":[{"type":"element","tag":"template","props":{"v-slot:npm":""},"children":[{"type":"element","tag":"code","props":{"code":"$ npm install @avanda/cli -g\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm install @avanda/cli -g"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:yarn":""},"children":[{"type":"element","tag":"code","props":{"code":"$ yarn global add @avanda/cli\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn global add @avanda/cli"}]}]}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"create-a-new-project"},"children":[{"type":"text","value":"Create a new Project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With "},{"type":"element","tag":"a","props":{"href":"/components/cli/overview"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":" installed, you can create a new Avanda project with the following commands in your OS terminal:"}]},{"type":"element","tag":"code","props":{"code":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ avanda init "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"project-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"cd"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"project-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm install"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Note:"}]},{"type":"text","value":" To create a new project Avanda CLI must be installed."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"project-name"}]},{"type":"text","value":" directory will be created, and boilerplate files will be installed, and a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app/"}]},{"type":"text","value":" directory will be created and populated with several core files for you to get started with."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here's a brief overview of those core files:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Directories/file"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"app"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Core folders for you to work with includes: the controllers, middleware, models, seeders..."}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"build"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This directory contains all "},{"type":"element","tag":"a","props":{"href":"/guide/buid"},"children":[{"type":"text","value":"build"}]},{"type":"text","value":" files created when you build your avanda project"}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"configs"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This directory contains the files you need to configure your database and server"}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":".env"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This contains all your environment variables"}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda.ts"}]},{"type":"text","value":" includes an async function, which will "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"boot"}]},{"type":"text","value":" our application:"}]},{"type":"element","tag":"code","props":{"code":"import Avanda from \"@avanda/cli\";\nimport Models from \"./app/models/.boot\";\nimport Seeders from \"./app/seeders/.boot\";\nimport Commands from \"./app/commands/.boot\";\nimport { Connection } from \"@avanda/app\";\nimport Config from \"./configs/database\";\n\nasync function boot() {\n  return Avanda(Commands, Models, Seeders, await Connection(Config));\n}\n\nboot();\n","filename":"avanda.ts","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/cli"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Models "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"./app/models/.boot"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Seeders "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"./app/seeders/.boot"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Commands "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"./app/commands/.boot"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { Connection } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/app"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Config "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"./configs/database"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"function"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"boot"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Avanda"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(Commands, Models, Seeders, "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Connection"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(Config));"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"boot"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"running-the-application"},"children":[{"type":"text","value":"Running the application"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When installation of your app is complete, you can run the following command to install "},{"type":"element","tag":"a","props":{"href":"https://www.npmjs.com/package/esno","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"esno"}]},{"type":"text","value":" for easy compilation of your project."}]},{"type":"element","tag":"code-group","props":{"toggle-text":"npm,yarn"},"children":[{"type":"element","tag":"template","props":{"v-slot:npm":""},"children":[{"type":"element","tag":"code","props":{"code":"$ npm i -g esno\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm i -g esno"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:yarn":""},"children":[{"type":"element","tag":"code","props":{"code":"$ yarn global add esno\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn global add esno"}]}]}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Once the installation process is complete, you can run the following command at your OS command prompt to start the application listening for inbound HTTP requests:"}]},{"type":"element","tag":"code","props":{"code":"$ npm run dev\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm run dev"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This command will watch your files, automatically recompiling and reloading the server."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This command starts the app with the HTTP server listening on the port defined in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".env"}]},{"type":"text","value":" file. Once the application is running, open your browser and navigate to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"http://localhost:4000/"}]},{"type":"text","value":". You should see the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Hello World!"}]},{"type":"text","value":" message."}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"language","depth":2,"text":"Language"},{"id":"prerequisites","depth":2,"text":"Prerequisites"},{"id":"setup","depth":2,"text":"Setup"},{"id":"create-a-new-project","depth":2,"text":"Create a new Project"},{"id":"running-the-application","depth":2,"text":"Running the application"}]}},"_type":"markdown","_id":"content:1.getting-started:1.quick-start.md","_source":"content","_file":"1.getting-started/1.quick-start.md","_extension":"md"},{"_path":"/getting-started/jump-start","_draft":false,"_partial":false,"_empty":false,"title":"Jump Start","description":"Let's build a basic avanda app to help you get started on your next project","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"jump-start"},"children":[{"type":"text","value":"Jump Start"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Let's build a basic avanda app to help you get started on your next project"}]},{"type":"element","tag":"h2","props":{"id":"prerequisites"},"children":[{"type":"text","value":"Prerequisites"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Please check "},{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start"},"children":[{"type":"text","value":"quick-start"}]},{"type":"text","value":" before you continue"}]},{"type":"element","tag":"h2","props":{"id":"folders-and-files"},"children":[{"type":"text","value":"Folders and files"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After creating your avanda project, avanda automatically generates a starter template for you to work with."}]},{"type":"element","tag":"h2","props":{"id":"configure-your-project"},"children":[{"type":"text","value":"Configure your project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"There is a config folder in the list of folders generated in your starter template which includes "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"database.ts"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"server.ts"}]},{"type":"text","value":" files"}]},{"type":"element","tag":"h4","props":{"id":"database-config"},"children":[{"type":"text","value":"Database Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"database.ts"}]},{"type":"text","value":"is the file for you to configure the type of database you are using in your project. The default type is "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"mysql"}]},{"type":"text","value":",check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm/guide"},"children":[{"type":"text","value":"avanda ORM"}]},{"type":"text","value":" for the types of database avanda supports."}]},{"type":"element","tag":"code","props":{"code":"import {dbConfig,Env} from \"@avanda/app\";\nconst config: dbConfig =  {\n    dbDialect: 'mysql',\n    dbName: Env.get<string>('DB_NAME','test'),\n    dbPassword: Env.get<string>('DB_PASSWORD',''),\n    dbUser: Env.get<string>('DB_USER','root'),\n}\n\nexport default config\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {dbConfig,Env} from \"@avanda/app\";\nconst config: dbConfig =  {\n    dbDialect: 'mysql',\n    dbName: Env.get<string>('DB_NAME','test'),\n    dbPassword: Env.get<string>('DB_PASSWORD',''),\n    dbUser: Env.get<string>('DB_USER','root'),\n}\n\nexport default config\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"server-config"},"children":[{"type":"text","value":"Server Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"server.ts"}]},{"type":"text","value":"file is available for you to configure your "},{"type":"element","tag":"a","props":{"href":"/api/configs/server"},"children":[{"type":"text","value":"server"}]},{"type":"text","value":". Add your client domain to the CORS Whitelist to prevent blocking of requests."}]},{"type":"element","tag":"code","props":{"code":"const config: serverConfig =  {\n    connection: Connection(Config),\n    port: Env.get('PORT',8000),\n    rootPath: '/',\n    CORSWhitelist: Env.get<string>('CORS_WHITELIST',\"http://localhost:3000,http://localhost:4000,\").split(',')\n}\n\nexport default config\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"const config: serverConfig =  {\n    connection: Connection(Config),\n    port: Env.get('PORT',8000),\n    rootPath: '/',\n    CORSWhitelist: Env.get<string>('CORS_WHITELIST',\"http://localhost:3000,http://localhost:4000,\").split(',')\n}\n\nexport default config\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"environment-configuration"},"children":[{"type":"text","value":"Environment configuration"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Environment details include your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Database details"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"JWT details"}]}]},{"type":"element","tag":"h5","props":{"id":"database-details"},"children":[{"type":"text","value":"Database Details"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Connect your database, provide your details"}]},{"type":"element","tag":"code","props":{"code":"DB_HOST=localhost //database host\nDB_USER=root  //database username\nDB_NAME=avanda_starter_test //database name\nDB_PASSWORD=avanda_test // database password\n","filename":".env","language":"js"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"DB_HOST=localhost //database host\nDB_USER=root  //database username\nDB_NAME=avanda_starter_test //database name\nDB_PASSWORD=avanda_test // database password\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/guide/environment-configuration"},"children":[{"type":"text","value":"Environment Configuration"}]},{"type":"text","value":" for more"}]}]},{"type":"element","tag":"h2","props":{"id":"start-building"},"children":[{"type":"text","value":"Start building"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In this section, we will work you through the process of building your app by building a blog post as an example"}]},{"type":"element","tag":"h4","props":{"id":"create-your-necessary-assets"},"children":[{"type":"text","value":"Create your necessary assets"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda create -a BlogPost\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda create -a BlogPost\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This creates all necessary assets for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":", You should have a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"models/BlogPost.ts"}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide"},"children":[{"type":"text","value":"avanda CLI"}]},{"type":"text","value":" for more create options"}]}]},{"type":"element","tag":"h3","props":{"id":"write-your-schema"},"children":[{"type":"text","value":"Write your Schema"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With Avanda you can use SQL without writing SQL, In your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"models/BlogPost"}]},{"type":"text","value":" a boilerplate already exists:"}]},{"type":"element","tag":"code","props":{"code":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    @Column.text({\n        masSize: 20,\n        nullable: true\n    })\n    sample_column?:string;\n}\n","filename":"model/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    @Column.text({\n        masSize: 20,\n        nullable: true\n    })\n    sample_column?:string;\n}\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You can now start adding your necessary columns in the schema, check "},{"type":"element","tag":"a","props":{"href":"/guide/models/schema"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" to see all available columns"}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Above are some columns for a blog post, first column references the user model's "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]},{"type":"text","value":" as a foreign key which is available in your starter template, "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Column"}]},{"type":"text","value":" has different methods you can use depending on the datatype, you must provide the name of the column with a datatype which helps in enforcing datatypes while developing your app."}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/guide/models/schema"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" for more information on Writing your schema"}]}]},{"type":"element","tag":"h3","props":{"id":"install-your-model"},"children":[{"type":"text","value":"Install your model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"On Every schema you write you have to create or install the schema to your database, you can do that with avanda CLI command "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":"\nInstall the two models created "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app install -t User\n$ yarn avanda app install -t BlogPost\n\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda app install -t User\n$ yarn avanda app install -t BlogPost\n\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note you have to install "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" model before the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" because User model was referenced as a foreign key in the BlogPost model"}]}]},{"type":"element","tag":"h3","props":{"id":"seed-your-table"},"children":[{"type":"text","value":"Seed your table"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You have created a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" But the table is empty, you need to add data to your table, that's what we call seed, and the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeders"}]},{"type":"text","value":" folder keeps all the files used for seeding data into your tables in your database."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Seeding data into the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" table, a boilerplate using "},{"type":"element","tag":"a","props":{"href":"https://www.npmjs.com/package/@faker-js/faker","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"fakerjs"}]},{"type":"text","value":" exists in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeders/User.ts"}]},{"type":"text","value":" file"}]},{"type":"element","tag":"code","props":{"code":"import {Seeder} from \"@avanda/orm\"\nimport User from \"../models/User\"\nimport {Hash} from \"@avanda/app\";\nexport default class implements Seeder{\n    async run(faker: Faker.FakerStatic): Promise<void> {\n        await new User().create({\n                    email:faker.internet.email(),\n                    password: await Hash.make(faker.internet.password()),\n                    full_name: faker.name.firstName(),\n                })\n    }\n}\n","filename":"seeders/User.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Seeder} from \"@avanda/orm\"\nimport User from \"../models/User\"\nimport {Hash} from \"@avanda/app\";\nexport default class implements Seeder{\n    async run(faker: Faker.FakerStatic): Promise<void> {\n        await new User().create({\n                    email:faker.internet.email(),\n                    password: await Hash.make(faker.internet.password()),\n                    full_name: faker.name.firstName(),\n                })\n    }\n}\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Then run the avanda CLI seed command on your terminal"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app seed -t User\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda app seed -t User\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This inserts a user with a fake email, password, and full_name to your table in your database, Check "},{"type":"element","tag":"a","props":{"href":"/api/hash"},"children":[{"type":"text","value":"API"}]},{"type":"text","value":" for more on "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Hash"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Now seed your BlogPost, In your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeders/BlogPost.ts"}]},{"type":"text","value":" you can add data by using the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createBulk()"}]},{"type":"text","value":" method created by avanda which accepts an array of objects containing the data you want to seed into the table"}]},{"type":"element","tag":"code","props":{"code":"import {Seeder} from \"@avanda/orm\"\nimport Blog from \"../models/BlogPost\"\nexport default class implements Seeder{\n    async run(faker: Faker.FakerStatic): Promise<void> {\n        await new Blog().createBulk([\n            /*Create multiple data here*/\n            {\n                id: 1,\n                user_id: 1,\n                author: \"John Doe\",\n                title: \"How to use avanda js in the client side\",\n                content: \"Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi accusantium enim ducimus velit quaerat vel itaque exercitationem magnam sequi iusto...\",\n            }\n        ])\n    }\n}\n","filename":"seeders/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Seeder} from \"@avanda/orm\"\nimport Blog from \"../models/BlogPost\"\nexport default class implements Seeder{\n    async run(faker: Faker.FakerStatic): Promise<void> {\n        await new Blog().createBulk([\n            /*Create multiple data here*/\n            {\n                id: 1,\n                user_id: 1,\n                author: \"John Doe\",\n                title: \"How to use avanda js in the client side\",\n                content: \"Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi accusantium enim ducimus velit quaerat vel itaque exercitationem magnam sequi iusto...\",\n            }\n        ])\n    }\n}\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Then run the avanda CLI seed command on your terminal"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app seed -t BlogPost\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda app seed -t BlogPost\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This seeds the data in the array to the table "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" in your database, we omitted the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"tags"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"category"}]},{"type":"text","value":" columns because it we specified in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" "},{"type":"element","tag":"a","props":{"href":"#write-your-schema"},"children":[{"type":"text","value":"Schema"}]},{"type":"text","value":" that they can have initial values of null."}]},{"type":"element","tag":"h3","props":{"id":"controller-functions"},"children":[{"type":"text","value":"Controller functions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda uses functions to communicate with clients, Each Controller is connected to their respective tables in your database. In this section, we use the controller function to store a new BlogPost to your table"}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get, Post} from \"@avanda/http\";\nimport BlogPostModel from \"../models/BlogPost\"\n\nexport default class Blog extends Controller {\n    model?:  BlogPostModel\n    @Get()\n    async get(res: Response,req: Request, model?: Model): Promise<any> {\n        return (await this.model?.first())\n    }\n\n    @Get()\n    async getAll(res: Response,req: Request, model?: Model) {\n        return (await this.model?.all())\n    }\n\n    @Get()\n    async getAllByPage(res: Response,req: Request, model?: Model) {\n        let data = await this.model?.page(request.page,true)\n        response.totalPages = this.model.totalPages\n        response.currentPage = request.page\n        response.perPage = this.model.perPage;\n        return response.success('Data fetched',data)\n    }\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model?.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n\n","filename":"Controllers/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get, Post} from \"@avanda/http\";\nimport BlogPostModel from \"../models/BlogPost\"\n\nexport default class Blog extends Controller {\n    model?:  BlogPostModel\n    @Get()\n    async get(res: Response,req: Request, model?: Model): Promise<any> {\n        return (await this.model?.first())\n    }\n\n    @Get()\n    async getAll(res: Response,req: Request, model?: Model) {\n        return (await this.model?.all())\n    }\n\n    @Get()\n    async getAllByPage(res: Response,req: Request, model?: Model) {\n        let data = await this.model?.page(request.page,true)\n        response.totalPages = this.model.totalPages\n        response.currentPage = request.page\n        response.perPage = this.model.perPage;\n        return response.success('Data fetched',data)\n    }\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model?.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In the above function, we use the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Post()"}]},{"type":"text","value":" to specify the kind of request we are defining a function for, it can also accept middleware as arguments "},{"type":"element","tag":"a","props":{"href":"/guide/middleware"},"children":[{"type":"text","value":"learn more"}]},{"type":"text","value":", then created an asynchronous function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPost"}]},{"type":"text","value":" which accepts Response and Request as arguments. Then get all needed data from the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"req.data"}]},{"type":"text","value":" object which we use in the model "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":" method to create post in the BlogPost table then return the post created."}]},{"type":"element","tag":"h4","props":{"id":"calling-your-controller-functions"},"children":[{"type":"text","value":"Calling your Controller functions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You have created functions in your controllers, but how do we run the function? That is where "},{"type":"element","tag":"a","props":{"href":"https://github.com/avandajs/avandajs","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]},{"type":"text","value":" comes into play, You can use Avanda Json Graph API to call your controller functions from the client side, check "},{"type":"element","tag":"a","props":{"href":"/api/avanda-JSGA/overview"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]}]},{"type":"element","tag":"code","props":{"code":"import Graph from \"../libs/avanda.ts\"\nlet errorMsg = ref(false);\nlet posts = ref(null);\nasync function getPosts() {\n    try {\n        let req = new Graph().service('BlogPost/getAll')\n        post.value = await (await req.get()).getData()\n    } catch (error) {\n        errorMsg.value = error.getMsg()\n    }\n}\nonMounted(() => getPosts())\n","filename":"vue","language":"js"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import Graph from \"../libs/avanda.ts\"\nlet errorMsg = ref(false);\nlet posts = ref(null);\nasync function getPosts() {\n    try {\n        let req = new Graph().service('BlogPost/getAll')\n        post.value = await (await req.get()).getData()\n    } catch (error) {\n        errorMsg.value = error.getMsg()\n    }\n}\nonMounted(() => getPosts())\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The code above calls the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"getAll"}]},{"type":"text","value":" in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]},{"type":"text","value":" which gets all the blog posts in your database."}]},{"type":"element","tag":"code","props":{"code":"@Get()\n    async getAll(response: Response,request: Request, model?: Model) {\n        return (await this.model?.all())\n    }\n","filename":"controller/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Get()\n    async getAll(response: Response,request: Request, model?: Model) {\n        return (await this.model?.all())\n    }\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Now let's create a function to post data to the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPost"}]},{"type":"text","value":" in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]}]},{"type":"element","tag":"code","props":{"code":"    let newPost = ref(null)\n    let errorMsg = ref(null)\n    async function createPostClient() {\n            try {\n                let req = new Graph().service('BlogPost/createPost')\n                newPost.value = await (req.post({\n                    author:{\n                        id: 1,\n                        username: \"Adewale\"\n                    },\n                    title: \"How to use Avanda Graph Api\",\n                    content: \"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Unde, mollitia error magni vero obcaecati quidem rem rerum consequatur reiciendis recusandae perspiciatis porro aut veritatis. Deserunt sed similique ad recusandae vitae!\",\n                    tags: [\"avanda\", \"node\", \"javascript\"]\n                })).getData()\n            } catch (error) {\n                errorMsg.value = error.getMsg()\n            }\n        }\n","filename":"vue","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"    let newPost = ref(null)\n    let errorMsg = ref(null)\n    async function createPostClient() {\n            try {\n                let req = new Graph().service('BlogPost/createPost')\n                newPost.value = await (req.post({\n                    author:{\n                        id: 1,\n                        username: \"Adewale\"\n                    },\n                    title: \"How to use Avanda Graph Api\",\n                    content: \"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Unde, mollitia error magni vero obcaecati quidem rem rerum consequatur reiciendis recusandae perspiciatis porro aut veritatis. Deserunt sed similique ad recusandae vitae!\",\n                    tags: [\"avanda\", \"node\", \"javascript\"]\n                })).getData()\n            } catch (error) {\n                errorMsg.value = error.getMsg()\n            }\n        }\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"We defined the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPostClient"}]},{"type":"text","value":" to call the service "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost/createPost"}]},{"type":"text","value":" which calls the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPost"}]},{"type":"text","value":" in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]},{"type":"text","value":", then creates a new record in the blogPost table in your database"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/api/avanda-JSGA/overview"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]},{"type":"text","value":" for more on using avanda from the client side"}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"jump-start"},"children":[{"type":"text","value":"Jump Start"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Let's build a basic avanda app to help you get started on your next project"}]},{"type":"element","tag":"h2","props":{"id":"prerequisites"},"children":[{"type":"text","value":"Prerequisites"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Please check "},{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start"},"children":[{"type":"text","value":"quick-start"}]},{"type":"text","value":" before you continue"}]},{"type":"element","tag":"h2","props":{"id":"folders-and-files"},"children":[{"type":"text","value":"Folders and files"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After creating your avanda project, avanda automatically generates a starter template for you to work with."}]},{"type":"element","tag":"h2","props":{"id":"configure-your-project"},"children":[{"type":"text","value":"Configure your project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"There is a config folder in the list of folders generated in your starter template which includes "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"database.ts"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"server.ts"}]},{"type":"text","value":" files"}]},{"type":"element","tag":"h4","props":{"id":"database-config"},"children":[{"type":"text","value":"Database Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"database.ts"}]},{"type":"text","value":"is the file for you to configure the type of database you are using in your project. The default type is "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"mysql"}]},{"type":"text","value":",check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm/guide"},"children":[{"type":"text","value":"avanda ORM"}]},{"type":"text","value":" for the types of database avanda supports."}]},{"type":"element","tag":"code","props":{"code":"import {dbConfig,Env} from \"@avanda/app\";\nconst config: dbConfig =  {\n    dbDialect: 'mysql',\n    dbName: Env.get<string>('DB_NAME','test'),\n    dbPassword: Env.get<string>('DB_PASSWORD',''),\n    dbUser: Env.get<string>('DB_USER','root'),\n}\n\nexport default config\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {dbConfig,Env} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/app"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" config"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"dbConfig"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    dbDialect"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"mysql"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    dbName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Env."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":">("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"DB_NAME"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"test"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    dbPassword"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Env."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":">("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"DB_PASSWORD"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"''"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    dbUser"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Env."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":">("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"DB_USER"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"root"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" config"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"server-config"},"children":[{"type":"text","value":"Server Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"server.ts"}]},{"type":"text","value":"file is available for you to configure your "},{"type":"element","tag":"a","props":{"href":"/api/configs/server"},"children":[{"type":"text","value":"server"}]},{"type":"text","value":". Add your client domain to the CORS Whitelist to prevent blocking of requests."}]},{"type":"element","tag":"code","props":{"code":"const config: serverConfig =  {\n    connection: Connection(Config),\n    port: Env.get('PORT',8000),\n    rootPath: '/',\n    CORSWhitelist: Env.get<string>('CORS_WHITELIST',\"http://localhost:3000,http://localhost:4000,\").split(',')\n}\n\nexport default config\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" config"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"serverConfig"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    connection"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Connection"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(Config),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    port"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Env."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"PORT"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"8000"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    rootPath"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"/"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    CORSWhitelist"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Env."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":">("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"CORS_WHITELIST"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"http://localhost:3000,http://localhost:4000,"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"split"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" config"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"environment-configuration"},"children":[{"type":"text","value":"Environment configuration"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Environment details include your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Database details"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"JWT details"}]}]},{"type":"element","tag":"h5","props":{"id":"database-details"},"children":[{"type":"text","value":"Database Details"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Connect your database, provide your details"}]},{"type":"element","tag":"code","props":{"code":"DB_HOST=localhost //database host\nDB_USER=root  //database username\nDB_NAME=avanda_starter_test //database name\nDB_PASSWORD=avanda_test // database password\n","filename":".env","language":"js"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"DB_HOST"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"localhost "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//database host"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"DB_USER"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"root  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//database username"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"DB_NAME"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"avanda_starter_test "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//database name"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"DB_PASSWORD"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"avanda_test "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// database password"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/guide/environment-configuration"},"children":[{"type":"text","value":"Environment Configuration"}]},{"type":"text","value":" for more"}]}]},{"type":"element","tag":"h2","props":{"id":"start-building"},"children":[{"type":"text","value":"Start building"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In this section, we will work you through the process of building your app by building a blog post as an example"}]},{"type":"element","tag":"h4","props":{"id":"create-your-necessary-assets"},"children":[{"type":"text","value":"Create your necessary assets"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda create -a BlogPost\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda create -a BlogPost"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This creates all necessary assets for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":", You should have a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"models/BlogPost.ts"}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide"},"children":[{"type":"text","value":"avanda CLI"}]},{"type":"text","value":" for more create options"}]}]},{"type":"element","tag":"h3","props":{"id":"write-your-schema"},"children":[{"type":"text","value":"Write your Schema"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With Avanda you can use SQL without writing SQL, In your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"models/BlogPost"}]},{"type":"text","value":" a boilerplate already exists:"}]},{"type":"element","tag":"code","props":{"code":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    @Column.text({\n        masSize: 20,\n        nullable: true\n    })\n    sample_column?:string;\n}\n","filename":"model/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        masSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"20"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    sample_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You can now start adding your necessary columns in the schema, check "},{"type":"element","tag":"a","props":{"href":"/guide/models/schema"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" to see all available columns"}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Above are some columns for a blog post, first column references the user model's "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]},{"type":"text","value":" as a foreign key which is available in your starter template, "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Column"}]},{"type":"text","value":" has different methods you can use depending on the datatype, you must provide the name of the column with a datatype which helps in enforcing datatypes while developing your app."}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/guide/models/schema"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":" for more information on Writing your schema"}]}]},{"type":"element","tag":"h3","props":{"id":"install-your-model"},"children":[{"type":"text","value":"Install your model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"On Every schema you write you have to create or install the schema to your database, you can do that with avanda CLI command "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":"\nInstall the two models created "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app install -t User\n$ yarn avanda app install -t BlogPost\n\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app install -t User"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app install -t BlogPost"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note you have to install "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" model before the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" because User model was referenced as a foreign key in the BlogPost model"}]}]},{"type":"element","tag":"h3","props":{"id":"seed-your-table"},"children":[{"type":"text","value":"Seed your table"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You have created a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" But the table is empty, you need to add data to your table, that's what we call seed, and the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeders"}]},{"type":"text","value":" folder keeps all the files used for seeding data into your tables in your database."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Seeding data into the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" table, a boilerplate using "},{"type":"element","tag":"a","props":{"href":"https://www.npmjs.com/package/@faker-js/faker","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"fakerjs"}]},{"type":"text","value":" exists in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeders/User.ts"}]},{"type":"text","value":" file"}]},{"type":"element","tag":"code","props":{"code":"import {Seeder} from \"@avanda/orm\"\nimport User from \"../models/User\"\nimport {Hash} from \"@avanda/app\";\nexport default class implements Seeder{\n    async run(faker: Faker.FakerStatic): Promise<void> {\n        await new User().create({\n                    email:faker.internet.email(),\n                    password: await Hash.make(faker.internet.password()),\n                    full_name: faker.name.firstName(),\n                })\n    }\n}\n","filename":"seeders/User.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Seeder} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Hash} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/app"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"implements"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Seeder"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"run"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"faker"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Faker"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"FakerStatic"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Promise"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"void"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"> {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"create"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    email"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"faker.internet."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"email"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    password"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Hash."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"make"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(faker.internet."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"password"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    full_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" faker.name."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"firstName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(),"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Then run the avanda CLI seed command on your terminal"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app seed -t User\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app seed -t User"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This inserts a user with a fake email, password, and full_name to your table in your database, Check "},{"type":"element","tag":"a","props":{"href":"/api/hash"},"children":[{"type":"text","value":"API"}]},{"type":"text","value":" for more on "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Hash"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Now seed your BlogPost, In your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeders/BlogPost.ts"}]},{"type":"text","value":" you can add data by using the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createBulk()"}]},{"type":"text","value":" method created by avanda which accepts an array of objects containing the data you want to seed into the table"}]},{"type":"element","tag":"code","props":{"code":"import {Seeder} from \"@avanda/orm\"\nimport Blog from \"../models/BlogPost\"\nexport default class implements Seeder{\n    async run(faker: Faker.FakerStatic): Promise<void> {\n        await new Blog().createBulk([\n            /*Create multiple data here*/\n            {\n                id: 1,\n                user_id: 1,\n                author: \"John Doe\",\n                title: \"How to use avanda js in the client side\",\n                content: \"Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi accusantium enim ducimus velit quaerat vel itaque exercitationem magnam sequi iusto...\",\n            }\n        ])\n    }\n}\n","filename":"seeders/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Seeder} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Blog "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/BlogPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"implements"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Seeder"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"run"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"faker"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Faker"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"FakerStatic"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Promise"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"void"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"> {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createBulk"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(["}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"/*Create multiple data here*/"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"John Doe"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"How to use avanda js in the client side"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi accusantium enim ducimus velit quaerat vel itaque exercitationem magnam sequi iusto..."}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        ])"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Then run the avanda CLI seed command on your terminal"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app seed -t BlogPost\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app seed -t BlogPost"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This seeds the data in the array to the table "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" in your database, we omitted the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"tags"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"category"}]},{"type":"text","value":" columns because it we specified in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost"}]},{"type":"text","value":" "},{"type":"element","tag":"a","props":{"href":"#write-your-schema"},"children":[{"type":"text","value":"Schema"}]},{"type":"text","value":" that they can have initial values of null."}]},{"type":"element","tag":"h3","props":{"id":"controller-functions"},"children":[{"type":"text","value":"Controller functions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda uses functions to communicate with clients, Each Controller is connected to their respective tables in your database. In this section, we use the controller function to store a new BlogPost to your table"}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get, Post} from \"@avanda/http\";\nimport BlogPostModel from \"../models/BlogPost\"\n\nexport default class Blog extends Controller {\n    model?:  BlogPostModel\n    @Get()\n    async get(res: Response,req: Request, model?: Model): Promise<any> {\n        return (await this.model?.first())\n    }\n\n    @Get()\n    async getAll(res: Response,req: Request, model?: Model) {\n        return (await this.model?.all())\n    }\n\n    @Get()\n    async getAllByPage(res: Response,req: Request, model?: Model) {\n        let data = await this.model?.page(request.page,true)\n        response.totalPages = this.model.totalPages\n        response.currentPage = request.page\n        response.perPage = this.model.perPage;\n        return response.success('Data fetched',data)\n    }\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model?.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n\n","filename":"Controllers/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get, Post} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogPostModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/BlogPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogPostModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Promise"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"any"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"> {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model?."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"first"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"())"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getAll"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model?."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"())"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getAllByPage"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" data "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model?."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"page"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(request.page,"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        response.totalPages "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model.totalPages"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        response.currentPage "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request.page"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        response.perPage "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model.perPage;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Data fetched"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":",data)"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { blogContent, tags, author, postTitle } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" post "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model?."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"create"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" author.id,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" author.username,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" postTitle,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" blogContent,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" tags,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    });"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"post){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost not created"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost created successfully"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", post); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns post created"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In the above function, we use the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Post()"}]},{"type":"text","value":" to specify the kind of request we are defining a function for, it can also accept middleware as arguments "},{"type":"element","tag":"a","props":{"href":"/guide/middleware"},"children":[{"type":"text","value":"learn more"}]},{"type":"text","value":", then created an asynchronous function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPost"}]},{"type":"text","value":" which accepts Response and Request as arguments. Then get all needed data from the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"req.data"}]},{"type":"text","value":" object which we use in the model "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":" method to create post in the BlogPost table then return the post created."}]},{"type":"element","tag":"h4","props":{"id":"calling-your-controller-functions"},"children":[{"type":"text","value":"Calling your Controller functions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You have created functions in your controllers, but how do we run the function? That is where "},{"type":"element","tag":"a","props":{"href":"https://github.com/avandajs/avandajs","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]},{"type":"text","value":" comes into play, You can use Avanda Json Graph API to call your controller functions from the client side, check "},{"type":"element","tag":"a","props":{"href":"/api/avanda-JSGA/overview"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]}]},{"type":"element","tag":"code","props":{"code":"import Graph from \"../libs/avanda.ts\"\nlet errorMsg = ref(false);\nlet posts = ref(null);\nasync function getPosts() {\n    try {\n        let req = new Graph().service('BlogPost/getAll')\n        post.value = await (await req.get()).getData()\n    } catch (error) {\n        errorMsg.value = error.getMsg()\n    }\n}\nonMounted(() => getPosts())\n","filename":"vue","language":"js"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Graph "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../libs/avanda.ts"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" errorMsg "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"ref"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"false"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" posts "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"ref"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"null"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"function"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getPosts"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"try"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Graph"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"BlogPost/getAll"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        post.value "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"())."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"catch"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" (error) {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        errorMsg.value "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" error."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getMsg"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"onMounted"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getPosts"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"())"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The code above calls the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"getAll"}]},{"type":"text","value":" in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]},{"type":"text","value":" which gets all the blog posts in your database."}]},{"type":"element","tag":"code","props":{"code":"@Get()\n    async getAll(response: Response,request: Request, model?: Model) {\n        return (await this.model?.all())\n    }\n","filename":"controller/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    async "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getAll"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(response: Response,request: Request, model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Model) {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model?."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"())"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Now let's create a function to post data to the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPost"}]},{"type":"text","value":" in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]}]},{"type":"element","tag":"code","props":{"code":"    let newPost = ref(null)\n    let errorMsg = ref(null)\n    async function createPostClient() {\n            try {\n                let req = new Graph().service('BlogPost/createPost')\n                newPost.value = await (req.post({\n                    author:{\n                        id: 1,\n                        username: \"Adewale\"\n                    },\n                    title: \"How to use Avanda Graph Api\",\n                    content: \"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Unde, mollitia error magni vero obcaecati quidem rem rerum consequatur reiciendis recusandae perspiciatis porro aut veritatis. Deserunt sed similique ad recusandae vitae!\",\n                    tags: [\"avanda\", \"node\", \"javascript\"]\n                })).getData()\n            } catch (error) {\n                errorMsg.value = error.getMsg()\n            }\n        }\n","filename":"vue","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" newPost "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"ref"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"null"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" errorMsg "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"ref"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"null"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"function"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPostClient"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"try"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Graph"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"BlogPost/createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                newPost.value "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" (req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                        id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                        username"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Adewale"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    },"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"How to use Avanda Graph Api"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Unde, mollitia error magni vero obcaecati quidem rem rerum consequatur reiciendis recusandae perspiciatis porro aut veritatis. Deserunt sed similique ad recusandae vitae!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ["}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"avanda"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"node"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"javascript"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"]"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                }))."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"catch"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" (error) {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"                errorMsg.value "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" error."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getMsg"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        }"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"We defined the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPostClient"}]},{"type":"text","value":" to call the service "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"BlogPost/createPost"}]},{"type":"text","value":" which calls the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"createPost"}]},{"type":"text","value":" in the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller/BlogPost.ts"}]},{"type":"text","value":", then creates a new record in the blogPost table in your database"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/api/avanda-JSGA/overview"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]},{"type":"text","value":" for more on using avanda from the client side"}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"prerequisites","depth":2,"text":"Prerequisites"},{"id":"folders-and-files","depth":2,"text":"Folders and files"},{"id":"configure-your-project","depth":2,"text":"Configure your project","children":[{"id":"database-config","depth":4,"text":"Database Config"},{"id":"server-config","depth":4,"text":"Server Config"},{"id":"environment-configuration","depth":4,"text":"Environment configuration"}]},{"id":"start-building","depth":2,"text":"Start building","children":[{"id":"create-your-necessary-assets","depth":4,"text":"Create your necessary assets"},{"id":"write-your-schema","depth":3,"text":"Write your Schema"},{"id":"install-your-model","depth":3,"text":"Install your model"},{"id":"seed-your-table","depth":3,"text":"Seed your table"},{"id":"controller-functions","depth":3,"text":"Controller functions","children":[{"id":"calling-your-controller-functions","depth":4,"text":"Calling your Controller functions"}]}]}]}},"_type":"markdown","_id":"content:1.getting-started:2.jump-start.md","_source":"content","_file":"1.getting-started/2.jump-start.md","_extension":"md"},{"_path":"/components/avanda-cli/overview","_draft":false,"_partial":false,"_empty":false,"title":"CLI Overview","description":"The Avanda CLI is the cli module of avandajs, it is required to run any avandajs project. It helps in different ways, creating a new project, serving your project while developing, creaating new folder files, interacting with your database and building your project for production.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"cli-overview"},"children":[{"type":"text","value":"CLI Overview"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"a","props":{"href":"https://github.com/avandajs/cli","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":" is the cli module of avandajs, it is required to run any avandajs project. It helps in different ways, creating a new project, serving your project while developing, creaating new folder files, interacting with your database and building your project for production."}]},{"type":"element","tag":"h2","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"it is recommended to use avanda in project scope, to let yarn run avanda, add avanda to list of commands in your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":" file then run:"}]},{"type":"element","tag":"h4","props":{"id":"local-installation"},"children":[{"type":"text","value":"Local Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For project scope"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda\n"}]}]}]},{"type":"element","tag":"h4","props":{"id":"global-scope"},"children":[{"type":"text","value":"Global Scope"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When avanda cli is "},{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start#setup"},"children":[{"type":"text","value":"installed globally"}]},{"type":"text","value":", you don't need to add it to the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":", you can just run:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda -h\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#commands"},"children":[{"type":"text","value":"guides"}]},{"type":"text","value":" for more info on avanda CLI commands"}]}]},{"type":"element","tag":"h3","props":{"id":"create-a-new-project"},"children":[{"type":"text","value":"Create a new Project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With avanda CLI installed you can create a new project with the following lines of commands"}]},{"type":"element","tag":"code","props":{"code":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start"},"children":[{"type":"text","value":"Learn More About creating a new project"}]}]}]},{"type":"element","tag":"h2","props":{"id":"comands"},"children":[{"type":"text","value":"Comands"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Once installed, you can execute CLI commands from your command line with the prefix "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":". To see the available "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":" commands check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide##commands"},"children":[{"type":"text","value":"Here"}]},{"type":"text","value":" or by entering the following:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda -h\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Get help on an individual command. Substitute any command like "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":", "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#command-overview"},"children":[{"type":"text","value":"etc"}]},{"type":"text","value":" where you see "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" in the example below to get detailed help on that command:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda app -h\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"command-actions"},"children":[{"type":"text","value":"Command actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Command Actions are some verbs you add to your commands to give more intructions to the command, Actions available are mainly for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" command. "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]},{"type":"element","tag":"h3","props":{"id":"command-options"},"children":[{"type":"text","value":"Command Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Cli options are list of options you can tag along with your command to give more intructions to the commands "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"cli-overview"},"children":[{"type":"text","value":"CLI Overview"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"a","props":{"href":"https://github.com/avandajs/cli","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"Avanda CLI"}]},{"type":"text","value":" is the cli module of avandajs, it is required to run any avandajs project. It helps in different ways, creating a new project, serving your project while developing, creaating new folder files, interacting with your database and building your project for production."}]},{"type":"element","tag":"h2","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"it is recommended to use avanda in project scope, to let yarn run avanda, add avanda to list of commands in your "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":" file then run:"}]},{"type":"element","tag":"h4","props":{"id":"local-installation"},"children":[{"type":"text","value":"Local Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For project scope"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"global-scope"},"children":[{"type":"text","value":"Global Scope"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When avanda cli is "},{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start#setup"},"children":[{"type":"text","value":"installed globally"}]},{"type":"text","value":", you don't need to add it to the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"package.json"}]},{"type":"text","value":", you can just run:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda -h"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#commands"},"children":[{"type":"text","value":"guides"}]},{"type":"text","value":" for more info on avanda CLI commands"}]}]},{"type":"element","tag":"h3","props":{"id":"create-a-new-project"},"children":[{"type":"text","value":"Create a new Project"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With avanda CLI installed you can create a new project with the following lines of commands"}]},{"type":"element","tag":"code","props":{"code":"$ avanda init <project-name>\n$ cd <project-name>\n$ npm install\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ avanda init "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"project-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"cd"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"project-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm install"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"a","props":{"href":"/getting-started/quick-start"},"children":[{"type":"text","value":"Learn More About creating a new project"}]}]}]},{"type":"element","tag":"h2","props":{"id":"comands"},"children":[{"type":"text","value":"Comands"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Once installed, you can execute CLI commands from your command line with the prefix "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":". To see the available "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"avanda"}]},{"type":"text","value":" commands check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide##commands"},"children":[{"type":"text","value":"Here"}]},{"type":"text","value":" or by entering the following:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda -h"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Get help on an individual command. Substitute any command like "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":", "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#command-overview"},"children":[{"type":"text","value":"etc"}]},{"type":"text","value":" where you see "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" in the example below to get detailed help on that command:"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app -h\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app -h"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"command-actions"},"children":[{"type":"text","value":"Command actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Command Actions are some verbs you add to your commands to give more intructions to the command, Actions available are mainly for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" command. "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]},{"type":"element","tag":"h3","props":{"id":"command-options"},"children":[{"type":"text","value":"Command Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Cli options are list of options you can tag along with your command to give more intructions to the commands "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/guide#actions"},"children":[{"type":"text","value":"Learn more"}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"installation","depth":2,"text":"Installation","children":[{"id":"local-installation","depth":4,"text":"Local Installation"},{"id":"global-scope","depth":4,"text":"Global Scope"},{"id":"create-a-new-project","depth":3,"text":"Create a new Project"}]},{"id":"comands","depth":2,"text":"Comands","children":[{"id":"command-actions","depth":3,"text":"Command actions"},{"id":"command-options","depth":3,"text":"Command Options"}]}]}},"_type":"markdown","_id":"content:2.components:1.avanda-cli:1.overview.md","_source":"content","_file":"2.components/1.avanda-cli/1.overview.md","_extension":"md"},{"_path":"/components/avanda-cli/guide","_draft":false,"_partial":false,"_empty":false,"title":"CLI Guide","description":"Here are some guides for running commands with Avanda CLI:","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"cli-guide"},"children":[{"type":"text","value":"CLI Guide"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some guides for running commands with Avanda CLI:"}]},{"type":"element","tag":"h2","props":{"id":"commands"},"children":[{"type":"text","value":"Commands"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are the list of some basic commands"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Don't know what asset-types, actions are? Check "},{"type":"element","tag":"a","props":{"href":"#command-arguments"},"children":[{"type":"text","value":"Command Arguments"}]}]}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Command"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Usage"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Automatically generates assets, asset types includes: "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"middleware"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeder"}]},{"type":"text","value":"..etc"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$yarn avanda create <asset-type> <option> <name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"App migration command, executes actions, includes: "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"install"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seed"}]},{"type":"text","value":" ...etc"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app <action> <option> <file-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"init"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Create a new avanda project"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda init <project-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"serve"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Serves your project for development mode with compiling on changes made"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda serve"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"command-arguments"},"children":[{"type":"text","value":"Command Arguments"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"CLI commands accepts some arguments you can tag along to give more intructions to the commands.\nComand Arguments are broken into two parts which are options and Actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some of the command arguments available:"}]},{"type":"element","tag":"h3","props":{"id":"options"},"children":[{"type":"text","value":"Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some of the options available:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Options"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Usage"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-t"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Refers to table or "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":" name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app install -t <model-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-n"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Refers to asset name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda create Model -n <model-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-a"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Mainly used with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":" command to create all necessary assets"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda create -a <asset-name>"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"actions"},"children":[{"type":"text","value":"Actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are mostly paired along the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" command, they are mainly used to interact with your database"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some of the actions available:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Actions"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Usage"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"install"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This is used to install your "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":" Schema to a table, accepts option of table name "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-t"}]},{"type":"text","value":" and name of your model"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app install -t <model-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seed"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Seeds or adds provided data to the Specified table, accepts option of table name "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-t"}]},{"type":"text","value":" and model name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app seed -t <model-name>"}]}]}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"cli-guide"},"children":[{"type":"text","value":"CLI Guide"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some guides for running commands with Avanda CLI:"}]},{"type":"element","tag":"h2","props":{"id":"commands"},"children":[{"type":"text","value":"Commands"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are the list of some basic commands"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Don't know what asset-types, actions are? Check "},{"type":"element","tag":"a","props":{"href":"#command-arguments"},"children":[{"type":"text","value":"Command Arguments"}]}]}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Command"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Usage"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Automatically generates assets, asset types includes: "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"controller"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"middleware"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seeder"}]},{"type":"text","value":"..etc"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$yarn avanda create <asset-type> <option> <name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"App migration command, executes actions, includes: "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"install"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seed"}]},{"type":"text","value":" ...etc"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app <action> <option> <file-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"init"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Create a new avanda project"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda init <project-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"serve"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Serves your project for development mode with compiling on changes made"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda serve"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"command-arguments"},"children":[{"type":"text","value":"Command Arguments"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"CLI commands accepts some arguments you can tag along to give more intructions to the commands.\nComand Arguments are broken into two parts which are options and Actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some of the command arguments available:"}]},{"type":"element","tag":"h3","props":{"id":"options"},"children":[{"type":"text","value":"Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some of the options available:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Options"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Usage"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-t"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Refers to table or "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":" name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app install -t <model-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-n"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Refers to asset name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda create Model -n <model-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-a"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Mainly used with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"create"}]},{"type":"text","value":" command to create all necessary assets"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda create -a <asset-name>"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"actions"},"children":[{"type":"text","value":"Actions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are mostly paired along the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"app"}]},{"type":"text","value":" command, they are mainly used to interact with your database"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some of the actions available:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Actions"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Usage"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"install"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"This is used to install your "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":" Schema to a table, accepts option of table name "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-t"}]},{"type":"text","value":" and name of your model"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app install -t <model-name>"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"seed"}]}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"Seeds or adds provided data to the Specified table, accepts option of table name "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"-t"}]},{"type":"text","value":" and model name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$ yarn avanda app seed -t <model-name>"}]}]}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"commands","depth":2,"text":"Commands","children":[{"id":"command-arguments","depth":3,"text":"Command Arguments"},{"id":"options","depth":3,"text":"Options"},{"id":"actions","depth":3,"text":"Actions"}]}]}},"_type":"markdown","_id":"content:2.components:1.avanda-cli:2.guide.md","_source":"content","_file":"2.components/1.avanda-cli/2.guide.md","_extension":"md"},{"_path":"/components/avanda-orm/getting-started","_draft":false,"_partial":false,"_empty":false,"title":"ORM Guide","description":"Avanda ORM is the building block of a Model, It includes all the pieces you need to create a schema for your model.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"orm-guide"},"children":[{"type":"text","value":"ORM Guide"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda ORM is the building block of a "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":", It includes all the pieces you need to create a schema for your model."}]},{"type":"element","tag":"h2","props":{"id":"define-a-column"},"children":[{"type":"text","value":"Define a column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To define a column in your model to install in your database, Each column accepts column datatype, column datatype options,  name of the column, and a semantic datatype of the column in your model.\nIn every model created an "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]},{"type":"text","value":" is generated as the first column of the model, which accepts a semantic datatype of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"number"}]}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\nexport default class BlogPost extends Model{\n  id?: number;\n  @Column.text()\n  name_of_column?: string;\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\nexport default class BlogPost extends Model{\n  id?: number;\n  @Column.text()\n  name_of_column?: string;\n}\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"column"},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Column"}]},{"type":"text","value":"is use to define the data type of a column in a table, paired with the datatype method suitable for your use case"}]},{"type":"element","tag":"h3","props":{"id":"list-of-columns-datatype"},"children":[{"type":"text","value":"List of Columns Datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of datatype available on Avanda ORM"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"text"},"children":[{"type":"text","value":"Text"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store text or string to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.text()\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text()\nname_of_column?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"integer"},"children":[{"type":"text","value":"Integer"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"integer"}]},{"type":"text","value":" datatype to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.int()\nname_of_column?: number;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"boolean"},"children":[{"type":"text","value":"Boolean"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"boolean"}]},{"type":"text","value":" datatype in a table, and accepts default value of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":"| "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"false"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: boolean =  false;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.int()\nname_of_column?: boolean =  false;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"decimal"},"children":[{"type":"text","value":"Decimal"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQl "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" datatype in a table, and accepts the "},{"type":"element","tag":"a","props":{"href":"#columnOptions"},"children":[{"type":"text","value":"maxSize Option"}]},{"type":"text","value":" to define the floating point"}]},{"type":"element","tag":"code","props":{"code":"@Column.decimal({\n    maxSize:[65,4]\n})\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.decimal({\n    maxSize:[65,4]\n})\nname_of_column?: number;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"enum"},"children":[{"type":"text","value":"Enum"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"enum"}]},{"type":"text","value":" datatype in a table, the limited values of the enum datatype can be used as a type declaration in the semantic datatype which may accept a default value"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum(['value-1','value-2'])\nname_of_column?: 'value-1' | 'value-2' = 'value-2'\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.enum(['value-1','value-2'])\nname_of_column?: 'value-1' | 'value-2' = 'value-2'\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"json"},"children":[{"type":"text","value":"Json"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" datatype in a table, semantic datatype for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" is the type declaration of an object or array in typescript"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum()\nname_of_column?: string\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.enum()\nname_of_column?: string\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"date"},"children":[{"type":"text","value":"Date"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL date datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import Date from '@avanda/orm/dataTypes/Date';\n@Column.date()\nname_of_column?: Date;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import Date from '@avanda/orm/dataTypes/Date';\n@Column.date()\nname_of_column?: Date;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"point"},"children":[{"type":"text","value":"Point"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store Geographic point or location datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import {GeoPoint} from \"@avanda/orm\";\n@Column.point()\nname_of_column?: GeoPoint;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {GeoPoint} from \"@avanda/orm\";\n@Column.point()\nname_of_column?: GeoPoint;\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"column-options"},"children":[{"type":"text","value":"Column Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Column options are arguments passed into the column  datatype to give constraints to the columns on your table"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are a list of columns options available :"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"nullable"},"children":[{"type":"text","value":"nullable"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The default value of any column is a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" value or a default value assigned to the column but in some cases where a column might be empty  "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nullable"}]},{"type":"text","value":" option must be set to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":" to avoid the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" constraint"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n  nullable: true\n})\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n  nullable: true\n})\nname_of_column?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"references"},"children":[{"type":"text","value":"references"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With Avanda ORM linking of tables together is as easy as adding a column option "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"references"}]},{"type":"text","value":" with a new instance of the model you are trying to reference\nIn the following example the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" model is referenced"}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\n\n@Column.int({\n        references: new User()\n})\nname_of_column_id?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\n\n@Column.int({\n        references: new User()\n})\nname_of_column_id?: number;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"maxsize"},"children":[{"type":"text","value":"maxSize"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"maxSize"}]},{"type":"text","value":" option gives the functionality of adding a maximum size of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" columns datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can be used in two ways, First one is using it in "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":" or "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":" datatype as shown below"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: 10 //maximum string length is 10\n})\nname_of_column_id?: string;\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n    maxSize: 10 //maximum string length is 10\n})\nname_of_column_id?: string;\n\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can also be used to define the floating point of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" column datatype"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: [65, 4] //maximum precision is 65 and maximum scale is 4\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n    maxSize: [65, 4] //maximum precision is 65 and maximum scale is 4\n})\nname_of_column_id?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"onupdated"},"children":[{"type":"text","value":"onUpdated"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is updated"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"ondeleted"},"children":[{"type":"text","value":"onDeleted"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is deleted"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index"},"children":[{"type":"text","value":"index"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"index"}]},{"type":"text","value":" option is used to define an index on a column in the model,\nIt accepts an object with "},{"type":"element","tag":"a","props":{"href":"#index-type"},"children":[{"type":"text","value":"type"}]},{"type":"text","value":" and "},{"type":"element","tag":"a","props":{"href":"#index-name"},"children":[{"type":"text","value":"name"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    index: {\n      type: \"UNIQUE\",\n      name: \"unique_name\"\n    }\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Column.text({\n    index: {\n      type: \"UNIQUE\",\n      name: \"unique_name\"\n    }\n})\nname_of_column_id?: string;\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index-options"},"children":[{"type":"text","value":"index options"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of options available for the index column option:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Option"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"type"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"defines the type of index, accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"FULLTEXT"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"SPATIAL"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"gives the index a name accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"string"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"install-your-model"},"children":[{"type":"text","value":"Install your model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After writing your schema you can use the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/overview"},"children":[{"type":"text","value":"avanda CLI"}]},{"type":"text","value":" to install the created model to your database"}]},{"type":"element","tag":"code","props":{"code":"yarn avanda app install <modelName>\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"yarn avanda app install <modelName>\n"}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more on models check "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"here"}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"orm-guide"},"children":[{"type":"text","value":"ORM Guide"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda ORM is the building block of a "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":", It includes all the pieces you need to create a schema for your model."}]},{"type":"element","tag":"h2","props":{"id":"define-a-column"},"children":[{"type":"text","value":"Define a column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To define a column in your model to install in your database, Each column accepts column datatype, column datatype options,  name of the column, and a semantic datatype of the column in your model.\nIn every model created an "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]},{"type":"text","value":" is generated as the first column of the model, which accepts a semantic datatype of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"number"}]}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\nexport default class BlogPost extends Model{\n  id?: number;\n  @Column.text()\n  name_of_column?: string;\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"column"},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"@Column"}]},{"type":"text","value":"is use to define the data type of a column in a table, paired with the datatype method suitable for your use case"}]},{"type":"element","tag":"h3","props":{"id":"list-of-columns-datatype"},"children":[{"type":"text","value":"List of Columns Datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of datatype available on Avanda ORM"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"text"},"children":[{"type":"text","value":"Text"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store text or string to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.text()\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"integer"},"children":[{"type":"text","value":"Integer"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"integer"}]},{"type":"text","value":" datatype to the table"}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" number;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"boolean"},"children":[{"type":"text","value":"Boolean"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"boolean"}]},{"type":"text","value":" datatype in a table, and accepts default value of "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":"| "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"false"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.int()\nname_of_column?: boolean =  false;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" boolean "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"false"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"decimal"},"children":[{"type":"text","value":"Decimal"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQl "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" datatype in a table, and accepts the "},{"type":"element","tag":"a","props":{"href":"#columnOptions"},"children":[{"type":"text","value":"maxSize Option"}]},{"type":"text","value":" to define the floating point"}]},{"type":"element","tag":"code","props":{"code":"@Column.decimal({\n    maxSize:[65,4]\n})\nname_of_column?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"decimal"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    maxSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"["}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"65"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"4"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"]"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" number;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"enum"},"children":[{"type":"text","value":"Enum"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"enum"}]},{"type":"text","value":" datatype in a table, the limited values of the enum datatype can be used as a type declaration in the semantic datatype which may accept a default value"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum(['value-1','value-2'])\nname_of_column?: 'value-1' | 'value-2' = 'value-2'\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"enum"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(["}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"])"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"|"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value-2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"json"},"children":[{"type":"text","value":"Json"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" datatype in a table, semantic datatype for "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"json"}]},{"type":"text","value":" is the type declaration of an object or array in typescript"}]},{"type":"element","tag":"code","props":{"code":"@Column.enum()\nname_of_column?: string\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"enum"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"date"},"children":[{"type":"text","value":"Date"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store SQL date datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import Date from '@avanda/orm/dataTypes/Date';\n@Column.date()\nname_of_column?: Date;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Date "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm/dataTypes/Date"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"date"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Date"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"point"},"children":[{"type":"text","value":"Point"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is used to store Geographic point or location datatype in a table"}]},{"type":"element","tag":"code","props":{"code":"import {GeoPoint} from \"@avanda/orm\";\n@Column.point()\nname_of_column?: GeoPoint;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {GeoPoint} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"point"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" GeoPoint;"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"column-options"},"children":[{"type":"text","value":"Column Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Column options are arguments passed into the column  datatype to give constraints to the columns on your table"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are a list of columns options available :"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"nullable"},"children":[{"type":"text","value":"nullable"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The default value of any column is a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" value or a default value assigned to the column but in some cases where a column might be empty  "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"nullable"}]},{"type":"text","value":" option must be set to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"true"}]},{"type":"text","value":" to avoid the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"NOT NULL"}]},{"type":"text","value":" constraint"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n  nullable: true\n})\nname_of_column?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"references"},"children":[{"type":"text","value":"references"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"With Avanda ORM linking of tables together is as easy as adding a column option "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"references"}]},{"type":"text","value":" with a new instance of the model you are trying to reference\nIn the following example the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"User"}]},{"type":"text","value":" model is referenced"}]},{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\n\n@Column.int({\n        references: new User()\n})\nname_of_column_id?: number;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" number;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"maxsize"},"children":[{"type":"text","value":"maxSize"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"maxSize"}]},{"type":"text","value":" option gives the functionality of adding a maximum size of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" columns datatype"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can be used in two ways, First one is using it in "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":" or "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"int"}]},{"type":"text","value":" datatype as shown below"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: 10 //maximum string length is 10\n})\nname_of_column_id?: string;\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    maxSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"10"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//maximum string length is 10"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It can also be used to define the floating point of a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"decimal"}]},{"type":"text","value":" column datatype"}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    maxSize: [65, 4] //maximum precision is 65 and maximum scale is 4\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    maxSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ["}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"65"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"4"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"] "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//maximum precision is 65 and maximum scale is 4"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"onupdated"},"children":[{"type":"text","value":"onUpdated"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is updated"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"ondeleted"},"children":[{"type":"text","value":"onDeleted"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"accepts a function, which runs when the column is deleted"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index"},"children":[{"type":"text","value":"index"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"index"}]},{"type":"text","value":" option is used to define an index on a column in the model,\nIt accepts an object with "},{"type":"element","tag":"a","props":{"href":"#index-type"},"children":[{"type":"text","value":"type"}]},{"type":"text","value":" and "},{"type":"element","tag":"a","props":{"href":"#index-name"},"children":[{"type":"text","value":"name"}]}]},{"type":"element","tag":"code","props":{"code":"@Column.text({\n    index: {\n      type: \"UNIQUE\",\n      name: \"unique_name\"\n    }\n})\nname_of_column_id?: string;\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    index"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      type"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"unique_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"name_of_column_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" string;"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h4","props":{"id":"index-options"},"children":[{"type":"text","value":"index options"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of options available for the index column option:"}]},{"type":"element","tag":"table","props":{},"children":[{"type":"element","tag":"thead","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Option"}]},{"type":"element","tag":"th","props":{"align":null},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tag":"tbody","props":{},"children":[{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"type"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"defines the type of index, accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"FULLTEXT"}]},{"type":"text","value":", "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"SPATIAL"}]}]}]},{"type":"element","tag":"tr","props":{},"children":[{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"name"}]},{"type":"element","tag":"td","props":{"align":null},"children":[{"type":"text","value":"gives the index a name accepts "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"string"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"install-your-model"},"children":[{"type":"text","value":"Install your model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After writing your schema you can use the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-cli/overview"},"children":[{"type":"text","value":"avanda CLI"}]},{"type":"text","value":" to install the created model to your database"}]},{"type":"element","tag":"code","props":{"code":"yarn avanda app install <modelName>\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"yarn avanda app install "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"modelName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For more on models check "},{"type":"element","tag":"a","props":{"href":"/guide/model"},"children":[{"type":"text","value":"here"}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"define-a-column","depth":2,"text":"Define a column"},{"id":"column","depth":2,"text":"Column","children":[{"id":"list-of-columns-datatype","depth":3,"text":"List of Columns Datatype","children":[{"id":"text","depth":4,"text":"Text"},{"id":"integer","depth":4,"text":"Integer"},{"id":"boolean","depth":4,"text":"Boolean"},{"id":"decimal","depth":4,"text":"Decimal"},{"id":"enum","depth":4,"text":"Enum"},{"id":"json","depth":4,"text":"Json"},{"id":"date","depth":4,"text":"Date"},{"id":"point","depth":4,"text":"Point"}]},{"id":"column-options","depth":3,"text":"Column Options","children":[{"id":"nullable","depth":4,"text":"nullable"},{"id":"references","depth":4,"text":"references"},{"id":"maxsize","depth":4,"text":"maxSize"},{"id":"onupdated","depth":4,"text":"onUpdated"},{"id":"ondeleted","depth":4,"text":"onDeleted"},{"id":"index","depth":4,"text":"index"},{"id":"index-options","depth":4,"text":"index options"}]},{"id":"install-your-model","depth":3,"text":"Install your model"}]}]}},"_type":"markdown","_id":"content:2.components:2.avanda-orm:1.getting-started.md","_source":"content","_file":"2.components/2.avanda-orm/1.getting-started.md","_extension":"md"},{"_path":"/components/avanda-js/client","_draft":false,"_partial":false,"_empty":false,"title":"Request","description":"Avanda Json Graph Api is a Json based graph API built on top of javascript axios and nodejs, this library lets you communicate with the backend controllers and functions, it leverages avanda functions and  nested functions with soem extra options to help you make advance requests to the server.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"request"},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda Json Graph Api is a Json based graph API built on top of javascript axios and nodejs, this library lets you communicate with the backend controllers and functions, it leverages avanda "},{"type":"element","tag":"a","props":{"href":"/guide/controllersfunctions"},"children":[{"type":"text","value":"functions"}]},{"type":"text","value":" and  "},{"type":"element","tag":"a","props":{"href":"/guide/controllers#nested-functions"},"children":[{"type":"text","value":"nested functions"}]},{"type":"text","value":" with soem extra options to help you make advance requests to the server."}]},{"type":"element","tag":"h2","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To install avanda client, you can use npm or yarn package manager"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"npm,yarn,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:npm":""},"children":[{"type":"element","tag":"code","props":{"code":"$ npm install @avanda/avandajs\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ npm install @avanda/avandajs\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:yarn":""},"children":[{"type":"element","tag":"code","props":{"code":"$ yarn global add @avanda/avandajs\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn global add @avanda/avandajs\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"$ flutter pub add avanda\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ flutter pub add avanda\n"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"usage"},"children":[{"type":"text","value":"Usage"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To use avanda client, you need to import it in your project and configure your client"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"import Avanda from \"@avanda/avandajs\";\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import Avanda from \"@avanda/avandajs\";\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"import 'package:avanda/avanda.dart';\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import 'package:avanda/avanda.dart';\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"configuring-avanda-client"},"children":[{"type":"text","value":"Configuring Avanda Client"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda Client has a config method that lets you configure the client, There are two configurations, the first one is an avanda config and the second one is an axios config, the avanda config is the url of the server and the axios config is the axios config, you can read more about axios config "},{"type":"element","tag":"a","props":{"href":"https://axios-http.com/docs/req_config","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h4","props":{"id":"avanda-config"},"children":[{"type":"text","value":"Avanda Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The avanda config is the configuration for the avanda client, it accepts the url of the server and optionally the url of the websocket server url, if you don't pass the websocket url, the client will use the same url as the server url"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAvandaConfig({\n    rootUrl: \"https://avanda-server-url\",\n    wsUrl? : \"https://avanda-web-socket-server-url\" // avanda uses the root url by default\n})\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"Avanda.setAvandaConfig({\n    rootUrl: \"https://avanda-server-url\",\n    wsUrl? : \"https://avanda-web-socket-server-url\" // avanda uses the root url by default\n})\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAvandaConfig({\n    rootUrl: \"https://avanda-server-url\",\n    wsUrl? : \"https://avanda-web-socket-server-url\" // avanda uses the root url by default\n})\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"Avanda.setAvandaConfig({\n    rootUrl: \"https://avanda-server-url\",\n    wsUrl? : \"https://avanda-web-socket-server-url\" // avanda uses the root url by default\n})\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"axios-config"},"children":[{"type":"text","value":"Axios Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The axios config is the configuration for the axios client, it accepts the axios config, you can read more about axios config "},{"type":"element","tag":"a","props":{"href":"https://axios-http.com/docs/req_config","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":", You can pass the bearer token in the axios config, the client will automatically add the bearer token to the request headers to authenticate the request."}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAxiosRequestConfig({\n    baseURL: \"BASE_URL\", // the base url of the server\n    withCredentials: true,\n})\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"Avanda.setAxiosRequestConfig({\n    baseURL: \"BASE_URL\", // the base url of the server\n    withCredentials: true,\n})\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAxiosRequestConfig({\n    baseURL: \"BASE_URL\", // the base url of the server\n    withCredentials: true,\n})\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"Avanda.setAxiosRequestConfig({\n    baseURL: \"BASE_URL\", // the base url of the server\n    withCredentials: true,\n})\n"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"making-requests"},"children":[{"type":"text","value":"Making Requests"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To make a request you need the controller name and the function name, and can be passed into the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"service"}]},{"type":"text","value":" method, in the form "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"text","value":",then the "},{"type":"element","tag":"a","props":{"href":"#request-methods"},"children":[{"type":"text","value":"request method"}]},{"type":"text","value":", You can optionally add more "},{"type":"element","tag":"a","props":{"href":"#request-options"},"children":[{"type":"text","value":"request options"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"request-methods"},"children":[{"type":"text","value":"Request Methods"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the methods you can use to make requests:"}]},{"type":"element","tag":"h4","props":{"id":"get"},"children":[{"type":"text","value":"get()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"get"}]},{"type":"text","value":" request to your avanda server"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"post"},"children":[{"type":"text","value":"post()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"post"}]},{"type":"text","value":" request to your avanda server, it accepts the post data as argument"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").post({key: \"value\"});\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").post({key: \"value\"});\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").post({key: \"value\"})\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").post({key: \"value\"})\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"update"},"children":[{"type":"text","value":"update()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"update"}]},{"type":"text","value":" request to your avanda server, it accepts the update data as argument"}]},{"type":"element","tag":"h4","props":{"id":"delete"},"children":[{"type":"text","value":"delete()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"delete"}]},{"type":"text","value":" request to your avanda server, delete data can be as a query param "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"param"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").delete().param({key: \"value\"});\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").delete().param({key: \"value\"});\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":" await new Avanda.service(\"ControllerName/FunctionName\").delete().param({key: \"value\"});\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":" await new Avanda.service(\"ControllerName/FunctionName\").delete().param({key: \"value\"});\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"request-options"},"children":[{"type":"text","value":"Request Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the options you can optionally use to make requests:"}]},{"type":"element","tag":"h4","props":{"id":"fetch"},"children":[{"type":"text","value":"fetch()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to select the fields you want to fetch from the server, it accepts the fields as the first argument and the nested function request which a new instance of an avanda request as the second argument, the nested function request is optional, you can read more about nested functions "},{"type":"element","tag":"a","props":{"href":"/guide/controllers#nested-functions"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\"field1\", \"field2\");\n\n// with nested function\nawait new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\"field1\", \"field2\");\n\n// with nested function\nawait new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"param"},"children":[{"type":"text","value":"param()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to add query params to your request, it accepts the query params as argument"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().param({key: \"value\"});\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().param({key: \"value\"});\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().param({key: \"value\"});\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().param({key: \"value\"});\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"select"},"children":[{"type":"text","value":"select()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to select the fields you want to fetch from the server,It accepts the fields as the arguments, it is an alias of the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"fetch"}]},{"type":"text","value":" method without a nested function request"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"selectall"},"children":[{"type":"text","value":"selectAll()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to select all the fields you want to fetch from the server,It works the same as the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"select"}]},{"type":"text","value":" method but it selects all the fields in the caseo of an array of objects"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"as"},"children":[{"type":"text","value":"as()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to rename the field name of the nested function request, it accepts the new field name as argument"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n"}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For options on the response object, see "},{"type":"element","tag":"a","props":{"href":"/avanda-js/response"},"children":[{"type":"text","value":"Response Client"}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"request"},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda Json Graph Api is a Json based graph API built on top of javascript axios and nodejs, this library lets you communicate with the backend controllers and functions, it leverages avanda "},{"type":"element","tag":"a","props":{"href":"/guide/controllersfunctions"},"children":[{"type":"text","value":"functions"}]},{"type":"text","value":" and  "},{"type":"element","tag":"a","props":{"href":"/guide/controllers#nested-functions"},"children":[{"type":"text","value":"nested functions"}]},{"type":"text","value":" with soem extra options to help you make advance requests to the server."}]},{"type":"element","tag":"h2","props":{"id":"installation"},"children":[{"type":"text","value":"Installation"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To install avanda client, you can use npm or yarn package manager"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"npm,yarn,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:npm":""},"children":[{"type":"element","tag":"code","props":{"code":"$ npm install @avanda/avandajs\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ npm install @avanda/avandajs"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:yarn":""},"children":[{"type":"element","tag":"code","props":{"code":"$ yarn global add @avanda/avandajs\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn global add @avanda/avandajs"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"$ flutter pub add avanda\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ flutter pub add avanda"}]}]}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"usage"},"children":[{"type":"text","value":"Usage"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To use avanda client, you need to import it in your project and configure your client"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"import Avanda from \"@avanda/avandajs\";\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/avandajs"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"import 'package:avanda/avanda.dart';\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"package:avanda/avanda.dart"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"configuring-avanda-client"},"children":[{"type":"text","value":"Configuring Avanda Client"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda Client has a config method that lets you configure the client, There are two configurations, the first one is an avanda config and the second one is an axios config, the avanda config is the url of the server and the axios config is the axios config, you can read more about axios config "},{"type":"element","tag":"a","props":{"href":"https://axios-http.com/docs/req_config","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"h4","props":{"id":"avanda-config"},"children":[{"type":"text","value":"Avanda Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The avanda config is the configuration for the avanda client, it accepts the url of the server and optionally the url of the websocket server url, if you don't pass the websocket url, the client will use the same url as the server url"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAvandaConfig({\n    rootUrl: \"https://avanda-server-url\",\n    wsUrl? : \"https://avanda-web-socket-server-url\" // avanda uses the root url by default\n})\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"setAvandaConfig"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    rootUrl"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://avanda-server-url"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    wsUrl? "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://avanda-web-socket-server-url"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// avanda uses the root url by default"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAvandaConfig({\n    rootUrl: \"https://avanda-server-url\",\n    wsUrl? : \"https://avanda-web-socket-server-url\" // avanda uses the root url by default\n})\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"setAvandaConfig"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    rootUrl"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://avanda-server-url"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    wsUrl? "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://avanda-web-socket-server-url"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// avanda uses the root url by default"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"axios-config"},"children":[{"type":"text","value":"Axios Config"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The axios config is the configuration for the axios client, it accepts the axios config, you can read more about axios config "},{"type":"element","tag":"a","props":{"href":"https://axios-http.com/docs/req_config","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":", You can pass the bearer token in the axios config, the client will automatically add the bearer token to the request headers to authenticate the request."}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAxiosRequestConfig({\n    baseURL: \"BASE_URL\", // the base url of the server\n    withCredentials: true,\n})\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"setAxiosRequestConfig"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    baseURL"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"BASE_URL"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// the base url of the server"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    withCredentials"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"Avanda.setAxiosRequestConfig({\n    baseURL: \"BASE_URL\", // the base url of the server\n    withCredentials: true,\n})\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"setAxiosRequestConfig"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    baseURL"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"BASE_URL"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// the base url of the server"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    withCredentials"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"making-requests"},"children":[{"type":"text","value":"Making Requests"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"To make a request you need the controller name and the function name, and can be passed into the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"service"}]},{"type":"text","value":" method, in the form "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"text","value":",then the "},{"type":"element","tag":"a","props":{"href":"#request-methods"},"children":[{"type":"text","value":"request method"}]},{"type":"text","value":", You can optionally add more "},{"type":"element","tag":"a","props":{"href":"#request-options"},"children":[{"type":"text","value":"request options"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"request-methods"},"children":[{"type":"text","value":"Request Methods"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the methods you can use to make requests:"}]},{"type":"element","tag":"h4","props":{"id":"get"},"children":[{"type":"text","value":"get()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"get"}]},{"type":"text","value":" request to your avanda server"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get();\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"post"},"children":[{"type":"text","value":"post()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"post"}]},{"type":"text","value":" request to your avanda server, it accepts the post data as argument"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").post({key: \"value\"});\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({key"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"});"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").post({key: \"value\"})\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({key"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"})"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"update"},"children":[{"type":"text","value":"update()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"update"}]},{"type":"text","value":" request to your avanda server, it accepts the update data as argument"}]},{"type":"element","tag":"h4","props":{"id":"delete"},"children":[{"type":"text","value":"delete()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to make "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"delete"}]},{"type":"text","value":" request to your avanda server, delete data can be as a query param "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"param"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").delete().param({key: \"value\"});\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"delete"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"param"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({key"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"});"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":" await new Avanda.service(\"ControllerName/FunctionName\").delete().param({key: \"value\"});\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"delete"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"param"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({key"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"});"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"request-options"},"children":[{"type":"text","value":"Request Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the options you can optionally use to make requests:"}]},{"type":"element","tag":"h4","props":{"id":"fetch"},"children":[{"type":"text","value":"fetch()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to select the fields you want to fetch from the server, it accepts the fields as the first argument and the nested function request which a new instance of an avanda request as the second argument, the nested function request is optional, you can read more about nested functions "},{"type":"element","tag":"a","props":{"href":"/guide/controllers#nested-functions"},"children":[{"type":"text","value":"here"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\"field1\", \"field2\");\n\n// with nested function\nawait new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"fetch"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// with nested function"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"fetch"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Contoller/NestedFunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"as"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"fieldName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"param"},"children":[{"type":"text","value":"param()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to add query params to your request, it accepts the query params as argument"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().param({key: \"value\"});\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"param"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({key"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"});"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().param({key: \"value\"});\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"param"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({key"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"value"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"});"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"select"},"children":[{"type":"text","value":"select()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to select the fields you want to fetch from the server,It accepts the fields as the arguments, it is an alias of the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"fetch"}]},{"type":"text","value":" method without a nested function request"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"select"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"select"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"selectall"},"children":[{"type":"text","value":"selectAll()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to select all the fields you want to fetch from the server,It works the same as the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"select"}]},{"type":"text","value":" method but it selects all the fields in the caseo of an array of objects"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"select"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().select(\"field1\", \"field2\");\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"select"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"as"},"children":[{"type":"text","value":"as()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to rename the field name of the nested function request, it accepts the new field name as argument"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"fetch"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Contoller/NestedFunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"as"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"fieldName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Avanda.service(\"ControllerName/FunctionName\").get().fetch(\n    \"field1\", \"field2\",\n    new Avanda.service(\"Contoller/NestedFunctionName\").as(\"fieldName\")\n);\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"fetch"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"field2"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Contoller/NestedFunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"as"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"fieldName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For options on the response object, see "},{"type":"element","tag":"a","props":{"href":"/avanda-js/response"},"children":[{"type":"text","value":"Response Client"}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"installation","depth":2,"text":"Installation"},{"id":"usage","depth":2,"text":"Usage","children":[{"id":"configuring-avanda-client","depth":3,"text":"Configuring Avanda Client","children":[{"id":"avanda-config","depth":4,"text":"Avanda Config"},{"id":"axios-config","depth":4,"text":"Axios Config"}]}]},{"id":"making-requests","depth":2,"text":"Making Requests","children":[{"id":"request-methods","depth":3,"text":"Request Methods","children":[{"id":"get","depth":4,"text":"get()"},{"id":"post","depth":4,"text":"post()"},{"id":"update","depth":4,"text":"update()"},{"id":"delete","depth":4,"text":"delete()"}]},{"id":"request-options","depth":3,"text":"Request Options","children":[{"id":"fetch","depth":4,"text":"fetch()"},{"id":"param","depth":4,"text":"param()"},{"id":"select","depth":4,"text":"select()"},{"id":"selectall","depth":4,"text":"selectAll()"},{"id":"as","depth":4,"text":"as()"}]}]}]}},"_type":"markdown","_id":"content:2.components:3.avanda-js:1.client.md","_source":"content","_file":"2.components/3.avanda-js/1.client.md","_extension":"md"},{"_path":"/components/avanda-js/response","_draft":false,"_partial":false,"_empty":false,"title":"Response","description":"These is the response object that is returned from the server, it contains the data and the status of the request, it also contains the methods that can be used to manipulate the data before it is returned to the client","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"response"},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These is the response object that is returned from the server, it contains the data and the status of the request, it also contains the methods that can be used to manipulate the data before it is returned to the client"}]},{"type":"element","tag":"h3","props":{"id":"methods"},"children":[{"type":"text","value":"Methods"}]},{"type":"element","tag":"h4","props":{"id":"getdata"},"children":[{"type":"text","value":"getData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to get the data from the response object"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").get();\nlet data = req.getData()\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"let req = await new Avanda.service(\"ControllerName/FunctionName\").get();\nlet data = req.getData()\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").get();\nlet data = req.getData()\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"let req = await new Avanda.service(\"ControllerName/FunctionName\").get();\nlet data = req.getData()\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"getmsg"},"children":[{"type":"text","value":"getMsg()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to get the message from the response object"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getMsg()\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getMsg()\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getMsg()\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getMsg()\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"getstatus"},"children":[{"type":"text","value":"getStatus()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to get the status code from the response object"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getStatus()\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getStatus()\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getStatus()\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getStatus()\n"}]}]}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"response"},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These is the response object that is returned from the server, it contains the data and the status of the request, it also contains the methods that can be used to manipulate the data before it is returned to the client"}]},{"type":"element","tag":"h3","props":{"id":"methods"},"children":[{"type":"text","value":"Methods"}]},{"type":"element","tag":"h4","props":{"id":"getdata"},"children":[{"type":"text","value":"getData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to get the data from the response object"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").get();\nlet data = req.getData()\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" data "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").get();\nlet data = req.getData()\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"();"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" data "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"getmsg"},"children":[{"type":"text","value":"getMsg()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to get the message from the response object"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getMsg()\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(postData);"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getMsg"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getMsg()\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(postData);"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getMsg"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"getstatus"},"children":[{"type":"text","value":"getStatus()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This is use to get the status code from the response object"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"typescript,flutter"},"children":[{"type":"element","tag":"template","props":{"v-slot:typescript":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getStatus()\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(postData);"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getStatus"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:flutter":""},"children":[{"type":"element","tag":"code","props":{"code":"let req = await new Avanda.service(\"ControllerName/FunctionName\").post(postData);\nlet msg = req.getStatus()\n","language":"javascript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Avanda."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"service"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"ControllerName/FunctionName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(postData);"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getStatus"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]}]}]}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"methods","depth":3,"text":"Methods","children":[{"id":"getdata","depth":4,"text":"getData()"},{"id":"getmsg","depth":4,"text":"getMsg()"},{"id":"getstatus","depth":4,"text":"getStatus()"}]}]}},"_type":"markdown","_id":"content:2.components:3.avanda-js:2.response.md","_source":"content","_file":"2.components/3.avanda-js/2.response.md","_extension":"md"},{"_path":"/guide/controllers","_draft":false,"_partial":false,"_empty":false,"title":"Controllers","description":"Controllers are essential in an avanda project, they are functions used to communicate with HTTP requests and manage the activities of the database. Each Controller connects with its respective models, making it easy for the controller to communicate with the database. Requests are made to the controller functions with the Avanda Json Graph Api","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"controllers"},"children":[{"type":"text","value":"Controllers"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Controllers are essential in an avanda project, they are functions used to communicate with HTTP requests and manage the activities of the database. Each Controller connects with its respective "},{"type":"element","tag":"a","props":{"href":"/guide/models"},"children":[{"type":"text","value":"models"}]},{"type":"text","value":", making it easy for the controller to communicate with the database. Requests are made to the "},{"type":"element","tag":"a","props":{"href":"#controller-functions"},"children":[{"type":"text","value":"controller functions"}]},{"type":"text","value":" with the "},{"type":"element","tag":"a","props":{"href":"components/avanda-JSGA/overview"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]}]},{"type":"element","tag":"h2","props":{"id":"create-a-controller"},"children":[{"type":"text","value":"Create a Controller"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It is best practice to make the name of the controller the same as the model you want the controller to connect to"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"A "},{"type":"element","tag":"a","props":{"href":"/guide/models"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":" for the respective controller must exist before creating the controller"}]}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda create controller -n <controller-name> \n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda create controller -n <controller-name> \n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"controller-functions"},"children":[{"type":"text","value":"Controller functions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Functions to communicate with HTTP requests and database, the controller file created by avanda CLI connects the contoller to the respective database model which creates an instance of the model in the controller created"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h3","props":{"id":"define-a-controller-function"},"children":[{"type":"text","value":"Define a controller function"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For every controller function a request type of either a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Get()"}]},{"type":"text","value":" or "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Post()"}]},{"type":"text","value":" request must be specified, which accepts "},{"type":"element","tag":"a","props":{"href":"/guide/middlewares"},"children":[{"type":"text","value":"middlewares"}]},{"type":"text","value":" as arguments, then define the function as an asynchronous function"}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport modelName from \"../models/modelName\"\n\nexport default class ControllerName extends Controller {\n    model?:  modelName\n    /*\n    function getAllData with request type of GET which\n    gets all the data from the connected model\n     */\n    @Get() // request type \n    async getAllData(res: Response,req: Request) {\n        return res.alldata()\n    }\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport modelName from \"../models/modelName\"\n\nexport default class ControllerName extends Controller {\n    model?:  modelName\n    /*\n    function getAllData with request type of GET which\n    gets all the data from the connected model\n     */\n    @Get() // request type \n    async getAllData(res: Response,req: Request) {\n        return res.alldata()\n    }\n}\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"getAllData"}]},{"type":"text","value":" above, request type defined is a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"GET"}]},{"type":"text","value":" request which may accept middleware. The code in the function makes request to the current controller model to get all the data available in the database, then returns the data back to client"}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"controllers"},"children":[{"type":"text","value":"Controllers"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Controllers are essential in an avanda project, they are functions used to communicate with HTTP requests and manage the activities of the database. Each Controller connects with its respective "},{"type":"element","tag":"a","props":{"href":"/guide/models"},"children":[{"type":"text","value":"models"}]},{"type":"text","value":", making it easy for the controller to communicate with the database. Requests are made to the "},{"type":"element","tag":"a","props":{"href":"#controller-functions"},"children":[{"type":"text","value":"controller functions"}]},{"type":"text","value":" with the "},{"type":"element","tag":"a","props":{"href":"components/avanda-JSGA/overview"},"children":[{"type":"text","value":"Avanda Json Graph Api"}]}]},{"type":"element","tag":"h2","props":{"id":"create-a-controller"},"children":[{"type":"text","value":"Create a Controller"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"It is best practice to make the name of the controller the same as the model you want the controller to connect to"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"A "},{"type":"element","tag":"a","props":{"href":"/guide/models"},"children":[{"type":"text","value":"Model"}]},{"type":"text","value":" for the respective controller must exist before creating the controller"}]}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda create controller -n <controller-name> \n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda create controller -n "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"controller-name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"controller-functions"},"children":[{"type":"text","value":"Controller functions"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Functions to communicate with HTTP requests and database, the controller file created by avanda CLI connects the contoller to the respective database model which creates an instance of the model in the controller created"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h3","props":{"id":"define-a-controller-function"},"children":[{"type":"text","value":"Define a controller function"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For every controller function a request type of either a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Get()"}]},{"type":"text","value":" or "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"Post()"}]},{"type":"text","value":" request must be specified, which accepts "},{"type":"element","tag":"a","props":{"href":"/guide/middlewares"},"children":[{"type":"text","value":"middlewares"}]},{"type":"text","value":" as arguments, then define the function as an asynchronous function"}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport modelName from \"../models/modelName\"\n\nexport default class ControllerName extends Controller {\n    model?:  modelName\n    /*\n    function getAllData with request type of GET which\n    gets all the data from the connected model\n     */\n    @Get() // request type \n    async getAllData(res: Response,req: Request) {\n        return res.alldata()\n    }\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" modelName "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/modelName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"ControllerName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"modelName"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"/*"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"    function getAllData with request type of GET which"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"    gets all the data from the connected model"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"     */"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// request type "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getAllData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"alldata"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In the function "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"getAllData"}]},{"type":"text","value":" above, request type defined is a "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"GET"}]},{"type":"text","value":" request which may accept middleware. The code in the function makes request to the current controller model to get all the data available in the database, then returns the data back to client"}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"create-a-controller","depth":2,"text":"Create a Controller"},{"id":"controller-functions","depth":2,"text":"Controller functions","children":[{"id":"define-a-controller-function","depth":3,"text":"Define a controller function"}]}]}},"_type":"markdown","_id":"content:3.guide:1.controllers.md","_source":"content","_file":"3.guide/1.controllers.md","_extension":"md"},{"_path":"/guide/models","_draft":false,"_partial":false,"_empty":false,"title":"Models","description":"Models are SQL tables in your project which enable communication with the database, each model is connected to its respective controller. They are more than just a schema in avanda, they are used to create, read, update, delete and find data in your database.","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"models"},"children":[{"type":"text","value":"Models"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Models are SQL tables in your project which enable communication with the database, each model is connected to its respective controller. They are more than just a schema in avanda, they are used to create, read, update, delete and find data in your database."}]},{"type":"element","tag":"h2","props":{"id":"create-a-model"},"children":[{"type":"text","value":"Create a Model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Creating a model in avanda is the same as creating a table in SQL, keep in mind that each controller must have a model they are connected to."}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda create model -n <modelName> \n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda create model -n <modelName> \n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"model-usage"},"children":[{"type":"text","value":"Model Usage"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"A schema for the model must be created and installed to the database before usage check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm/getting-started"},"children":[{"type":"text","value":"avanda ORM"}]},{"type":"text","value":" for guides on how to write schemas"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After writing or editing the schema, the model must be installed to the database to get started with the created model. Run the following command on your OS terminal to install the model to the database"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app install -t <modelName> \n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"$ yarn avanda app install -t <modelName> \n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Using models in your project is different depending on where they are used"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note: Every instance of a model is a promise and must use the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"await"}]},{"type":"text","value":" syntax"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some guide on using models in your projects:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h3","props":{"id":"usage-in-respective-controller"},"children":[{"type":"text","value":"Usage in Respective Controller"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Every controller has a model attached to it and the model is available for use in the connected controller. So it is used with the keyword "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"this"}]}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n"}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h3","props":{"id":"global-usage"},"children":[{"type":"text","value":"Global usage"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"A new instance of the model needs to called when using a model globally or in a controller that is not connected to the model"}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport Blog from \"../models/Blog\"\nimport UserModel from \"../models/User\"\n\nexport default class User extends Controller {\n    model?:  UserModel\n    @Post()\n    async getAllPostWithUser(res: Response,req: Request){\n        const { user_id_client } = req.data;\n        let allData = await new Blog().where({user_id: user_id_client }).all()\n        if(!post){\n            return res.error(\"Blogs not found\") // if error occurs\n        }\n        return res.success(\"User Blogpost found\", allData); // returns blogpost gotten from the databse\n    }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport Blog from \"../models/Blog\"\nimport UserModel from \"../models/User\"\n\nexport default class User extends Controller {\n    model?:  UserModel\n    @Post()\n    async getAllPostWithUser(res: Response,req: Request){\n        const { user_id_client } = req.data;\n        let allData = await new Blog().where({user_id: user_id_client }).all()\n        if(!post){\n            return res.error(\"Blogs not found\") // if error occurs\n        }\n        return res.success(\"User Blogpost found\", allData); // returns blogpost gotten from the databse\n    }\n\n}\n"}]}]}]},{"type":"element","tag":"h2","props":{"id":"model-options"},"children":[{"type":"text","value":"Model Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Model options are methods paired with an instance of a model to query or perform certain actions to the table in the database"}]},{"type":"element","tag":"h3","props":{"id":"operations-options"},"children":[{"type":"text","value":"Operations Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are model methods used to perform certain operations on a model"}]},{"type":"element","tag":"h4","props":{"id":"create"},"children":[{"type":"text","value":".create()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"creates a new row of data in the table in the database, accepts an object where the key is the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm-getting-started#Column"},"children":[{"type":"text","value":"column_name"}]},{"type":"text","value":" and the value is the value to create"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"update"},"children":[{"type":"text","value":".update()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"updates an existing row of data in the table in the database, accepts an object where the key is the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm-getting-started#Column"},"children":[{"type":"text","value":"column_name"}]},{"type":"text","value":" and the value is the value to update"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { user_id } = req.data;\n    await new User().where({id: user_id }).update({\n      email_verification_token : null // updates the user's email_verification_token to null\n    })\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { user_id } = req.data;\n    await new User().where({id: user_id }).update({\n      email_verification_token : null // updates the user's email_verification_token to null\n    })\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class User extends Model{\n    id?: number;\n\n    @Column.text({\n        index:{\n          type: \"UNIQUE\",\n          name: \"unique_email\"\n        },\n        masSize: 255\n    })\n    email?: string\n\n    @Column.text()\n    password?: string\n\n    @Column.text({\n        nullable: true\n    })\n    email_verification_token?: string\n\n    @Column.text()\n    full_name?: string\n}\n","filename":"models/User.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class User extends Model{\n    id?: number;\n\n    @Column.text({\n        index:{\n          type: \"UNIQUE\",\n          name: \"unique_email\"\n        },\n        masSize: 255\n    })\n    email?: string\n\n    @Column.text()\n    password?: string\n\n    @Column.text({\n        nullable: true\n    })\n    email_verification_token?: string\n\n    @Column.text()\n    full_name?: string\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"delete"},"children":[{"type":"text","value":"delete()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"deletes an existing row of data in the table in the database"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().where({column_name: value }).delete() \n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().where({column_name: value }).delete() \n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async controllerFunction(res: Response, req: Request) {\n    const { user_id } = req.data;\n    await new User().where({id: user_id }).delete() // delete the user with the user_id passed\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async controllerFunction(res: Response, req: Request) {\n    const { user_id } = req.data;\n    await new User().where({id: user_id }).delete() // delete the user with the user_id passed\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"query-options"},"children":[{"type":"text","value":"Query Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of methods to query a model. Other Model options can be tagged along with the query options to factor down the query records"}]},{"type":"element","tag":"h3","props":{"id":"find"},"children":[{"type":"text","value":"find"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"return an object of the first record with the specified "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().find(id)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().find(id)\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const blogWithId await new User().find(some_id) // finds the row in the user model with the id of some_id\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const blogWithId await new User().find(some_id) // finds the row in the user model with the id of some_id\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"findby"},"children":[{"type":"text","value":"findBy"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds and return an object of the first record that fulfill a specified column_name and value. It is an alternative to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".where({col: val}).first()"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().findBy(column_name, value)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().findBy(column_name, value)\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const firstBlogWithUserIdSpecified =  await this.model.findBy(user_id, some_id) // finds the firts blog where the user_id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const firstBlogWithUserIdSpecified =  await this.model.findBy(user_id, some_id) // finds the firts blog where the user_id is equal to the some_id specified\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"findall"},"children":[{"type":"text","value":"findAll"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds and returns an array of records with the specified "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().findAll(id)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().findAll(id)\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allUserWithId =  await this.model.findAll(some_id)// finds all the user where the id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allUserWithId =  await this.model.findAll(some_id)// finds all the user where the id is equal to the some_id specified\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class User extends Model{\n    id?: number;\n\n    @Column.text({\n        index:{\n          type: \"UNIQUE\",\n          name: \"unique_email\"\n        },\n        masSize: 255\n    })\n    email?: string\n\n    @Column.text()\n    password?: string\n\n    @Column.text({\n        nullable: true\n    })\n    email_verification_token?: string\n\n    @Column.text()\n    full_name?: string\n}\n","filename":"models/User.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class User extends Model{\n    id?: number;\n\n    @Column.text({\n        index:{\n          type: \"UNIQUE\",\n          name: \"unique_email\"\n        },\n        masSize: 255\n    })\n    email?: string\n\n    @Column.text()\n    password?: string\n\n    @Column.text({\n        nullable: true\n    })\n    email_verification_token?: string\n\n    @Column.text()\n    full_name?: string\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"findallby"},"children":[{"type":"text","value":"findAllBy"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds and returns all the records that fulfill a specified column_name and value. It is an alternative to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".where({col: val}).all()"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().findAllBy(column_name, value)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().findAllBy(column_name, value)\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allBlogWithUserIdSpecified =  await this.model.findAllBy(user_id, some_id) // finds all the blog where the user_id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allBlogWithUserIdSpecified =  await this.model.findAllBy(user_id, some_id) // finds all the blog where the user_id is equal to the some_id specified\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"where"},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records that fulfill a specified column_name and value. Mostly used with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".first"}]},{"type":"text","value":" to get the first record and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".all"}]},{"type":"text","value":" to get all the records"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().where({column_name: value})\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().where({column_name: value})\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allBlogWithUserIdSpecified =  await this.model.where({user_id: some_id}).all() // finds all the blog where the user_id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allBlogWithUserIdSpecified =  await this.model.where({user_id: some_id}).all() // finds all the blog where the user_id is equal to the some_id specified\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolin"},"children":[{"type":"text","value":"whereColIn"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name has a value that exists inside the specified values array"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColIn(column_name, [value1, value2,...])\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().whereColIn(column_name, [value1, value2,...])\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n      let some_ids = [1,3,5]\n    const allBlogWithUserIdArraySpecified =  await this.model.whereColIn(user_id, some_ids).all() // finds all the blog where the user_id is equal to any of the element in the some_id array\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n      let some_ids = [1,3,5]\n    const allBlogWithUserIdArraySpecified =  await this.model.whereColIn(user_id, some_ids).all() // finds all the blog where the user_id is equal to any of the element in the some_id array\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolnotin"},"children":[{"type":"text","value":"whereColNotIn"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name does not have a value that exists inside the specified values array"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColNotIn(column_name, [value1, value2,...])\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().whereColNotIn(column_name, [value1, value2,...])\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n      let some_ids = [1,3,5]\n    const allBlogWithUserIdArraySpecified =  await this.model.whereColNotIn(user_id, some_ids).all() // finds all the blog where the user_id is not equal to any of the element in the some_id array\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n      let some_ids = [1,3,5]\n    const allBlogWithUserIdArraySpecified =  await this.model.whereColNotIn(user_id, some_ids).all() // finds all the blog where the user_id is not equal to any of the element in the some_id array\n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolisnull"},"children":[{"type":"text","value":"whereColIsNull"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name value is null"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColIsNull(column_name)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().whereColIsNull(column_name)\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const allBlogWithTagsNull =  await this.model.whereColIsNull(tags).all() // finds all the blog where the tags column value is null \n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const allBlogWithTagsNull =  await this.model.whereColIsNull(tags).all() // finds all the blog where the tags column value is null \n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolisnotnull"},"children":[{"type":"text","value":"whereColIsNotNull"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name value is  not null"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColIsNotNull(column_name)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"await new Model().whereColIsNotNull(column_name)\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const allBlogWithTagsNull =  await this.model.whereColIsNotNull(tags).all() // finds all the blog where the tags column value is null \n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const allBlogWithTagsNull =  await this.model.whereColIsNotNull(tags).all() // finds all the blog where the tags column value is null \n  }\n\n}\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n"}]}]}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"models"},"children":[{"type":"text","value":"Models"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Models are SQL tables in your project which enable communication with the database, each model is connected to its respective controller. They are more than just a schema in avanda, they are used to create, read, update, delete and find data in your database."}]},{"type":"element","tag":"h2","props":{"id":"create-a-model"},"children":[{"type":"text","value":"Create a Model"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Creating a model in avanda is the same as creating a table in SQL, keep in mind that each controller must have a model they are connected to."}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda create model -n <modelName> \n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda create model -n "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"modelName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"model-usage"},"children":[{"type":"text","value":"Model Usage"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"A schema for the model must be created and installed to the database before usage check "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm/getting-started"},"children":[{"type":"text","value":"avanda ORM"}]},{"type":"text","value":" for guides on how to write schemas"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"After writing or editing the schema, the model must be installed to the database to get started with the created model. Run the following command on your OS terminal to install the model to the database"}]},{"type":"element","tag":"code","props":{"code":"$ yarn avanda app install -t <modelName> \n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"$ yarn avanda app install -t "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"<"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"modelName"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":">"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Using models in your project is different depending on where they are used"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note: Every instance of a model is a promise and must use the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"await"}]},{"type":"text","value":" syntax"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some guide on using models in your projects:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h3","props":{"id":"usage-in-respective-controller"},"children":[{"type":"text","value":"Usage in Respective Controller"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Every controller has a model attached to it and the model is available for use in the connected controller. So it is used with the keyword "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"this"}]}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { blogContent, tags, author, postTitle } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" post "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"create"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" author.id,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" author.username,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" postTitle,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" blogContent,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" tags,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    });"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"post){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost not created"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost created successfully"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", post); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns post created"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"element","tag":"h3","props":{"id":"global-usage"},"children":[{"type":"text","value":"Global usage"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"A new instance of the model needs to called when using a model globally or in a controller that is not connected to the model"}]},{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport Blog from \"../models/Blog\"\nimport UserModel from \"../models/User\"\n\nexport default class User extends Controller {\n    model?:  UserModel\n    @Post()\n    async getAllPostWithUser(res: Response,req: Request){\n        const { user_id_client } = req.data;\n        let allData = await new Blog().where({user_id: user_id_client }).all()\n        if(!post){\n            return res.error(\"Blogs not found\") // if error occurs\n        }\n        return res.success(\"User Blogpost found\", allData); // returns blogpost gotten from the databse\n    }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" Blog "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" UserModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"UserModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getAllPostWithUser"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { user_id_client } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allData "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" user_id_client })."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"post){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"            "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Blogs not found"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"User Blogpost found"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", allData); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns blogpost gotten from the databse"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"model-options"},"children":[{"type":"text","value":"Model Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Model options are methods paired with an instance of a model to query or perform certain actions to the table in the database"}]},{"type":"element","tag":"h3","props":{"id":"operations-options"},"children":[{"type":"text","value":"Operations Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are model methods used to perform certain operations on a model"}]},{"type":"element","tag":"h4","props":{"id":"create"},"children":[{"type":"text","value":".create()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"creates a new row of data in the table in the database, accepts an object where the key is the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm-getting-started#Column"},"children":[{"type":"text","value":"column_name"}]},{"type":"text","value":" and the value is the value to create"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { blogContent, tags, author, postTitle } = req.data;\n    const post = await this.model.create({\n      user_id: author.id,\n      author: author.username,\n      title: postTitle,\n      content: blogContent,\n      tags: tags,\n    });\n    if(!post){\n      return res.error(\"blogPost not created\") // if error occurs\n    }\n    return res.success(\"blogPost created successfully\", post); // returns post created\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { blogContent, tags, author, postTitle } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" post "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"create"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" author.id,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" author.username,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" postTitle,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" blogContent,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" tags,"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    });"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"post){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost not created"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost created successfully"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", post); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns post created"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"update"},"children":[{"type":"text","value":".update()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"updates an existing row of data in the table in the database, accepts an object where the key is the "},{"type":"element","tag":"a","props":{"href":"/components/avanda-orm-getting-started#Column"},"children":[{"type":"text","value":"column_name"}]},{"type":"text","value":" and the value is the value to update"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const { user_id } = req.data;\n    await new User().where({id: user_id }).update({\n      email_verification_token : null // updates the user's email_verification_token to null\n    })\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { user_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" user_id })."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"update"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      email_verification_token "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"null"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// updates the user's email_verification_token to null"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class User extends Model{\n    id?: number;\n\n    @Column.text({\n        index:{\n          type: \"UNIQUE\",\n          name: \"unique_email\"\n        },\n        masSize: 255\n    })\n    email?: string\n\n    @Column.text()\n    password?: string\n\n    @Column.text({\n        nullable: true\n    })\n    email_verification_token?: string\n\n    @Column.text()\n    full_name?: string\n}\n","filename":"models/User.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        index"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"          type"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"          name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"unique_email"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        },"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        masSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"255"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    email"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    password"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    email_verification_token"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    full_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"delete"},"children":[{"type":"text","value":"delete()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"deletes an existing row of data in the table in the database"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().where({column_name: value }).delete() \n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({column_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" value })."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"delete"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async controllerFunction(res: Response, req: Request) {\n    const { user_id } = req.data;\n    await new User().where({id: user_id }).delete() // delete the user with the user_id passed\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"controllerFunction"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" { user_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" user_id })."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"delete"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// delete the user with the user_id passed"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"query-options"},"children":[{"type":"text","value":"Query Options"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"These are the list of methods to query a model. Other Model options can be tagged along with the query options to factor down the query records"}]},{"type":"element","tag":"h3","props":{"id":"find"},"children":[{"type":"text","value":"find"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"return an object of the first record with the specified "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().find(id)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"find"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(id)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const blogWithId await new User().find(some_id) // finds the row in the user model with the id of some_id\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {some_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" blogWithId await new User().find(some_id) "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds the row in the user model with the id of some_id"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"findby"},"children":[{"type":"text","value":"findBy"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds and return an object of the first record that fulfill a specified column_name and value. It is an alternative to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".where({col: val}).first()"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().findBy(column_name, value)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"findBy"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(column_name, value)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const firstBlogWithUserIdSpecified =  await this.model.findBy(user_id, some_id) // finds the firts blog where the user_id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {some_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" firstBlogWithUserIdSpecified "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"findBy"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(user_id, some_id) "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds the firts blog where the user_id is equal to the some_id specified"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"findall"},"children":[{"type":"text","value":"findAll"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds and returns an array of records with the specified "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"id"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().findAll(id)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"findAll"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(id)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allUserWithId =  await this.model.findAll(some_id)// finds all the user where the id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {some_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allUserWithId "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"findAll"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(some_id)"}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the user where the id is equal to the some_id specified"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Column,Model} from \"@avanda/orm\";\n\nexport default class User extends Model{\n    id?: number;\n\n    @Column.text({\n        index:{\n          type: \"UNIQUE\",\n          name: \"unique_email\"\n        },\n        masSize: 255\n    })\n    email?: string\n\n    @Column.text()\n    password?: string\n\n    @Column.text({\n        nullable: true\n    })\n    email_verification_token?: string\n\n    @Column.text()\n    full_name?: string\n}\n","filename":"models/User.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        index"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"          type"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"UNIQUE"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"          name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"unique_email"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        },"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        masSize"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"255"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    email"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    password"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    email_verification_token"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    full_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"findallby"},"children":[{"type":"text","value":"findAllBy"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds and returns all the records that fulfill a specified column_name and value. It is an alternative to "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".where({col: val}).all()"}]}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().findAllBy(column_name, value)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"findAllBy"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(column_name, value)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allBlogWithUserIdSpecified =  await this.model.findAllBy(user_id, some_id) // finds all the blog where the user_id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {some_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allBlogWithUserIdSpecified "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"findAllBy"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(user_id, some_id) "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the blog where the user_id is equal to the some_id specified"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"where"},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records that fulfill a specified column_name and value. Mostly used with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".first"}]},{"type":"text","value":" to get the first record and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":".all"}]},{"type":"text","value":" to get all the records"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().where({column_name: value})\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({column_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" value})"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const {some_id } = req.data;\n    const allBlogWithUserIdSpecified =  await this.model.where({user_id: some_id}).all() // finds all the blog where the user_id is equal to the some_id specified\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {some_id } "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" req.data;"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allBlogWithUserIdSpecified "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"where"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" some_id})."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the blog where the user_id is equal to the some_id specified"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolin"},"children":[{"type":"text","value":"whereColIn"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name has a value that exists inside the specified values array"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColIn(column_name, [value1, value2,...])\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColIn"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(column_name, [value1, value2,"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"..."}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"])"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n      let some_ids = [1,3,5]\n    const allBlogWithUserIdArraySpecified =  await this.model.whereColIn(user_id, some_ids).all() // finds all the blog where the user_id is equal to any of the element in the some_id array\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" some_ids "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ["}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"3"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"5"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"]"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allBlogWithUserIdArraySpecified "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColIn"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(user_id, some_ids)."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the blog where the user_id is equal to any of the element in the some_id array"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolnotin"},"children":[{"type":"text","value":"whereColNotIn"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name does not have a value that exists inside the specified values array"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColNotIn(column_name, [value1, value2,...])\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColNotIn"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(column_name, [value1, value2,"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"..."}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"])"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n      let some_ids = [1,3,5]\n    const allBlogWithUserIdArraySpecified =  await this.model.whereColNotIn(user_id, some_ids).all() // finds all the blog where the user_id is not equal to any of the element in the some_id array\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" some_ids "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" ["}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"1"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"3"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":","}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"5"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"]"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allBlogWithUserIdArraySpecified "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColNotIn"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(user_id, some_ids)."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the blog where the user_id is not equal to any of the element in the some_id array"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolisnull"},"children":[{"type":"text","value":"whereColIsNull"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name value is null"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColIsNull(column_name)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColIsNull"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(column_name)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const allBlogWithTagsNull =  await this.model.whereColIsNull(tags).all() // finds all the blog where the tags column value is null \n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allBlogWithTagsNull "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColIsNull"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(tags)."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the blog where the tags column value is null "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"wherecolisnotnull"},"children":[{"type":"text","value":"whereColIsNotNull"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"finds only those records where the specified column_name value is  not null"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example,Schema"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"await new Model().whereColIsNotNull(column_name)\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColIsNotNull"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(column_name)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Post() //accepts middleware \n    async createPost(res: Response, req: Request) {\n    const allBlogWithTagsNull =  await this.model.whereColIsNotNull(tags).all() // finds all the blog where the tags column value is null \n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Post"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"createPost"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" allBlogWithTagsNull "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"this"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":".model."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"whereColIsNotNull"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(tags)."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"all"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// finds all the blog where the tags column value is null "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Schema":""},"children":[{"type":"element","tag":"code","props":{"code":"import User from '../models/User';\nimport {Column,Model} from \"@avanda/orm\";\n\nexport default class Blog extends Model{\n    id?: number;\n\n    @Column.int({\n        references: new User()\n    })\n    user_id?: number;\n\n    @Column.text()\n    author?:string;\n\n    @Column.text()\n    title?:string;\n\n    @Column.text()\n    content?:string;\n\n    @Column.json({\n        nullable:true\n    })\n    tags?:string[];\n\n    @Column.text({\n        nullable:true\n    })\n    category?:string;\n}\n","filename":"models/BlogPost.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" User "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"'"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Column,Model} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/orm"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"{"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"int"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        references"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"User"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    user_id"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"number"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    author"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    title"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    content"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    tags"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"[];"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Column"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"text"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"        nullable"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"true"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    })"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    category"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"create-a-model","depth":2,"text":"Create a Model"},{"id":"model-usage","depth":2,"text":"Model Usage","children":[{"id":"usage-in-respective-controller","depth":3,"text":"Usage in Respective Controller"},{"id":"global-usage","depth":3,"text":"Global usage"}]},{"id":"model-options","depth":2,"text":"Model Options","children":[{"id":"operations-options","depth":3,"text":"Operations Options","children":[{"id":"create","depth":4,"text":".create()"},{"id":"update","depth":4,"text":".update()"}]},{"id":"delete","depth":3,"text":"delete()"}]},{"id":"query-options","depth":2,"text":"Query Options","children":[{"id":"find","depth":3,"text":"find"},{"id":"findby","depth":3,"text":"findBy"},{"id":"findall","depth":3,"text":"findAll"},{"id":"findallby","depth":3,"text":"findAllBy"},{"id":"where","depth":3,"text":"where"},{"id":"wherecolin","depth":3,"text":"whereColIn"},{"id":"wherecolnotin","depth":3,"text":"whereColNotIn"},{"id":"wherecolisnull","depth":3,"text":"whereColIsNull"},{"id":"wherecolisnotnull","depth":3,"text":"whereColIsNotNull"}]}]}},"_type":"markdown","_id":"content:3.guide:2.models.md","_source":"content","_file":"3.guide/2.models.md","_extension":"md"},{"_path":"/api/response","_draft":false,"_partial":false,"_empty":false,"title":"Response","description":"The response object represents the HTTP response that an avanda app sends when it gets an HTTP request. The response argument passed into every controller function has some inbuilt methods which helps in retrieving data from the current controller model with less code and computation","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"response"},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" object represents the HTTP response that an avanda app sends when it gets an HTTP request. The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" argument passed into every controller function has some inbuilt methods which helps in retrieving data from the current controller model with less code and computation"}]},{"type":"element","tag":"h2","props":{"id":"client-response-properties"},"children":[{"type":"text","value":"Client Response properties"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some options for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" object when used to return data to the client"}]},{"type":"element","tag":"h3","props":{"id":"query-options"},"children":[{"type":"text","value":"Query Options"}]},{"type":"element","tag":"h3","props":{"id":"alldata"},"children":[{"type":"text","value":".allData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets all the data in the current model attached to the controller from the database and returns it to the client"}]},{"type":"element","tag":"code","props":{"code":"@Get\n\nasync getAll(res: Response, req: Request){\n    return res.allData()\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Get\n\nasync getAll(res: Response, req: Request){\n    return res.allData()\n}\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"singledata"},"children":[{"type":"text","value":".singleData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets the first data in the current model attached to the controller from the database and returns it to the client"}]},{"type":"element","tag":"code","props":{"code":"@Get\n\nasync get(res: Response, req: Request){\n    return res.singleData()\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Get\n\nasync get(res: Response, req: Request){\n    return res.singleData()\n}\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"pageddata"},"children":[{"type":"text","value":".pagedData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets data in the current model attached to the controller from the database and returns it to the client, mainly used to handle pagination"}]},{"type":"element","tag":"code","props":{"code":"@Get\n\nasync get(res: Response, req: Request){\n    return res.pagedData(req)\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"@Get\n\nasync get(res: Response, req: Request){\n    return res.pagedData(req)\n}\n"}]}]}]},{"type":"element","tag":"h3","props":{"id":"return-options"},"children":[{"type":"text","value":"Return Options"}]},{"type":"element","tag":"h4","props":{"id":"success"},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"to send a success response, accepts success message, data, status code"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"res.success(message, data, code)\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"res.success(message, data, code)\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"return res.success(\"blogPost created successfully\", post);\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"return res.success(\"blogPost created successfully\", post);\n\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"error"},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"to send a error response, accepts success message, data, status code"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"res.error(message, code, data)\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"res.error(message, code, data)\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"return res.error(\"blogPost not created\", 400);\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"return res.error(\"blogPost not created\", 400);\n\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"json"},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"to send a JSON response"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"res.json([data])\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"res.json([data])\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"return res.json({name: \"John Doe\", age: 50});\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"return res.json({name: \"John Doe\", age: 50});\n\n"}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"server-response-properties"},"children":[{"type":"text","value":"Server Response properties"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda makes getting responses from an external API easier\nHere are some options for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" object when used to fetch data from an external API."}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note, before using the server response properties a new instance of request object must exist in the controller function. Check "},{"type":"element","tag":"a","props":{"href":"/api/requests"},"children":[{"type":"text","value":"requests"}]},{"type":"text","value":" to learn more"}]}]},{"type":"element","tag":"h4","props":{"id":"response-data"},"children":[{"type":"text","value":"response data"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst data  = response.data\n\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst data  = response.data\n\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getDataFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    if(!response.data){\n      return res.error(\"Data not fetched\") // if error occurs\n    }\n    return res.success(\"Data not fetched\", response.data); // returns data gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getDataFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    if(!response.data){\n      return res.error(\"Data not fetched\") // if error occurs\n    }\n    return res.success(\"Data not fetched\", response.data); // returns data gotten from the api service\n  }\n\n}\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"response-message"},"children":[{"type":"text","value":"response message"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets the response message"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst msg  = response.message\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst msg  = response.message\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    const msg  = response.message\n    if(!response.data){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(msg, response.data); // returns data gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    const msg  = response.message\n    if(!response.data){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(msg, response.data); // returns data gotten from the api service\n  }\n\n}\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"response-statuscode"},"children":[{"type":"text","value":"response statusCode"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets the status code of the response"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst statusCode  = response.statusCode\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst statusCode  = response.statusCode\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    const msg  = response.message\n    const statusCode  = response.statusCode\n    if(!response.data){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(msg, response.data, statusCode); // returns message, data, statusCode  gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    const msg  = response.message\n    const statusCode  = response.statusCode\n    if(!response.data){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(msg, response.data, statusCode); // returns message, data, statusCode  gotten from the api service\n  }\n\n}\n"}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"response-headers"},"children":[{"type":"text","value":"response headers"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets all response header from the request response to  from"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst headers  = response.headers\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst headers  = response.headers\n\n"}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    let headers = response.headers\n    if(!response.headers){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(\"Data not fetched\", response.data); // returns data gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    let headers = response.headers\n    if(!response.headers){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(\"Data not fetched\", response.data); // returns data gotten from the api service\n  }\n\n}\n"}]}]}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"response"},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" object represents the HTTP response that an avanda app sends when it gets an HTTP request. The "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" argument passed into every controller function has some inbuilt methods which helps in retrieving data from the current controller model with less code and computation"}]},{"type":"element","tag":"h2","props":{"id":"client-response-properties"},"children":[{"type":"text","value":"Client Response properties"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Here are some options for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" object when used to return data to the client"}]},{"type":"element","tag":"h3","props":{"id":"query-options"},"children":[{"type":"text","value":"Query Options"}]},{"type":"element","tag":"h3","props":{"id":"alldata"},"children":[{"type":"text","value":".allData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets all the data in the current model attached to the controller from the database and returns it to the client"}]},{"type":"element","tag":"code","props":{"code":"@Get\n\nasync getAll(res: Response, req: Request){\n    return res.allData()\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"async "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getAll"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(res: Response, req: Request){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"allData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"singledata"},"children":[{"type":"text","value":".singleData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets the first data in the current model attached to the controller from the database and returns it to the client"}]},{"type":"element","tag":"code","props":{"code":"@Get\n\nasync get(res: Response, req: Request){\n    return res.singleData()\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"async "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(res: Response, req: Request){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"singleData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"pageddata"},"children":[{"type":"text","value":".pagedData()"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets data in the current model attached to the controller from the database and returns it to the client, mainly used to handle pagination"}]},{"type":"element","tag":"code","props":{"code":"@Get\n\nasync get(res: Response, req: Request){\n    return res.pagedData(req)\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"@"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"async "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(res: Response, req: Request){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"pagedData"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(req)"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"h3","props":{"id":"return-options"},"children":[{"type":"text","value":"Return Options"}]},{"type":"element","tag":"h4","props":{"id":"success"},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"to send a success response, accepts success message, data, status code"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"res.success(message, data, code)\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(message, data, code)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"return res.success(\"blogPost created successfully\", post);\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost created successfully"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", post);"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"error"},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"to send a error response, accepts success message, data, status code"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"res.error(message, code, data)\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(message, code, data)"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"return res.error(\"blogPost not created\", 400);\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"blogPost not created"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"400"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":");"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"json"},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"to send a JSON response"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"res.json([data])\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"([data])"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"return res.json({name: \"John Doe\", age: 50});\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"json"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"({name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"John Doe"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", age"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#BF9EEE"}},"children":[{"type":"text","value":"50"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"});"}]}]}]}]}]}]}]},{"type":"element","tag":"h2","props":{"id":"server-response-properties"},"children":[{"type":"text","value":"Server Response properties"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Avanda makes getting responses from an external API easier\nHere are some options for the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"response"}]},{"type":"text","value":" object when used to fetch data from an external API."}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note, before using the server response properties a new instance of request object must exist in the controller function. Check "},{"type":"element","tag":"a","props":{"href":"/api/requests"},"children":[{"type":"text","value":"requests"}]},{"type":"text","value":" to learn more"}]}]},{"type":"element","tag":"h4","props":{"id":"response-data"},"children":[{"type":"text","value":"response data"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst data  = response.data\n\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//new instance of request"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(url)"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" data  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.data"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getDataFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    if(!response.data){\n      return res.error(\"Data not fetched\") // if error occurs\n    }\n    return res.success(\"Data not fetched\", response.data); // returns data gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getDataFromExternalApi"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://api.some-service.com"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"response.data){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Data not fetched"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Data not fetched"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", response.data); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns data gotten from the api service"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"response-message"},"children":[{"type":"text","value":"response message"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets the response message"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst msg  = response.message\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//new instance of request"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(url)"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.message"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    const msg  = response.message\n    if(!response.data){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(msg, response.data); // returns data gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getHeadersFromExternalApi"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://api.some-service.com"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.message"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"response.data){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Headers not available"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(msg, response.data); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns data gotten from the api service"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"response-statuscode"},"children":[{"type":"text","value":"response statusCode"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets the status code of the response"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst statusCode  = response.statusCode\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//new instance of request"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(url)"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" statusCode  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.statusCode"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    const msg  = response.message\n    const statusCode  = response.statusCode\n    if(!response.data){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(msg, response.data, statusCode); // returns message, data, statusCode  gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getHeadersFromExternalApi"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://api.some-service.com"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" msg  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.message"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" statusCode  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.statusCode"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"response.data){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Headers not available"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(msg, response.data, statusCode); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns message, data, statusCode  gotten from the api service"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]},{"type":"element","tag":"h4","props":{"id":"response-headers"},"children":[{"type":"text","value":"response headers"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"gets all response header from the request response to  from"}]},{"type":"element","tag":"code-group","props":{"toggle-text":"Usage,Example"},"children":[{"type":"element","tag":"template","props":{"v-slot:Usage":""},"children":[{"type":"element","tag":"code","props":{"code":"const request = new Request() //new instance of request\nconst response = await request.get(url)\nconst headers  = response.headers\n\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//new instance of request"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"(url)"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" headers  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.headers"}]}]}]}]}]}]},{"type":"element","tag":"template","props":{"v-slot:Example":""},"children":[{"type":"element","tag":"code","props":{"code":"import {Controller, Request, Response, Get} from \"@avanda/http\";\nimport BlogModel from \"../models/Blog\"\n\nexport default class Blog extends Controller {\n    model?:  BlogModel\n    @Get() //accepts middleware \n    async getHeadersFromExternalApi(res: Response, req: Request) {\n    const request = new Request()\n    const response = await request.get(\"https://api.some-service.com\")\n    let headers = response.headers\n    if(!response.headers){\n      return res.error(\"Headers not available\") // if error occurs\n    }\n    return res.success(\"Data not fetched\", response.data); // returns data gotten from the api service\n  }\n\n}\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {Controller, Request, Response, Get} "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"@avanda/http"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":";"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" BlogModel "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"../models/Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"class"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Blog"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"extends"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Controller"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    model"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"?:"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"BlogModel"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    @"}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"() "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"//accepts middleware "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"async"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"getHeadersFromExternalApi"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"res"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Response"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", "}]},{"type":"element","tag":"span","props":{"style":{"color":"#FFB86C"}},"children":[{"type":"text","value":"req"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#97E1F1"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"new"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"Request"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"()"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"const"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"await"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" request."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"get"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"https://api.some-service.com"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":")"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"let"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" headers "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"="}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" response.headers"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"if"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"!"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"response.headers){"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"      "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"error"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Headers not available"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// if error occurs"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"    "}]},{"type":"element","tag":"span","props":{"style":{"color":"#F286C4"}},"children":[{"type":"text","value":"return"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":" res."}]},{"type":"element","tag":"span","props":{"style":{"color":"#62E884"}},"children":[{"type":"text","value":"success"}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"("}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#E7EE98"}},"children":[{"type":"text","value":"Data not fetched"}]},{"type":"element","tag":"span","props":{"style":{"color":"#DEE492"}},"children":[{"type":"text","value":"\""}]},{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":", response.data); "}]},{"type":"element","tag":"span","props":{"style":{"color":"#7B7F8B"}},"children":[{"type":"text","value":"// returns data gotten from the api service"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"  }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#F6F6F4"}},"children":[{"type":"text","value":"}"}]}]}]}]}]}]}]}],"toc":{"title":"","searchDepth":3,"depth":3,"links":[{"id":"client-response-properties","depth":2,"text":"Client Response properties","children":[{"id":"query-options","depth":3,"text":"Query Options"},{"id":"alldata","depth":3,"text":".allData()"},{"id":"singledata","depth":3,"text":".singleData()"},{"id":"pageddata","depth":3,"text":".pagedData()"},{"id":"return-options","depth":3,"text":"Return Options","children":[{"id":"success","depth":4,"text":"success"},{"id":"error","depth":4,"text":"error"},{"id":"json","depth":4,"text":"json"}]}]},{"id":"server-response-properties","depth":2,"text":"Server Response properties","children":[{"id":"response-data","depth":4,"text":"response data"},{"id":"response-message","depth":4,"text":"response message"},{"id":"response-statuscode","depth":4,"text":"response statusCode"},{"id":"response-headers","depth":4,"text":"response headers"}]}]}},"_type":"markdown","_id":"content:4.api:1.response.md","_source":"content","_file":"4.api/1.response.md","_extension":"md"}]