Showing preview only (799K chars total). Download the full file or copy to clipboard to get everything.
Repository: juicyllama/llana
Branch: main
Commit: d365291c8c8b
Files: 127
Total size: 757.7 KB
Directory structure:
gitextract_3wslf_j3/
├── .dockerignore
├── .env.example
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── codeql.yml
│ ├── pr.yml
│ ├── release.yml
│ └── snyk-security.yml
├── .gitignore
├── .vscode/
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
├── README.md
├── demo/
│ └── databases/
│ ├── airtable.ts
│ ├── json/
│ │ ├── Customer.json
│ │ ├── Employee.json
│ │ └── Shipper.json
│ ├── mongodb.js
│ ├── mssql.sql
│ ├── mysql.sql
│ ├── postgres.sql
│ └── sqlite.sql
├── docker/
│ ├── docker-compose.dev.yml
│ ├── docker-compose.test.prod.build.yml
│ ├── docker-compose.test.prod.yml
│ └── images/
│ ├── base/
│ │ └── Dockerfile
│ └── llana/
│ └── Dockerfile
├── eslint.config.mjs
├── nest-cli.json
├── package.json
├── pr_description.md
├── scripts/
│ ├── docker.build.prod.sh
│ ├── docker.dev.sh
│ ├── docker.prod.sh
│ ├── install.sh
│ └── test.sh
├── src/
│ ├── app.constants.ts
│ ├── app.controller.auth.test.spec.ts
│ ├── app.controller.auth.ts
│ ├── app.controller.delete.test.spec.ts
│ ├── app.controller.delete.ts
│ ├── app.controller.docs.ts
│ ├── app.controller.get.test.spec.ts
│ ├── app.controller.get.ts
│ ├── app.controller.post.test.spec.ts
│ ├── app.controller.post.ts
│ ├── app.controller.put.test.spec.ts
│ ├── app.controller.put.ts
│ ├── app.module.test.spec.ts
│ ├── app.module.ts
│ ├── app.service.auth.ts
│ ├── app.service.bootup.ts
│ ├── app.service.tasks.ts
│ ├── auth/
│ │ ├── auth.constants.ts
│ │ ├── guards/
│ │ │ ├── jwt-auth.guard.ts
│ │ │ └── local-auth.guard.ts
│ │ └── strategies/
│ │ └── local.strategy.ts
│ ├── config/
│ │ ├── auth.config.ts
│ │ ├── class-validator.config.ts
│ │ ├── database.config.ts
│ │ ├── env.validation.spec.ts
│ │ ├── env.validation.ts
│ │ ├── hosts.config.ts
│ │ ├── jwt.config.ts
│ │ └── roles.config.ts
│ ├── datasources/
│ │ ├── airtable.datasource.ts
│ │ ├── mongo.datasource.ts
│ │ ├── mssql.datasource.ts
│ │ ├── mysql.datasource.ts
│ │ └── postgres.datasource.ts
│ ├── dtos/
│ │ ├── requests.dto.ts
│ │ ├── response.dto.ts
│ │ └── webhook.dto.ts
│ ├── helpers/
│ │ ├── Authentication.ts
│ │ ├── CircuitBreaker.ts
│ │ ├── Database.ts
│ │ ├── Documentation.ts
│ │ ├── Encryption.ts
│ │ ├── Logger.ts
│ │ ├── Pagination.test.spec.ts
│ │ ├── Pagination.ts
│ │ ├── Query.ts
│ │ ├── Response.ts
│ │ ├── Roles.ts
│ │ ├── Schema.ts
│ │ └── Webhook.ts
│ ├── main.ts
│ ├── middleware/
│ │ ├── HostCheck.ts
│ │ ├── Robots.ts
│ │ └── request-path-logger.middleware.ts
│ ├── modules/
│ │ ├── cache/
│ │ │ ├── dataCache.constants.ts
│ │ │ └── dataCache.service.ts
│ │ ├── websocket/
│ │ │ ├── redis-mock-with-pub-sub.ts
│ │ │ ├── websocket.constants.ts
│ │ │ ├── websocket.gateway.spec.ts
│ │ │ ├── websocket.gateway.ts
│ │ │ ├── websocket.jwt-auth.middleware.test.spec.ts
│ │ │ ├── websocket.jwt-auth.middleware.ts
│ │ │ └── websocket.service.ts
│ │ └── welcome/
│ │ ├── welcome.controller.ts
│ │ └── welcome.module.ts
│ ├── testing/
│ │ ├── auth.testing.service.ts
│ │ ├── customer.testing.service.ts
│ │ ├── employee.testing.service.ts
│ │ ├── relations.testing.service.ts
│ │ ├── salesorder.testing.service.ts
│ │ ├── shipper.testing.service.ts
│ │ ├── testing.const.ts
│ │ └── user.testing.service.ts
│ ├── types/
│ │ ├── auth.types.ts
│ │ ├── datasource.types.ts
│ │ ├── datasources/
│ │ │ ├── airtable.types.ts
│ │ │ ├── mssql.types.ts
│ │ │ ├── mysql.types.ts
│ │ │ └── postgres.types.ts
│ │ ├── response.types.ts
│ │ ├── roles.types.ts
│ │ └── schema.types.ts
│ └── utils/
│ ├── Env.ts
│ ├── Env.types.ts
│ ├── Find.ts
│ ├── String.ts
│ └── redoc/
│ ├── interfaces/
│ │ └── redoc.interface.ts
│ ├── redoc.ts
│ └── views/
│ └── redoc.handlebars
├── tsconfig.build.json
├── tsconfig.json
└── views/
└── welcome.hbs
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
/.docker
/.github
/.vscode
/docker
/Dockerfile
/docker-compose.yml
/node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
================================================
FILE: .env.example
================================================
### Please consult https://llana.io/configuration for full details ###
SOFTWARE_VERSION_TAG=latest
PORT=3000
ADMIN_EMAIL=test@test.com
DATABASE_URI=
JWT_KEY=S$3cr3tK3y
JWT_REFRESH_KEY=S$3cr3tK3yRefresh
#Auth Settings
AUTH_USER_TABLE_NAME=User
#Delete Settings
SOFT_DELETE_COLUMN=deletedAt
#Logging
LOG_LEVELS="error,warn,log,debug,verbose"
#LOG_LEVELS="error,warn,log"
#URL of your Llana instance
BASE_URL_API=https://api.my-llana.com
#URL of your frontend application
BASE_URL_APP=https://www.my-llana.com
================================================
FILE: .github/dependabot.yml
================================================
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
================================================
FILE: .github/workflows/codeql.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
pull_request:
branches: [ "main" ]
schedule:
- cron: '29 7 * * 2'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
================================================
FILE: .github/workflows/pr.yml
================================================
#
# GitHub Actions workflow.
#
# Perfoms the following actions on a pull request:
# * Checkout the code
# * Install Node.js
# * Prepare the environment
# * Install dependencies
# * Lint the code
# * Run the tests
#
name: 'PR Checks: Llana'
on:
pull_request:
branches:
- main
workflow_dispatch:
workflow_call:
jobs:
pr_checks:
name: 'Pull Request Package: Llana'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_CI_CD_RELEASE }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22.16.0
- name: Install Docker using Docker's official script
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
continue-on-error: false
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
continue-on-error: false
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Setup Docker
run: npm run docker:dev
- name: Test
run: npm run test
================================================
FILE: .github/workflows/release.yml
================================================
#
# GitHub Actions workflow.
#
# Releases the package to npm when a push into main is detected.
# * Checkout the code
# * Install Node.js
# * Install dependencies
# * Pull the latest changes
# * Bump version number
# * Release to NPM
# * Pull the latest changes
# * Generate Docker meta
# * Build and push image
#
name: 'Release Package: Llana'
on:
push:
branches:
- main
workflow_dispatch:
jobs:
release:
name: 'Release Package: CLI'
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '#skip-release') }}
permissions:
contents: write
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_CI_CD_RELEASE }}
- name: 'Install Node.js'
uses: actions/setup-node@v4
with:
node-version: 22.16.0
- name: 'Install dependencies'
run: npm install
- run: git pull --force
- name: 'Version Bump'
id: version
if: ${{ !contains(github.event.head_commit.message, '#skip-version-bump') }}
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ secrets.GH_CI_CD_RELEASE }}
with:
major-wording: 'MAJOR'
minor-wording: 'feature,feat'
patch-wording: 'patch,fixes,fix,misc,docs,refactor' # Providing patch-wording will override commits
commit-message: 'CI: Bump Version to {{version}} [skip ci]'
tag-prefix: 'v'
- run: git pull --force #Ensure we have the latest package version before pushing to NPM / Docker
- name: 'Authenticate with NPM'
if: ${{ !contains(github.event.head_commit.message, '#skip-npm-publish') }}
run: echo -e "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: 'Publishing package'
if: ${{ !contains(github.event.head_commit.message, '#skip-npm-publish') }}
run: npm publish --no-git-checks --access public
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
juicyllama/llana
# ghcr.io/username/app
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern=v{{version}},value=${{ steps.version.outputs.newTag }}
type=semver,pattern=v{{major}}.{{minor}},value=${{ steps.version.outputs.newTag }}
type=semver,pattern=v{{major}},value=${{ steps.version.outputs.newTag }}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: juicyllama
password: ${{ secrets.DOCKERHUB_TOKEN }}
#Checkout again to get latest package.json after bump and before we deploy
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_CI_CD_RELEASE }}
- name: Build and push image
uses: docker/build-push-action@v6
if: ${{ !contains(github.event.head_commit.message, '#skip-docker-publish') }}
with:
file: ./docker/images/base/Dockerfile
sbom: true
provenance: mode=max
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
================================================
FILE: .github/workflows/snyk-security.yml
================================================
name: Snyk Security
on:
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
snyk:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Snyk CLI to check for security issues
# Snyk can be used to break the build when it detects security issues.
# In this case we want to upload the SAST issues to GitHub Code Scanning
uses: snyk/actions/setup@806182742461562b67788a64410098c9d9b96adb
# For Snyk Open Source you must first set up the development environment for your application's dependencies
# For example for Node
#- uses: actions/setup-node@v4
# with:
# node-version: 20
continue-on-error: true
env:
# This is where you will need to introduce the Snyk API token created with your Snyk account
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
# Runs Snyk Code (SAST) analysis and uploads result into GitHub.
# Use || true to not fail the pipeline
- name: Snyk Code test
run: snyk code test --sarif > snyk-code.sarif || true
================================================
FILE: .gitignore
================================================
#Env
.env
.env.*
!.env.example
#llana specific
openapi.json
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### VisualStudio template
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
coverage/
### macOS template
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
=======
# Local
dist
.webpack
.serverless/**/*.zip
================================================
FILE: .vscode/launch.json
================================================
{
"version": "0.2.0",
"configurations": [
{
"name": "start",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"runtimeArgs": ["run", "start"],
"env": {
"LOG_LEVEL": "3",
"LOGGING": "query"
},
"cwd": "${workspaceFolder}"
},
{
"name": "test",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"runtimeArgs": ["run", "test"],
"env": {
"LOG_LEVEL": "2"
},
"cwd": "${workspaceFolder}"
},
{
"name": "test:mysql",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"runtimeArgs": ["run", "test:mysql"],
"env": {
"LOG_LEVEL": "2"
},
"cwd": "${workspaceFolder}"
},
{
"name": "test:mongodb",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"runtimeArgs": ["run", "test:mongodb"],
"env": {
"LOG_LEVEL": "2"
},
"cwd": "${workspaceFolder}"
},
{
"name": "test:mssql",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"runtimeArgs": ["run", "test:mssql"],
"env": {
"LOG_LEVEL": "2"
},
"cwd": "${workspaceFolder}"
}
]
}
================================================
FILE: .vscode/settings.json
================================================
{
"cSpell.words": [
"Bootup",
"LLANA"
]
}
================================================
FILE: .vscode/tasks.json
================================================
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Docker",
"type": "shell",
"command": "npm run start:docker",
"windows": {
"command": "npm run start:docker"
},
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
},
// "runOptions": {
// "runOn": "folderOpen",
// }
},
]
}
================================================
FILE: README.md
================================================
<div align="center">
# Llana
<a href="https://juicyllama.com/" target="_blank">
<img src="https://juicyllama.com/assets/images/llana-rounded.png" width="100" alt="JuicyLlama Logo" />
</a>
</div>
## Database REST API in minutes
Llana is a lightweight API wrapper that exposes a REST API for any database within minutes. Stop wasting time building endpoints, just connect your database and start playing. Open source, free to use, and no vendor lock-in.
## Documentation
Visit [Llana.io](https://llana.io) for full documentation.
## Databases
We are working to support all major databases, if you would like to contribute to the open source project and help integrate your preferred database flavor, checkout our [contribution guidelines](https://llana.io/developers/contributing).
[ExpressJs Database Integration Guide](https://expressjs.com/en/guide/database-integration.html)
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
[See the complete breakdown of which data sources are integrated](https://llana.io/data-sources/overview)
## Integrations


================================================
FILE: demo/databases/airtable.ts
================================================
import 'dotenv/config'
import { Logger } from '../../src/helpers/Logger'
import axios, { AxiosRequestConfig } from 'axios'
// Data
const Customers = require('./json/Customer.json')
const Employees = require('./json/Employee.json')
const Shippers = require('./json/Shipper.json')
const ENDPOINT = 'https://api.airtable.com/v0'
const AIRTABLE = process.env.DATABASE_URI as string
const DOMAIN = 'AIRTABLE'
const [apiKey, baseId] = AIRTABLE.split('://')[1].split('@')
const logger = new Logger()
const user = {
userId: 1,
email: 'test@test.com',
password: '$2a$10$jm6bM7acpRa18Vdy8FSqIu4yzWAdSgZgRtRrx8zknIeZhSqPJjJU.',
role: 'ADMIN',
firstName: 'Jon',
lastName: 'Doe',
}
const buildUsers = async () => {
const table = 'User'
const tableRequest = {
method: 'POST',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
data: {
name: table,
fields: [
{ name: 'userId', type: 'number', options: { precision: 0 } },
{ name: 'email', type: 'email' },
{ name: 'password', type: 'singleLineText' },
{
name: 'role',
type: 'singleSelect',
options: {
choices: [
{
name: 'ADMIN',
},
{
name: 'USER',
},
],
},
},
{ name: 'firstName', type: 'singleLineText' },
{ name: 'lastName', type: 'singleLineText' },
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const recordsRequest = {
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: [
{
fields: user,
},
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
return await build(table, tableRequest, recordsRequest)
}
const buildUserApiKey = async userTable => {
const table = 'UserApiKey'
const tableRequest = {
method: 'POST',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
data: {
name: table,
fields: [
{ name: 'id', type: 'number', options: { precision: 0 } },
{ name: 'userId', type: 'multipleRecordLinks', options: { linkedTableId: userTable.id } },
{ name: 'apiKey', type: 'singleLineText' },
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const recordsRequest = {
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: [
{
fields: {
id: 1,
userId: [userTable.records[0].id],
apiKey: 'Ex@mp1eS$Cu7eAp!K3y',
},
},
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
return await build(table, tableRequest, recordsRequest)
}
const buildCustomers = async () => {
const table = 'Customer'
const fields = Object.keys(Customers[0])
.map(field => {
return field !== 'custId' ? { name: field, type: 'singleLineText' } : null
})
.filter(field => field !== null)
const tableRequest = {
method: 'POST',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
data: {
name: table,
fields: [
{ name: 'custId', type: 'number', options: { precision: 0 } },
{ name: 'userId', type: 'number', options: { precision: 0 } },
...fields,
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const recordsRequest = {
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: Customers.map(customer => {
return { fields: customer }
}),
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
return await build(table, tableRequest, recordsRequest)
}
const buildEmployees = async () => {
const table = 'Employee'
const fields = Object.keys(Employees[0])
.map(field => {
return field !== 'employeeId' ? { name: field, type: 'singleLineText' } : null
})
.filter(field => field !== null)
const tableRequest = {
method: 'POST',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
data: {
name: table,
fields: [{ name: 'employeeId', type: 'number', options: { precision: 0 } }, ...fields],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const recordsRequest = {
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: Employees.map(employee => {
return { fields: employee }
}),
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
return await build(table, tableRequest, recordsRequest)
}
const buildShippers = async () => {
const table = 'Shipper'
const fields = Object.keys(Shippers[0])
.map(field => {
return field !== 'shipperId' ? { name: field, type: 'singleLineText' } : null
})
.filter(field => field !== null)
const tableRequest = {
method: 'POST',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
data: {
name: table,
fields: [{ name: 'shipperId', type: 'number', options: { precision: 0 } }, ...fields],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const recordsRequest = {
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: Shippers.map(shipper => {
return { fields: shipper }
}),
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
return await build(table, tableRequest, recordsRequest)
}
const buildSalesOrders = async (shipperTable, customerTable, employeeTable) => {
const table = 'SalesOrder'
let timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone ?? 'client'
if (timeZone === 'UTC') {
timeZone = 'utc'
}
const tableRequest = {
method: 'POST',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
data: {
name: table,
fields: [
{ name: 'orderId', type: 'number', options: { precision: 0 } },
{ name: 'freight', type: 'number', options: { precision: 2 } },
{ name: 'shipCity', type: 'singleLineText' },
{ name: 'shipName', type: 'singleLineText' },
{
name: 'orderDate',
type: 'dateTime',
options: {
timeZone,
dateFormat: {
format: 'YYYY-MM-DD',
name: 'iso',
},
timeFormat: {
format: 'HH:mm',
name: '24hour',
},
},
},
{ name: 'shipperId', type: 'multipleRecordLinks', options: { linkedTableId: shipperTable.id } },
{ name: 'custId', type: 'multipleRecordLinks', options: { linkedTableId: customerTable.id } },
{ name: 'employeeId', type: 'multipleRecordLinks', options: { linkedTableId: employeeTable.id } },
{ name: 'shipRegion', type: 'singleLineText' },
{ name: 'shipAddress', type: 'singleLineText' },
{ name: 'shipCountry', type: 'singleLineText' },
{ name: 'shipPostalCode', type: 'singleLineText' },
{
name: 'shippedDate',
type: 'dateTime',
options: {
timeZone,
dateFormat: {
format: 'YYYY-MM-DD',
name: 'iso',
},
timeFormat: {
format: 'HH:mm',
name: '24hour',
},
},
},
{
name: 'requiredDate',
type: 'dateTime',
options: {
timeZone,
dateFormat: {
format: 'YYYY-MM-DD',
name: 'iso',
},
timeFormat: {
format: 'HH:mm',
name: '24hour',
},
},
},
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const recordsRequest = {
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: [
{
fields: {
orderId: 1,
freight: 32.38,
shipCity: 'Reims',
shipName: 'Ship to 85-B',
orderDate: '2006-07-04 00:00:00.000000',
shipperId: [shipperTable.records[0].id],
custId: [customerTable.records[0].id],
employeeId: [employeeTable.records[0].id],
shipRegion: null,
shipAddress: "6789 rue de l'Abbaye",
shipCountry: 'France',
shippedDate: '2006-07-16 00:00:00.000000',
requiredDate: '2006-08-01 00:00:00.000000',
shipPostalCode: '10345',
},
},
{
fields: {
orderId: 2,
freight: 11.61,
shipCity: 'Münster',
shipName: 'Ship to 79-C',
orderDate: '2006-07-05 00:00:00.000000',
shipperId: [shipperTable.records[0].id],
custId: [customerTable.records[1].id],
employeeId: [employeeTable.records[0].id],
shipRegion: null,
shipAddress: 'Luisenstr. 9012',
shipCountry: 'Germany',
shippedDate: '2006-07-10 00:00:00.000000',
requiredDate: '2006-08-16 00:00:00.000000',
shipPostalCode: '10328',
},
},
{
fields: {
orderId: 3,
freight: 65.83,
shipCity: 'Rio de Janeiro',
shipName: 'Destination SCQXA',
orderDate: '2006-07-08 00:00:00.000000',
shipperId: [shipperTable.records[0].id],
custId: [customerTable.records[2].id],
employeeId: [employeeTable.records[0].id],
shipRegion: 'RJ',
shipAddress: 'Rua do Paço, 7890',
shipCountry: 'Brazil',
shippedDate: '2006-07-12 00:00:00.000000',
requiredDate: '2006-08-05 00:00:00.000000',
shipPostalCode: '10195',
},
},
{
fields: {
orderId: 4,
freight: 41.34,
shipCity: 'Lyon',
shipName: 'Ship to 84-A',
orderDate: '2006-07-08 00:00:00.000000',
shipperId: [shipperTable.records[0].id],
custId: [customerTable.records[3].id],
employeeId: [employeeTable.records[0].id],
shipRegion: null,
shipAddress: '3456, rue du Commerce',
shipCountry: 'France',
shippedDate: '2006-07-15 00:00:00.000000',
requiredDate: '2006-08-05 00:00:00.000000',
shipPostalCode: '10342',
},
},
{
fields: {
orderId: 5,
freight: 51.3,
shipCity: 'Charleroi',
shipName: 'Ship to 76-B',
orderDate: '2006-07-09 00:00:00.000000',
shipperId: [shipperTable.records[1].id],
custId: [customerTable.records[4].id],
employeeId: [employeeTable.records[1].id],
shipRegion: null,
shipAddress: 'Boulevard Tirou, 9012',
shipCountry: 'Belgium',
shippedDate: '2006-07-11 00:00:00.000000',
requiredDate: '2006-08-06 00:00:00.000000',
shipPostalCode: '10318',
},
},
{
fields: {
orderId: 6,
freight: 58.17,
shipCity: 'Rio de Janeiro',
shipName: 'Destination JPAIY',
orderDate: '2006-07-10 00:00:00.000000',
shipperId: [shipperTable.records[1].id],
custId: [customerTable.records[5].id],
employeeId: [employeeTable.records[1].id],
shipRegion: 'RJ',
shipAddress: 'Rua do Paço, 8901',
shipCountry: 'Brazil',
shippedDate: '2006-07-16 00:00:00.000000',
requiredDate: '2006-07-24 00:00:00.000000',
shipPostalCode: '10196',
},
},
{
fields: {
orderId: 7,
freight: 22.98,
shipCity: 'Bern',
shipName: 'Destination YUJRD',
orderDate: '2006-07-11 00:00:00.000000',
shipperId: [shipperTable.records[1].id],
custId: [customerTable.records[4].id],
employeeId: [employeeTable.records[1].id],
shipRegion: null,
shipAddress: 'Hauptstr. 1234',
shipCountry: 'Switzerland',
shippedDate: '2006-07-23 00:00:00.000000',
requiredDate: '2006-08-08 00:00:00.000000',
shipPostalCode: '10139',
},
},
{
fields: {
orderId: 8,
freight: 148.33,
shipCity: 'Genève',
shipName: 'Ship to 68-A',
orderDate: '2006-07-12 00:00:00.000000',
shipperId: [shipperTable.records[1].id],
custId: [customerTable.records[6].id],
employeeId: [employeeTable.records[2].id],
shipRegion: null,
shipAddress: 'Starenweg 6789',
shipCountry: 'Switzerland',
shippedDate: '2006-07-15 00:00:00.000000',
requiredDate: '2006-08-09 00:00:00.000000',
shipPostalCode: '10294',
},
},
{
fields: {
orderId: 9,
freight: 13.97,
shipCity: 'Resende',
shipName: 'Ship to 88-B',
orderDate: '2006-07-15 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[7].id],
employeeId: [employeeTable.records[2].id],
shipRegion: 'SP',
shipAddress: 'Rua do Mercado, 5678',
shipCountry: 'Brazil',
shippedDate: '2006-07-17 00:00:00.000000',
requiredDate: '2006-08-12 00:00:00.000000',
shipPostalCode: '10354',
},
},
{
fields: {
orderId: 10,
freight: 81.91,
shipCity: 'San Cristóbal',
shipName: 'Destination JYDLM',
orderDate: '2006-07-16 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[8].id],
employeeId: [employeeTable.records[3].id],
shipRegion: 'Táchira',
shipAddress: 'Carrera1234 con Ave. Carlos Soublette #8-35',
shipCountry: 'Venezuela',
shippedDate: '2006-07-22 00:00:00.000000',
requiredDate: '2006-08-13 00:00:00.000000',
shipPostalCode: '10199',
},
},
{
fields: {
orderId: 11,
freight: 140.51,
shipCity: 'Graz',
shipName: 'Destination RVDMF',
orderDate: '2006-07-17 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[9].id],
employeeId: [employeeTable.records[3].id],
shipRegion: null,
shipAddress: 'Kirchgasse 9012',
shipCountry: 'Austria',
shippedDate: '2006-07-23 00:00:00.000000',
requiredDate: '2006-08-14 00:00:00.000000',
shipPostalCode: '10157',
},
},
{
fields: {
orderId: 12,
freight: 3.25,
shipCity: 'México D.F.',
shipName: 'Destination LGGCH',
orderDate: '2006-07-18 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[9].id],
employeeId: [employeeTable.records[4].id],
shipRegion: null,
shipAddress: 'Sierras de Granada 9012',
shipCountry: 'Mexico',
shippedDate: '2006-07-25 00:00:00.000000',
requiredDate: '2006-08-15 00:00:00.000000',
shipPostalCode: '10137',
},
},
{
fields: {
orderId: 13,
freight: 55.09,
shipCity: 'Köln',
shipName: 'Ship to 56-A',
orderDate: '2006-07-19 00:00:00.000000',
shipperId: [shipperTable.records[0].id],
custId: [customerTable.records[9].id],
employeeId: [employeeTable.records[4].id],
shipRegion: null,
shipAddress: 'Mehrheimerstr. 0123',
shipCountry: 'Germany',
shippedDate: '2006-07-29 00:00:00.000000',
requiredDate: '2006-08-16 00:00:00.000000',
shipPostalCode: '10258',
},
},
{
fields: {
orderId: 14,
freight: 3.05,
shipCity: 'Rio de Janeiro',
shipName: 'Ship to 61-B',
orderDate: '2006-07-19 00:00:00.000000',
shipperId: [shipperTable.records[1].id],
custId: [customerTable.records[9].id],
employeeId: [employeeTable.records[4].id],
shipRegion: 'RJ',
shipAddress: 'Rua da Panificadora, 6789',
shipCountry: 'Brazil',
shippedDate: '2006-07-30 00:00:00.000000',
requiredDate: '2006-08-16 00:00:00.000000',
shipPostalCode: '10274',
},
},
{
fields: {
orderId: 15,
freight: 48.29,
shipCity: 'Albuquerque',
shipName: 'Ship to 65-B',
orderDate: '2006-07-22 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[9].id],
employeeId: [employeeTable.records[4].id],
shipRegion: 'NM',
shipAddress: '8901 Milton Dr.',
shipCountry: 'USA',
shippedDate: '2006-07-25 00:00:00.000000',
requiredDate: '2006-08-19 00:00:00.000000',
shipPostalCode: '10286',
},
},
{
fields: {
orderId: 16,
freight: 146.06,
shipCity: 'Graz',
shipName: 'Destination FFXKT',
orderDate: '2006-07-23 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[0].id],
employeeId: [employeeTable.records[4].id],
shipRegion: null,
shipAddress: 'Kirchgasse 0123',
shipCountry: 'Austria',
shippedDate: '2006-07-31 00:00:00.000000',
requiredDate: '2006-08-20 00:00:00.000000',
shipPostalCode: '10158',
},
},
{
fields: {
orderId: 17,
freight: 3.67,
shipCity: 'Bräcke',
shipName: 'Destination KBSBN',
orderDate: '2006-07-24 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[1].id],
employeeId: [employeeTable.records[4].id],
shipRegion: null,
shipAddress: 'Åkergatan 9012',
shipCountry: 'Sweden',
shippedDate: '2006-08-23 00:00:00.000000',
requiredDate: '2006-08-21 00:00:00.000000',
shipPostalCode: '10167',
},
},
{
fields: {
orderId: 18,
freight: 55.28,
shipCity: 'Strasbourg',
shipName: 'Ship to 7-A',
orderDate: '2006-07-25 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[2].id],
employeeId: [employeeTable.records[2].id],
shipRegion: null,
shipAddress: '0123, place Kléber',
shipCountry: 'France',
shippedDate: '2006-08-12 00:00:00.000000',
requiredDate: '2006-08-22 00:00:00.000000',
shipPostalCode: '10329',
},
},
{
fields: {
orderId: 19,
freight: 25.73,
shipCity: 'Oulu',
shipName: 'Ship to 87-B',
orderDate: '2006-07-26 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[2].id],
employeeId: [employeeTable.records[2].id],
shipRegion: null,
shipAddress: 'Torikatu 2345',
shipCountry: 'Finland',
shippedDate: '2006-07-31 00:00:00.000000',
requiredDate: '2006-09-06 00:00:00.000000',
shipPostalCode: '10351',
},
},
{
fields: {
orderId: 20,
freight: 208.58,
shipCity: 'München',
shipName: 'Destination VAPXU',
orderDate: '2006-07-29 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[2].id],
employeeId: [employeeTable.records[2].id],
shipRegion: null,
shipAddress: 'Berliner Platz 0123',
shipCountry: 'Germany',
shippedDate: '2006-08-06 00:00:00.000000',
requiredDate: '2006-08-26 00:00:00.000000',
shipPostalCode: '10168',
},
},
{
fields: {
orderId: 21,
freight: 66.29,
shipCity: 'Caracas',
shipName: 'Destination QJVQH',
orderDate: '2006-07-30 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[2].id],
employeeId: [employeeTable.records[2].id],
shipRegion: 'DF',
shipAddress: '5ª Ave. Los Palos Grandes 5678',
shipCountry: 'Venezuela',
shippedDate: '2006-08-02 00:00:00.000000',
requiredDate: '2006-08-27 00:00:00.000000',
shipPostalCode: '10193',
},
},
{
fields: {
orderId: 22,
freight: 4.56,
shipCity: 'Seattle',
shipName: 'Ship to 89-B',
orderDate: '2006-07-31 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[3].id],
employeeId: [employeeTable.records[0].id],
shipRegion: 'WA',
shipAddress: '8901 - 12th Ave. S.',
shipCountry: 'USA',
shippedDate: '2006-08-09 00:00:00.000000',
requiredDate: '2006-08-14 00:00:00.000000',
shipPostalCode: '10357',
},
},
{
fields: {
orderId: 23,
freight: 136.54,
shipCity: 'Oulu',
shipName: 'Ship to 87-B',
orderDate: '2006-08-01 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[3].id],
employeeId: [employeeTable.records[0].id],
shipRegion: null,
shipAddress: 'Torikatu 2345',
shipCountry: 'Finland',
shippedDate: '2006-08-02 00:00:00.000000',
requiredDate: '2006-08-29 00:00:00.000000',
shipPostalCode: '10351',
},
},
{
fields: {
orderId: 24,
freight: 4.54,
shipCity: 'Lander',
shipName: 'Ship to 75-C',
orderDate: '2006-08-01 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[3].id],
employeeId: [employeeTable.records[0].id],
shipRegion: 'WY',
shipAddress: 'P.O. Box 7890',
shipCountry: 'USA',
shippedDate: '2006-08-30 00:00:00.000000',
requiredDate: '2006-08-29 00:00:00.000000',
shipPostalCode: '10316',
},
},
{
fields: {
orderId: 25,
freight: 98.03,
shipCity: 'Albuquerque',
shipName: 'Ship to 65-A',
orderDate: '2006-08-02 00:00:00.000000',
shipperId: [shipperTable.records[2].id],
custId: [customerTable.records[4].id],
employeeId: [employeeTable.records[0].id],
shipRegion: 'NM',
shipAddress: '7890 Milton Dr.',
shipCountry: 'USA',
shippedDate: '2006-08-06 00:00:00.000000',
requiredDate: '2006-08-30 00:00:00.000000',
shipPostalCode: '10285',
},
},
],
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
return await build(table, tableRequest, recordsRequest)
}
const build = async (table: string, tableRequest: AxiosRequestConfig<any>, recordsRequest: AxiosRequestConfig<any>) => {
let tableResponse
try {
tableResponse = await axios(tableRequest)
logger.log(`${table} table created (#${tableResponse.data?.id})`, DOMAIN)
let records: any[] = []
try {
if (recordsRequest.data.records.length > 10) {
const chunk = 10
for (let i = 0; i < recordsRequest.data.records.length; i += chunk) {
const recordsResponse = await axios({
method: 'POST',
url: `${ENDPOINT}/${baseId}/${table}`,
data: {
records: recordsRequest.data.records.slice(i, i + chunk),
},
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
records = records.concat(recordsResponse.data?.records)
}
} else {
const recordsResponse = await axios(recordsRequest)
records = recordsResponse.data?.records
}
if (records.length) {
for (const record of records) {
logger.log(`${table} #${record.id} created`, DOMAIN)
}
}
logger.log(`Seeded ${records.length} records`, DOMAIN)
return {
id: tableResponse.data.id,
records,
}
} catch (error) {
logger.error(`Error creating ${table} records`, DOMAIN)
throw new Error(`Error creating ${table} records`)
}
} catch (error) {
if (error.response.data.error.type === 'DUPLICATE_TABLE_NAME') {
logger.warn(`${table} table already exists`, DOMAIN)
const tablesResponse = await axios({
method: 'GET',
url: `${ENDPOINT}/meta/bases/${baseId}/tables`,
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
const filteredTable = tablesResponse.data.tables.find((t: any) => t.name === table)
const recordsResponse = await axios({
method: 'GET',
url: `${ENDPOINT}/${baseId}/${table}`,
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
return {
id: filteredTable.id,
...recordsResponse.data,
}
} else {
logger.error(`Error creating ${table} table`, DOMAIN)
throw new Error(`Error creating ${table} table`)
}
}
}
const seed = async () => {
logger.log('Seeding Airtable database', DOMAIN)
const userTable = await buildUsers()
const userApiKeyTable = await buildUserApiKey(userTable)
const customerTable = await buildCustomers()
const employeeTable = await buildEmployees()
const shipperTable = await buildShippers()
await buildSalesOrders(shipperTable, customerTable, employeeTable)
}
seed()
================================================
FILE: demo/databases/json/Customer.json
================================================
[{
"userId": 1,
"custId": 1,
"fax": "030-0123456",
"city": "Berlin",
"email": null,
"phone": "030-3456789",
"mobile": null,
"region": null,
"address": "Obere Str. 0123",
"country": "Germany",
"postalCode": "10092",
"companyName": "Customer NRZBB",
"contactName": "Allen, Michael",
"contactTitle": "Sales Representative"
}, {
"userId": 1,
"custId": 2,
"fax": "(5) 456-7890",
"city": "México D.F.",
"email": null,
"phone": "(5) 789-0123",
"mobile": null,
"region": null,
"address": "Avda. de la Constitución 5678",
"country": "Mexico",
"postalCode": "10077",
"companyName": "Customer MLTDN",
"contactName": "Hassall, Mark",
"contactTitle": "Owner"
}, {
"userId": 1,
"custId": 3,
"fax": null,
"city": "México D.F.",
"email": null,
"phone": "(5) 123-4567",
"mobile": null,
"region": null,
"address": "Mataderos 7890",
"country": "Mexico",
"postalCode": "10097",
"companyName": "Customer KBUDE",
"contactName": "Peoples, John",
"contactTitle": "Owner"
}, {
"userId": 1,
"custId": 4,
"fax": "(171) 456-7891",
"city": "London",
"email": null,
"phone": "(171) 456-7890",
"mobile": null,
"region": null,
"address": "7890 Hanover Sq.",
"country": "UK",
"postalCode": "10046",
"companyName": "Customer HFBZG",
"contactName": "Arndt, Torsten",
"contactTitle": "Sales Representative"
}, {
"userId": 1,
"custId": 5,
"fax": "0921-23 45 67",
"city": "Luleå",
"email": null,
"phone": "0921-67 89 01",
"mobile": null,
"region": null,
"address": "Berguvsvägen 5678",
"country": "Sweden",
"postalCode": "10112",
"companyName": "Customer HGVLZ",
"contactName": "Higginbotham, Tom",
"contactTitle": "Order Administrator"
}, {
"userId": 1,
"custId": 6,
"fax": "0621-12345",
"city": "Mannheim",
"email": null,
"phone": "0621-67890",
"mobile": null,
"region": null,
"address": "Forsterstr. 7890",
"country": "Germany",
"postalCode": "10117",
"companyName": "Customer XHXJV",
"contactName": "Poland, Carole",
"contactTitle": "Sales Representative"
}, {
"userId": 1,
"custId": 7,
"fax": "67.89.01.24",
"city": "Strasbourg",
"email": null,
"phone": "67.89.01.23",
"mobile": null,
"region": null,
"address": "2345, place Kléber",
"country": "France",
"postalCode": "10089",
"companyName": "Customer QXVLA",
"contactName": "Bansal, Dushyant",
"contactTitle": "Marketing Manager"
}, {
"userId": 1,
"custId": 8,
"fax": "(91) 012 34 56",
"city": "Madrid",
"email": null,
"phone": "(91) 345 67 89",
"mobile": null,
"region": null,
"address": "C/ Araquil, 0123",
"country": "Spain",
"postalCode": "10104",
"companyName": "Customer QUHWH",
"contactName": "Ilyina, Julia",
"contactTitle": "Owner"
}, {
"userId": 1,
"custId": 9,
"fax": "23.45.67.80",
"city": "Marseille",
"email": null,
"phone": "23.45.67.89",
"mobile": null,
"region": null,
"address": "6789, rue des Bouchers",
"country": "France",
"postalCode": "10105",
"companyName": "Customer RTXGC",
"contactName": "Raghav, Amritansh",
"contactTitle": "Owner"
}, {
"userId": 1,
"custId": 10,
"fax": "(604) 678-9012",
"city": "Tsawassen",
"email": null,
"phone": "(604) 901-2345",
"mobile": null,
"region": "BC",
"address": "8901 Tsawassen Blvd.",
"country": "Canada",
"postalCode": "10111",
"companyName": "Customer EEALV",
"contactName": "Bassols, Pilar Colome",
"contactTitle": "Accounting Manager"
}]
================================================
FILE: demo/databases/json/Employee.json
================================================
[{
"employeeId": 1,
"city": "Seattle",
"email": null,
"notes": null,
"phone": "(206) 555-0101",
"photo": null,
"title": "CEO",
"mobile": null,
"region": "WA",
"address": "7890 - 20th Ave. E., Apt. 2A",
"country": "USA",
"hireDate": "2002-05-01 00:00:00.000000",
"lastName": "Davis",
"birthDate": "1958-12-08 00:00:00.000000",
"extension": null,
"firstName": "Sara",
"photoPath": null,
"postalCode": "10003",
"titleOfCourtesy": "Ms."
}, {
"employeeId": 2,
"city": "Tacoma",
"email": null,
"notes": null,
"phone": "(206) 555-0100",
"photo": null,
"title": "Vice President, Sales",
"mobile": null,
"region": "WA",
"address": "9012 W. Capital Way",
"country": "USA",
"hireDate": "2002-08-14 00:00:00.000000",
"lastName": "Funk",
"birthDate": "1962-02-19 00:00:00.000000",
"extension": null,
"firstName": "Don",
"photoPath": null,
"postalCode": "10001",
"titleOfCourtesy": "Dr."
}, {
"employeeId": 3,
"city": "Kirkland",
"email": null,
"notes": null,
"phone": "(206) 555-0103",
"photo": null,
"title": "Sales Manager",
"mobile": null,
"region": "WA",
"address": "2345 Moss Bay Blvd.",
"country": "USA",
"hireDate": "2002-04-01 00:00:00.000000",
"lastName": "Lew",
"birthDate": "1973-08-30 00:00:00.000000",
"extension": null,
"firstName": "Judy",
"photoPath": null,
"postalCode": "10007",
"titleOfCourtesy": "Ms."
}, {
"employeeId": 4,
"city": "Redmond",
"email": null,
"notes": null,
"phone": "(206) 555-0104",
"photo": null,
"title": "Sales Representative",
"mobile": null,
"region": "WA",
"address": "5678 Old Redmond Rd.",
"country": "USA",
"hireDate": "2003-05-03 00:00:00.000000",
"lastName": "Peled",
"birthDate": "1947-09-19 00:00:00.000000",
"extension": null,
"firstName": "Yael",
"photoPath": null,
"postalCode": "10009",
"titleOfCourtesy": "Mrs."
}, {
"employeeId": 5,
"city": "London",
"email": null,
"notes": null,
"phone": "(71) 234-5678",
"photo": null,
"title": "Sales Manager",
"mobile": null,
"region": null,
"address": "8901 Garrett Hill",
"country": "UK",
"hireDate": "2003-10-17 00:00:00.000000",
"lastName": "Buck",
"birthDate": "1965-03-04 00:00:00.000000",
"extension": null,
"firstName": "Sven",
"photoPath": null,
"postalCode": "10004",
"titleOfCourtesy": "Mr."
}]
================================================
FILE: demo/databases/json/Shipper.json
================================================
[{
"shipperId": 1,
"phone": "(503) 555-0137",
"companyName": "Shipper GVSUA"
}, {
"shipperId": 2,
"phone": "(425) 555-0136",
"companyName": "Shipper ETYNR"
}, {
"shipperId": 3,
"phone": "(415) 555-0138",
"companyName": "Shipper ZHISN"
}]
================================================
FILE: demo/databases/mongodb.js
================================================
//seed
db = db.getSiblingDB('llana');
db.User.insert({
"email": "test@test.com",
"password": "$2a$10$jm6bM7acpRa18Vdy8FSqIu4yzWAdSgZgRtRrx8zknIeZhSqPJjJU.",
"role": "ADMIN",
"firstName": "Jon",
"lastName": "Doe",
"createdAt": "2000-01-01 00:00:01",
"updatedAt": "2000-01-01 00:00:01",
"deletedAt": null,
});
//get last inserted id
const user = db.User.findOne({email: "test@test.com"});
// Manual Relations Table
db.createCollection("_llana_relation")
db.getCollection("_llana_relation").insertMany([{
"table": "Customer",
"column": "_id",
"org_table": "SalesOrder",
"org_column": "custId"
},{
"table": "Customer",
"column": "userId",
"org_table": "User",
"org_column": "_id"
}, {
"table": "Employee",
"column": "_id",
"org_table": "SalesOrder",
"org_column": "employeeId"
}, {
"table": "Shipper",
"column": "_id",
"org_table": "SalesOrder",
"org_column": "shipperId"
},{
"table": "User",
"column": "_id",
"org_table": "_llana_webhook",
"org_column": "user_identifier"
},{
"table": "User",
"column": "_id",
"org_table": "UserApiKey",
"org_column": "userId"
}]);
db.createCollection("_llana_webhook")
db.getCollection("_llana_webhook").insert({
"type": "POST",
"url": "https://wh9491c816237e1c710e.free.beeceptor.com",
"table": "Customer",
"user_identifier": user._id,
"on_create": true,
"on_update": true,
"on_delete": true,
"deletedAt": null,
});
const webhook = db.getCollection("_llana_webhook").findOne({table: "Customer"});
db.createCollection("_llana_webhook_log")
db.getCollection("_llana_webhook_log").insert({
"webhook_id": webhook._id,
"type": "INSERT",
"url": "https://wh9491c816237e1c710e.free.beeceptor.com",
"record_key": "custId",
"record_id": new ObjectId(),
"attempt": 1,
"delivered": true,
"response_status": 200,
"response_message": "Success",
"created_at": new Date(),
"next_attempt_at": null,
"delivered_at": new Date(),
});
db.UserApiKey.insert({
"userId": user._id,
"apiKey": "Ex@mp1eS$Cu7eAp!K3y",
"createdAt": "2000-01-01 00:00:01",
"updatedAt": "2000-01-01 00:00:01",
"deletedAt": null
});
// Insert customers
const customers = db.Customer.insertMany([{
"userId": user._id,
"custId": 1,
"fax": "030-0123456",
"city": "Berlin",
"email": null,
"phone": "030-3456789",
"mobile": null,
"region": null,
"address": "Obere Str. 0123",
"country": "Germany",
"postalCode": "10092",
"companyName": "Customer NRZBB",
"contactName": "Allen, Michael",
"contactTitle": "Sales Representative"
}, {
"userId": user._id,
"custId": 2,
"fax": "(5) 456-7890",
"city": "México D.F.",
"email": null,
"phone": "(5) 789-0123",
"mobile": null,
"region": null,
"address": "Avda. de la Constitución 5678",
"country": "Mexico",
"postalCode": "10077",
"companyName": "Customer MLTDN",
"contactName": "Hassall, Mark",
"contactTitle": "Owner"
}, {
"userId": user._id,
"custId": 3,
"fax": null,
"city": "México D.F.",
"email": null,
"phone": "(5) 123-4567",
"mobile": null,
"region": null,
"address": "Mataderos 7890",
"country": "Mexico",
"postalCode": "10097",
"companyName": "Customer KBUDE",
"contactName": "Peoples, John",
"contactTitle": "Owner"
}, {
"userId": user._id,
"custId": 4,
"fax": "(171) 456-7891",
"city": "London",
"email": null,
"phone": "(171) 456-7890",
"mobile": null,
"region": null,
"address": "7890 Hanover Sq.",
"country": "UK",
"postalCode": "10046",
"companyName": "Customer HFBZG",
"contactName": "Arndt, Torsten",
"contactTitle": "Sales Representative"
}, {
"userId": user._id,
"custId": 5,
"fax": "0921-23 45 67",
"city": "Luleå",
"email": null,
"phone": "0921-67 89 01",
"mobile": null,
"region": null,
"address": "Berguvsvägen 5678",
"country": "Sweden",
"postalCode": "10112",
"companyName": "Customer HGVLZ",
"contactName": "Higginbotham, Tom",
"contactTitle": "Order Administrator"
}, {
"userId": user._id,
"custId": 6,
"fax": "0621-12345",
"city": "Mannheim",
"email": null,
"phone": "0621-67890",
"mobile": null,
"region": null,
"address": "Forsterstr. 7890",
"country": "Germany",
"postalCode": "10117",
"companyName": "Customer XHXJV",
"contactName": "Poland, Carole",
"contactTitle": "Sales Representative"
}, {
"userId": user._id,
"custId": 7,
"fax": "67.89.01.24",
"city": "Strasbourg",
"email": null,
"phone": "67.89.01.23",
"mobile": null,
"region": null,
"address": "2345, place Kléber",
"country": "France",
"postalCode": "10089",
"companyName": "Customer QXVLA",
"contactName": "Bansal, Dushyant",
"contactTitle": "Marketing Manager"
}, {
"userId": user._id,
"custId": 8,
"fax": "(91) 012 34 56",
"city": "Madrid",
"email": null,
"phone": "(91) 345 67 89",
"mobile": null,
"region": null,
"address": "C/ Araquil, 0123",
"country": "Spain",
"postalCode": "10104",
"companyName": "Customer QUHWH",
"contactName": "Ilyina, Julia",
"contactTitle": "Owner"
}, {
"userId": user._id,
"custId": 9,
"fax": "23.45.67.80",
"city": "Marseille",
"email": null,
"phone": "23.45.67.89",
"mobile": null,
"region": null,
"address": "6789, rue des Bouchers",
"country": "France",
"postalCode": "10105",
"companyName": "Customer RTXGC",
"contactName": "Raghav, Amritansh",
"contactTitle": "Owner"
}, {
"userId": user._id,
"custId": 10,
"fax": "(604) 678-9012",
"city": "Tsawassen",
"email": null,
"phone": "(604) 901-2345",
"mobile": null,
"region": "BC",
"address": "8901 Tsawassen Blvd.",
"country": "Canada",
"postalCode": "10111",
"companyName": "Customer EEALV",
"contactName": "Bassols, Pilar Colome",
"contactTitle": "Accounting Manager"
}]);
const customer1 = db.Customer.findOne({companyName: "Customer NRZBB"});
const customer2 = db.Customer.findOne({companyName: "Customer MLTDN"});
const customer3 = db.Customer.findOne({companyName: "Customer KBUDE"});
const customer4 = db.Customer.findOne({companyName: "Customer HFBZG"});
const customer5 = db.Customer.findOne({companyName: "Customer HGVLZ"});
const customer6 = db.Customer.findOne({companyName: "Customer XHXJV"});
const customer7 = db.Customer.findOne({companyName: "Customer QXVLA"});
const customer8 = db.Customer.findOne({companyName: "Customer QUHWH"});
const customer9 = db.Customer.findOne({companyName: "Customer RTXGC"});
const customer10 = db.Customer.findOne({companyName: "Customer EEALV"});
// Employees
const employees = db.Employee.insertMany([{
"employeeId": 1,
"city": "Seattle",
"email": null,
"notes": null,
"phone": "(206) 555-0101",
"photo": null,
"title": "CEO",
"mobile": null,
"region": "WA",
"address": "7890 - 20th Ave. E., Apt. 2A",
"country": "USA",
"hireDate": "2000-01-01 00:00:01",
"lastname": "Davis",
"birthDate": "2000-01-01 00:00:01",
"extension": null,
"firstname": "Sara",
"photoPath": null,
"postalCode": "10003",
"titleOfCourtesy": "Ms."
}, {
"employeeId": 2,
"city": "Tacoma",
"email": null,
"notes": null,
"phone": "(206) 555-0100",
"photo": null,
"title": "Vice President, Sales",
"mobile": null,
"region": "WA",
"address": "9012 W. Capital Way",
"country": "USA",
"hireDate": "2000-01-01 00:00:01",
"lastname": "Funk",
"birthDate": "2000-01-01 00:00:01",
"extension": null,
"firstname": "Don",
"photoPath": null,
"postalCode": "10001",
"titleOfCourtesy": "Dr."
}, {
"employeeId": 3,
"city": "Kirkland",
"email": null,
"notes": null,
"phone": "(206) 555-0103",
"photo": null,
"title": "Sales Manager",
"mobile": null,
"region": "WA",
"address": "2345 Moss Bay Blvd.",
"country": "USA",
"hireDate": "2000-01-01 00:00:01",
"lastname": "Lew",
"birthDate": "2000-01-01 00:00:01",
"extension": null,
"firstname": "Judy",
"photoPath": null,
"postalCode": "10007",
"titleOfCourtesy": "Ms."
}, {
"employeeId": 4,
"city": "Redmond",
"email": null,
"notes": null,
"phone": "(206) 555-0104",
"photo": null,
"title": "Sales Representative",
"mobile": null,
"region": "WA",
"address": "5678 Old Redmond Rd.",
"country": "USA",
"hireDate": "2000-01-01 00:00:01",
"lastname": "Peled",
"birthDate": "2000-01-01 00:00:01",
"extension": null,
"firstname": "Yael",
"photoPath": null,
"postalCode": "10009",
"titleOfCourtesy": "Mrs."
}, {
"employeeId": 5,
"city": "London",
"email": null,
"notes": null,
"phone": "(71) 234-5678",
"photo": null,
"title": "Sales Manager",
"mobile": null,
"region": null,
"address": "8901 Garrett Hill",
"country": "UK",
"hireDate": "2000-01-01 00:00:01",
"lastname": "Buck",
"birthDate": "2000-01-01 00:00:01",
"extension": null,
"firstname": "Sven",
"photoPath": null,
"postalCode": "10004",
"titleOfCourtesy": "Mr."
}]);
const employee1 = db.Employee.findOne({firstname: "Sara"});
const employee2 = db.Employee.findOne({firstname: "Don"});
const employee3 = db.Employee.findOne({firstname: "Judy"});
const employee4 = db.Employee.findOne({firstname: "Yael"});
const employee5 = db.Employee.findOne({firstname: "Sven"});
// Shippers
const shippers = db.Shipper.insertMany([{
"shipperId": 1,
"phone": "(503) 555-0137",
"companyName": "Shipper GVSUA"
}, {
"shipperId": 2,
"phone": "(425) 555-0136",
"companyName": "Shipper ETYNR"
}, {
"shipperId": 3,
"phone": "(415) 555-0138",
"companyName": "Shipper ZHISN"
}]);
// Get Shipper Ids
const shipper1 = db.Shipper.findOne({companyName: "Shipper GVSUA"});
const shipper2 = db.Shipper.findOne({companyName: "Shipper ETYNR"});
const shipper3 = db.Shipper.findOne({companyName: "Shipper ZHISN"});
// Orders
const orders = db.SalesOrder.insertMany([{
"freight": 32.38,
"shipCity": "Reims",
"shipName": "Ship to 85-B",
"orderDate": "2006-07-04 00:00:00.000000",
"shipperId": shipper1._id,
"custId": customer1._id,
"employeeId": employee1._id,
"shipRegion": null,
"shipAddress": "6789 rue de l'Abbaye",
"shipCountry": "France",
"shippedDate": "2006-07-16 00:00:00.000000",
"requiredDate": "2006-08-01 00:00:00.000000",
"shipPostalCode": "10345"
}, {
"freight": 11.61,
"shipCity": "Münster",
"shipName": "Ship to 79-C",
"orderDate": "2006-07-05 00:00:00.000000",
"shipperId": shipper1._id,
"custId": customer2._id,
"employeeId": employee1._id,
"shipRegion": null,
"shipAddress": "Luisenstr. 9012",
"shipCountry": "Germany",
"shippedDate": "2006-07-10 00:00:00.000000",
"requiredDate": "2006-08-16 00:00:00.000000",
"shipPostalCode": "10328"
}, {
"freight": 65.83,
"shipCity": "Rio de Janeiro",
"shipName": "Destination SCQXA",
"orderDate": "2006-07-08 00:00:00.000000",
"shipperId": shipper1._id,
"custId": customer3._id,
"employeeId": employee1._id,
"shipRegion": "RJ",
"shipAddress": "Rua do Paço, 7890",
"shipCountry": "Brazil",
"shippedDate": "2006-07-12 00:00:00.000000",
"requiredDate": "2006-08-05 00:00:00.000000",
"shipPostalCode": "10195"
}, {
"freight": 41.34,
"shipCity": "Lyon",
"shipName": "Ship to 84-A",
"orderDate": "2006-07-08 00:00:00.000000",
"shipperId": shipper1._id,
"custId": customer4._id,
"employeeId": employee1._id,
"shipRegion": null,
"shipAddress": "3456, rue du Commerce",
"shipCountry": "France",
"shippedDate": "2006-07-15 00:00:00.000000",
"requiredDate": "2006-08-05 00:00:00.000000",
"shipPostalCode": "10342"
}, {
"freight": 51.30,
"shipCity": "Charleroi",
"shipName": "Ship to 76-B",
"orderDate": "2006-07-09 00:00:00.000000",
"shipperId": shipper2._id,
"custId": customer5._id,
"employeeId": employee2._id,
"shipRegion": null,
"shipAddress": "Boulevard Tirou, 9012",
"shipCountry": "Belgium",
"shippedDate": "2006-07-11 00:00:00.000000",
"requiredDate": "2006-08-06 00:00:00.000000",
"shipPostalCode": "10318"
}, {
"freight": 58.17,
"shipCity": "Rio de Janeiro",
"shipName": "Destination JPAIY",
"orderDate": "2006-07-10 00:00:00.000000",
"shipperId": shipper2._id,
"custId": customer6._id,
"employeeId": employee2._id,
"shipRegion": "RJ",
"shipAddress": "Rua do Paço, 8901",
"shipCountry": "Brazil",
"shippedDate": "2006-07-16 00:00:00.000000",
"requiredDate": "2006-07-24 00:00:00.000000",
"shipPostalCode": "10196"
}, {
"freight": 22.98,
"shipCity": "Bern",
"shipName": "Destination YUJRD",
"orderDate": "2006-07-11 00:00:00.000000",
"shipperId": shipper2._id,
"custId": customer5._id,
"employeeId": employee2._id,
"shipRegion": null,
"shipAddress": "Hauptstr. 1234",
"shipCountry": "Switzerland",
"shippedDate": "2006-07-23 00:00:00.000000",
"requiredDate": "2006-08-08 00:00:00.000000",
"shipPostalCode": "10139"
}, {
"freight": 148.33,
"shipCity": "Genève",
"shipName": "Ship to 68-A",
"orderDate": "2006-07-12 00:00:00.000000",
"shipperId": shipper2._id,
"custId": customer7._id,
"employeeId": employee3._id,
"shipRegion": null,
"shipAddress": "Starenweg 6789",
"shipCountry": "Switzerland",
"shippedDate": "2006-07-15 00:00:00.000000",
"requiredDate": "2006-08-09 00:00:00.000000",
"shipPostalCode": "10294"
}, {
"freight": 13.97,
"shipCity": "Resende",
"shipName": "Ship to 88-B",
"orderDate": "2006-07-15 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer8._id,
"employeeId": employee3._id,
"shipRegion": "SP",
"shipAddress": "Rua do Mercado, 5678",
"shipCountry": "Brazil",
"shippedDate": "2006-07-17 00:00:00.000000",
"requiredDate": "2006-08-12 00:00:00.000000",
"shipPostalCode": "10354"
}, {
"freight": 81.91,
"shipCity": "San Cristóbal",
"shipName": "Destination JYDLM",
"orderDate": "2006-07-16 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer9._id,
"employeeId": employee4._id,
"shipRegion": "Táchira",
"shipAddress": "Carrera1234 con Ave. Carlos Soublette #8-35",
"shipCountry": "Venezuela",
"shippedDate": "2006-07-22 00:00:00.000000",
"requiredDate": "2006-08-13 00:00:00.000000",
"shipPostalCode": "10199"
}, {
"freight": 140.51,
"shipCity": "Graz",
"shipName": "Destination RVDMF",
"orderDate": "2006-07-17 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer10._id,
"employeeId": employee4._id,
"shipRegion": null,
"shipAddress": "Kirchgasse 9012",
"shipCountry": "Austria",
"shippedDate": "2006-07-23 00:00:00.000000",
"requiredDate": "2006-08-14 00:00:00.000000",
"shipPostalCode": "10157"
}, {
"freight": 3.25,
"shipCity": "México D.F.",
"shipName": "Destination LGGCH",
"orderDate": "2006-07-18 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer10._id,
"employeeId": employee5._id,
"shipRegion": null,
"shipAddress": "Sierras de Granada 9012",
"shipCountry": "Mexico",
"shippedDate": "2006-07-25 00:00:00.000000",
"requiredDate": "2006-08-15 00:00:00.000000",
"shipPostalCode": "10137"
}, {
"freight": 55.09,
"shipCity": "Köln",
"shipName": "Ship to 56-A",
"orderDate": "2006-07-19 00:00:00.000000",
"shipperId": shipper1._id,
"custId": customer10._id,
"employeeId": employee5._id,
"shipRegion": null,
"shipAddress": "Mehrheimerstr. 0123",
"shipCountry": "Germany",
"shippedDate": "2006-07-29 00:00:00.000000",
"requiredDate": "2006-08-16 00:00:00.000000",
"shipPostalCode": "10258"
}, {
"freight": 3.05,
"shipCity": "Rio de Janeiro",
"shipName": "Ship to 61-B",
"orderDate": "2006-07-19 00:00:00.000000",
"shipperId": shipper2._id,
"custId": customer10._id,
"employeeId": employee5._id,
"shipRegion": "RJ",
"shipAddress": "Rua da Panificadora, 6789",
"shipCountry": "Brazil",
"shippedDate": "2006-07-30 00:00:00.000000",
"requiredDate": "2006-08-16 00:00:00.000000",
"shipPostalCode": "10274"
}, {
"freight": 48.29,
"shipCity": "Albuquerque",
"shipName": "Ship to 65-B",
"orderDate": "2006-07-22 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer10._id,
"employeeId": employee5._id,
"shipRegion": "NM",
"shipAddress": "8901 Milton Dr.",
"shipCountry": "USA",
"shippedDate": "2006-07-25 00:00:00.000000",
"requiredDate": "2006-08-19 00:00:00.000000",
"shipPostalCode": "10286"
}, {
"freight": 146.06,
"shipCity": "Graz",
"shipName": "Destination FFXKT",
"orderDate": "2006-07-23 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer1._id,
"employeeId": employee5._id,
"shipRegion": null,
"shipAddress": "Kirchgasse 0123",
"shipCountry": "Austria",
"shippedDate": "2006-07-31 00:00:00.000000",
"requiredDate": "2006-08-20 00:00:00.000000",
"shipPostalCode": "10158"
}, {
"freight": 3.67,
"shipCity": "Bräcke",
"shipName": "Destination KBSBN",
"orderDate": "2006-07-24 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer2._id,
"employeeId": employee5._id,
"shipRegion": null,
"shipAddress": "Åkergatan 9012",
"shipCountry": "Sweden",
"shippedDate": "2006-08-23 00:00:00.000000",
"requiredDate": "2006-08-21 00:00:00.000000",
"shipPostalCode": "10167"
}, {
"freight": 55.28,
"shipCity": "Strasbourg",
"shipName": "Ship to 7-A",
"orderDate": "2006-07-25 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer3._id,
"employeeId": employee3._id,
"shipRegion": null,
"shipAddress": "0123, place Kléber",
"shipCountry": "France",
"shippedDate": "2006-08-12 00:00:00.000000",
"requiredDate": "2006-08-22 00:00:00.000000",
"shipPostalCode": "10329"
}, {
"freight": 25.73,
"shipCity": "Oulu",
"shipName": "Ship to 87-B",
"orderDate": "2006-07-26 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer3._id,
"employeeId": employee3._id,
"shipRegion": null,
"shipAddress": "Torikatu 2345",
"shipCountry": "Finland",
"shippedDate": "2006-07-31 00:00:00.000000",
"requiredDate": "2006-09-06 00:00:00.000000",
"shipPostalCode": "10351"
}, {
"freight": 208.58,
"shipCity": "München",
"shipName": "Destination VAPXU",
"orderDate": "2006-07-29 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer3._id,
"employeeId": employee3._id,
"shipRegion": null,
"shipAddress": "Berliner Platz 0123",
"shipCountry": "Germany",
"shippedDate": "2006-08-06 00:00:00.000000",
"requiredDate": "2006-08-26 00:00:00.000000",
"shipPostalCode": "10168"
}, {
"freight": 66.29,
"shipCity": "Caracas",
"shipName": "Destination QJVQH",
"orderDate": "2006-07-30 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer3._id,
"employeeId": employee3._id,
"shipRegion": "DF",
"shipAddress": "5ª Ave. Los Palos Grandes 5678",
"shipCountry": "Venezuela",
"shippedDate": "2006-08-02 00:00:00.000000",
"requiredDate": "2006-08-27 00:00:00.000000",
"shipPostalCode": "10193"
}, {
"freight": 4.56,
"shipCity": "Seattle",
"shipName": "Ship to 89-B",
"orderDate": "2006-07-31 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer4._id,
"employeeId": employee1._id,
"shipRegion": "WA",
"shipAddress": "8901 - 12th Ave. S.",
"shipCountry": "USA",
"shippedDate": "2006-08-09 00:00:00.000000",
"requiredDate": "2006-08-14 00:00:00.000000",
"shipPostalCode": "10357"
}, {
"freight": 136.54,
"shipCity": "Oulu",
"shipName": "Ship to 87-B",
"orderDate": "2006-08-01 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer4._id,
"employeeId": employee1._id,
"shipRegion": null,
"shipAddress": "Torikatu 2345",
"shipCountry": "Finland",
"shippedDate": "2006-08-02 00:00:00.000000",
"requiredDate": "2006-08-29 00:00:00.000000",
"shipPostalCode": "10351"
}, {
"freight": 4.54,
"shipCity": "Lander",
"shipName": "Ship to 75-C",
"orderDate": "2006-08-01 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer4._id,
"employeeId": employee1._id,
"shipRegion": "WY",
"shipAddress": "P.O. Box 7890",
"shipCountry": "USA",
"shippedDate": "2006-08-30 00:00:00.000000",
"requiredDate": "2006-08-29 00:00:00.000000",
"shipPostalCode": "10316"
}, {
"freight": 98.03,
"shipCity": "Albuquerque",
"shipName": "Ship to 65-A",
"orderDate": "2006-08-02 00:00:00.000000",
"shipperId": shipper3._id,
"custId": customer5._id,
"employeeId": employee1._id,
"shipRegion": "NM",
"shipAddress": "7890 Milton Dr.",
"shipCountry": "USA",
"shippedDate": "2006-08-06 00:00:00.000000",
"requiredDate": "2006-08-30 00:00:00.000000",
"shipPostalCode": "10285"
}]);
print("Data has been written to the collections");
================================================
FILE: demo/databases/mssql.sql
================================================
CREATE DATABASE llana;
USE llana;
CREATE TABLE [User] (
id int NOT NULL IDENTITY
,email varchar(255) NOT NULL
,password varchar(255) NOT NULL
,role varchar(30) check (role in ('ADMIN','USER')) DEFAULT 'USER'
,firstName varchar(255) DEFAULT NULL
,lastName varchar(255) DEFAULT NULL
,createdAt datetime2(0) DEFAULT GETDATE()
,updatedAt datetime2(0) DEFAULT GETDATE() /* ON UPDATE GETDATE() */
,deletedAt datetime2(0) DEFAULT NULL
,PRIMARY KEY (id)
,CONSTRAINT id UNIQUE (id)
,CONSTRAINT uniqueEmail UNIQUE (email)
) ;
SET IDENTITY_INSERT [User] ON;
INSERT INTO [User] (id, email, password, role, firstName, lastName, createdAt, updatedAt, deletedAt) VALUES (1, 'test@test.com', '$2a$10$jm6bM7acpRa18Vdy8FSqIu4yzWAdSgZgRtRrx8zknIeZhSqPJjJU.', 'ADMIN', 'Jon', 'Doe', '2000-01-01 00:00:01', '2000-01-01 00:00:00', NULL);
SET IDENTITY_INSERT [User] OFF;
CREATE TABLE UserApiKey (
id int NOT NULL IDENTITY
,userId int NOT NULL
,apiKey varchar(255) NOT NULL
,createdAt datetime2(0) DEFAULT GETDATE()
,updatedAt datetime2(0) DEFAULT GETDATE() /* ON UPDATE GETDATE() */
,deletedAt datetime2(0) DEFAULT NULL
,PRIMARY KEY (id)
,CONSTRAINT UserApiKeyUserId FOREIGN KEY (userId) REFERENCES [User] (id) ON DELETE CASCADE ON UPDATE NO ACTION
) ;
CREATE INDEX [user] ON UserApiKey (userId);
SET IDENTITY_INSERT UserApiKey ON;
INSERT INTO UserApiKey (id, userId, apiKey, createdAt, updatedAt, deletedAt) VALUES (1, 1, 'Ex@mp1eS$Cu7eAp!K3y', '2000-01-01 00:00:00', '2000-01-01 00:00:00', NULL);
SET IDENTITY_INSERT UserApiKey OFF;
CREATE TABLE Customer (
custId INT IDENTITY NOT NULL
,userId int NOT NULL
,companyName VARCHAR(40) NOT NULL
,contactName VARCHAR(60) NULL
,contactTitle VARCHAR(30) NULL
,address VARCHAR(60) NULL
,city VARCHAR(15) NULL
,region VARCHAR(15) NULL
,postalCode VARCHAR(10) NULL
,country VARCHAR(15) NULL
,phone VARCHAR(24) NULL
,mobile VARCHAR(24) NULL
,email VARCHAR(225) NULL
,fax VARCHAR(24) NULL
,createdAt datetime2(0) DEFAULT GETDATE()
,updatedAt datetime2(0) DEFAULT GETDATE() /* ON UPDATE GETDATE() */
,deletedAt datetime2(0) DEFAULT NULL
,PRIMARY KEY (custId)
,CONSTRAINT CustomerUserId FOREIGN KEY (userId) REFERENCES [User] (id) ON DELETE CASCADE ON UPDATE NO ACTION
) ;
CREATE TABLE Employee (
employeeId INT IDENTITY NOT NULL
,lastName VARCHAR(20) NOT NULL
,firstName VARCHAR(10) NOT NULL
,title VARCHAR(30) NULL
,titleOfCourtesy VARCHAR(25) NULL
,birthDate DATETIME2(0) NULL
,hireDate DATETIME2(0) NULL
,address VARCHAR(60) NULL
,city VARCHAR(15) NULL
,region VARCHAR(15) NULL
,postalCode VARCHAR(10) NULL
,country VARCHAR(15) NULL
,phone VARCHAR(24) NULL
,extension VARCHAR(4) NULL
,mobile VARCHAR(24) NULL
,email VARCHAR(225) NULL
,photo VARBINARY(max) NULL
,notes VARBINARY(max) NULL
,mgrId INT NULL
,photoPath VARCHAR(255) NULL
,createdAt datetime2(0) DEFAULT GETDATE()
,updatedAt datetime2(0) DEFAULT GETDATE() /* ON UPDATE GETDATE() */
,deletedAt datetime2(0) DEFAULT NULL
,PRIMARY KEY (employeeId)
) ;
CREATE TABLE Shipper (
shipperId INT IDENTITY NOT NULL
,companyName VARCHAR(40) NOT NULL
,phone VARCHAR(44) NULL
,createdAt datetime2(0) DEFAULT GETDATE()
,updatedAt datetime2(0) DEFAULT GETDATE() /* ON UPDATE GETDATE() */
,deletedAt datetime2(0) DEFAULT NULL
,PRIMARY KEY (ShipperId)
) ;
CREATE TABLE SalesOrder (
orderId INT IDENTITY NOT NULL
,custId INT NOT NULL
,employeeId INT NULL
,orderDate DATETIME2(0) NULL
,requiredDate DATETIME2(0) NULL
,shippedDate DATETIME2(0) NULL
,shipperId INT NOT NULL
,freight DECIMAL(10, 2) NULL
,shipName VARCHAR(40) NULL
,shipAddress VARCHAR(60) NULL
,shipCity VARCHAR(15) NULL
,shipRegion VARCHAR(15) NULL
,shipPostalCode VARCHAR(10) NULL
,shipCountry VARCHAR(15) NULL
,createdAt datetime2(0) DEFAULT GETDATE()
,updatedAt datetime2(0) DEFAULT GETDATE() /* ON UPDATE GETDATE() */
,deletedAt datetime2(0) DEFAULT NULL
,PRIMARY KEY (orderId)
, FOREIGN KEY (shipperId)
REFERENCES Shipper(shipperId)
,FOREIGN KEY (custId)
REFERENCES Customer(custId)
) ;
SET IDENTITY_INSERT Employee ON;
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(1, N'Davis', N'Sara', N'CEO', N'Ms.', '1958-12-08 00:00:00.000', '2002-05-01 00:00:00.000', N'7890 - 20th Ave. E., Apt. 2A', N'Seattle', N'WA', N'10003', N'USA', N'(206) 555-0101', NULL);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(2, N'Funk', N'Don', N'Vice President, Sales', N'Dr.', '1962-02-19 00:00:00.000', '2002-08-14 00:00:00.000', N'9012 W. Capital Way', N'Tacoma', N'WA', N'10001', N'USA', N'(206) 555-0100', 1);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(3, N'Lew', N'Judy', N'Sales Manager', N'Ms.', '1973-08-30 00:00:00.000', '2002-04-01 00:00:00.000', N'2345 Moss Bay Blvd.', N'Kirkland', N'WA', N'10007', N'USA', N'(206) 555-0103', 2);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(4, N'Peled', N'Yael', N'Sales Representative', N'Mrs.', '1947-09-19 00:00:00.000', '2003-05-03 00:00:00.000', N'5678 Old Redmond Rd.', N'Redmond', N'WA', N'10009', N'USA', N'(206) 555-0104', 3);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(5, N'Buck', N'Sven', N'Sales Manager', N'Mr.', '1965-03-04 00:00:00.000', '2003-10-17 00:00:00.000', N'8901 Garrett Hill', N'London', NULL, N'10004', N'UK', N'(71) 234-5678', 2);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(6, N'Suurs', N'Paul', N'Sales Representative', N'Mr.', '1973-07-02 00:00:00.000', '2003-10-17 00:00:00.000', N'3456 Coventry House, Miner Rd.', N'London', NULL, N'10005', N'UK', N'(71) 345-6789', 5);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(7, N'King', N'Russell', N'Sales Representative', N'Mr.', '1970-05-29 00:00:00.000', '2004-01-02 00:00:00.000', N'6789 Edgeham Hollow, Winchester Way', N'London', NULL, N'10002', N'UK', N'(71) 123-4567', 5);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(8, N'Cameron', N'Maria', N'Sales Representative', N'Ms.', '1968-01-09 00:00:00.000', '2004-03-05 00:00:00.000', N'4567 - 11th Ave. N.E.', N'Seattle', N'WA', N'10006', N'USA', N'(206) 555-0102', 3);
INSERT INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(9, N'Dolgopyatova', N'Zoya', N'Sales Representative', N'Ms.', '1976-01-27 00:00:00.000', '2004-11-15 00:00:00.000', N'1234 Houndstooth Rd.', N'London', NULL, N'10008', N'UK', N'(71) 456-7890', 5);
SET IDENTITY_INSERT Employee OFF;
SET IDENTITY_INSERT Shipper ON;
INSERT INTO Shipper(shipperId, companyName, phone)
VALUES(1, N'Shipper GVSUA', N'(503) 555-0137');
INSERT INTO Shipper(shipperId, companyName, phone)
VALUES(2, N'Shipper ETYNR', N'(425) 555-0136');
INSERT INTO Shipper(shipperId, companyName, phone)
VALUES(3, N'Shipper ZHISN', N'(415) 555-0138');
SET IDENTITY_INSERT Shipper OFF;
SET IDENTITY_INSERT Customer ON;
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(1, 1, N'Customer NRZBB', N'Allen, Michael', N'Sales Representative', N'Obere Str. 0123', N'Berlin', NULL, N'10092', N'Germany', N'030-3456789', N'030-0123456');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(2, 1, N'Customer MLTDN', N'Hassall, Mark', N'Owner', N'Avda. de la Constitución 5678', N'México D.F.', NULL, N'10077', N'Mexico', N'(5) 789-0123', N'(5) 456-7890');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(3, 1, N'Customer KBUDE', N'Peoples, John', N'Owner', N'Mataderos 7890', N'México D.F.', NULL, N'10097', N'Mexico', N'(5) 123-4567', NULL);
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(4, 1, N'Customer HFBZG', N'Arndt, Torsten', N'Sales Representative', N'7890 Hanover Sq.', N'London', NULL, N'10046', N'UK', N'(171) 456-7890', N'(171) 456-7891');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(5, 1, N'Customer HGVLZ', N'Higginbotham, Tom', N'Order Administrator', N'Berguvsvägen 5678', N'Luleå', NULL, N'10112', N'Sweden', N'0921-67 89 01', N'0921-23 45 67');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(6, 1, N'Customer XHXJV', N'Poland, Carole', N'Sales Representative', N'Forsterstr. 7890', N'Mannheim', NULL, N'10117', N'Germany', N'0621-67890', N'0621-12345');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(7, 1, N'Customer QXVLA', N'Bansal, Dushyant', N'Marketing Manager', N'2345, place Kléber', N'Strasbourg', NULL, N'10089', N'France', N'67.89.01.23', N'67.89.01.24');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(8, 1, N'Customer QUHWH', N'Ilyina, Julia', N'Owner', N'C/ Araquil, 0123', N'Madrid', NULL, N'10104', N'Spain', N'(91) 345 67 89', N'(91) 012 34 56');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(9, 1, N'Customer RTXGC', N'Raghav, Amritansh', N'Owner', N'6789, rue des Bouchers', N'Marseille', NULL, N'10105', N'France', N'23.45.67.89', N'23.45.67.80');
INSERT INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(10, 1, N'Customer EEALV', N'Bassols, Pilar Colome', N'Accounting Manager', N'8901 Tsawassen Blvd.', N'Tsawassen', N'BC', N'10111', N'Canada', N'(604) 901-2345', N'(604) 678-9012');
SET IDENTITY_INSERT Customer OFF;
SET IDENTITY_INSERT SalesOrder ON;
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(1, 1, 5, '2006-07-04 00:00:00.000', '2006-08-01 00:00:00.000', '2006-07-16 00:00:00.000', 3, 32.38, N'Ship to 85-B', N'6789 rue de l''Abbaye', N'Reims', NULL, N'10345', N'France');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(2, 2, 6, '2006-07-05 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-10 00:00:00.000', 1, 11.61, N'Ship to 79-C', N'Luisenstr. 9012', N'Münster', NULL, N'10328', N'Germany');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(3, 3, 4, '2006-07-08 00:00:00.000', '2006-08-05 00:00:00.000', '2006-07-12 00:00:00.000', 2, 65.83, N'Destination SCQXA', N'Rua do Paço, 7890', N'Rio de Janeiro', N'RJ', N'10195', N'Brazil');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(4, 4, 3, '2006-07-08 00:00:00.000', '2006-08-05 00:00:00.000', '2006-07-15 00:00:00.000', 1, 41.34, N'Ship to 84-A', N'3456, rue du Commerce', N'Lyon', NULL, N'10342', N'France');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(5, 5, 4, '2006-07-09 00:00:00.000', '2006-08-06 00:00:00.000', '2006-07-11 00:00:00.000', 2, 51.30, N'Ship to 76-B', N'Boulevard Tirou, 9012', N'Charleroi', NULL, N'10318', N'Belgium');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(6, 6, 3, '2006-07-10 00:00:00.000', '2006-07-24 00:00:00.000', '2006-07-16 00:00:00.000', 2, 58.17, N'Destination JPAIY', N'Rua do Paço, 8901', N'Rio de Janeiro', N'RJ', N'10196', N'Brazil');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(7, 7, 5, '2006-07-11 00:00:00.000', '2006-08-08 00:00:00.000', '2006-07-23 00:00:00.000', 2, 22.98, N'Destination YUJRD', N'Hauptstr. 1234', N'Bern', NULL, N'10139', N'Switzerland');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(8, 8, 9, '2006-07-12 00:00:00.000', '2006-08-09 00:00:00.000', '2006-07-15 00:00:00.000', 3, 148.33, N'Ship to 68-A', N'Starenweg 6789', N'Genève', NULL, N'10294', N'Switzerland');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(9, 9, 3, '2006-07-15 00:00:00.000', '2006-08-12 00:00:00.000', '2006-07-17 00:00:00.000', 2, 13.97, N'Ship to 88-B', N'Rua do Mercado, 5678', N'Resende', N'SP', N'10354', N'Brazil');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(10, 10, 4, '2006-07-16 00:00:00.000', '2006-08-13 00:00:00.000', '2006-07-22 00:00:00.000', 3, 81.91, N'Destination JYDLM', N'Carrera1234 con Ave. Carlos Soublette #8-35', N'San Cristóbal', N'Táchira', N'10199', N'Venezuela');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(11, 1, 1, '2006-07-17 00:00:00.000', '2006-08-14 00:00:00.000', '2006-07-23 00:00:00.000', 1, 140.51, N'Destination RVDMF', N'Kirchgasse 9012', N'Graz', NULL, N'10157', N'Austria');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(12, 2, 4, '2006-07-18 00:00:00.000', '2006-08-15 00:00:00.000', '2006-07-25 00:00:00.000', 3, 3.25, N'Destination LGGCH', N'Sierras de Granada 9012', N'México D.F.', NULL, N'10137', N'Mexico');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(13, 3, 4, '2006-07-19 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-29 00:00:00.000', 1, 55.09, N'Ship to 56-A', N'Mehrheimerstr. 0123', N'Köln', NULL, N'10258', N'Germany');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(14, 4, 4, '2006-07-19 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-30 00:00:00.000', 2, 3.05, N'Ship to 61-B', N'Rua da Panificadora, 6789', N'Rio de Janeiro', N'RJ', N'10274', N'Brazil');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(15, 5, 8, '2006-07-22 00:00:00.000', '2006-08-19 00:00:00.000', '2006-07-25 00:00:00.000', 3, 48.29, N'Ship to 65-B', N'8901 Milton Dr.', N'Albuquerque', N'NM', N'10286', N'USA');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(16, 6, 9, '2006-07-23 00:00:00.000', '2006-08-20 00:00:00.000', '2006-07-31 00:00:00.000', 3, 146.06, N'Destination FFXKT', N'Kirchgasse 0123', N'Graz', NULL, N'10158', N'Austria');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(17, 7, 6, '2006-07-24 00:00:00.000', '2006-08-21 00:00:00.000', '2006-08-23 00:00:00.000', 3, 3.67, N'Destination KBSBN', N'Åkergatan 9012', N'Bräcke', NULL, N'10167', N'Sweden');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(18, 8, 2, '2006-07-25 00:00:00.000', '2006-08-22 00:00:00.000', '2006-08-12 00:00:00.000', 1, 55.28, N'Ship to 7-A', N'0123, place Kléber', N'Strasbourg', NULL, N'10329', N'France');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(19, 9, 3, '2006-07-26 00:00:00.000', '2006-09-06 00:00:00.000', '2006-07-31 00:00:00.000', 3, 25.73, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(20, 10, 4, '2006-07-29 00:00:00.000', '2006-08-26 00:00:00.000', '2006-08-06 00:00:00.000', 1, 208.58, N'Destination VAPXU', N'Berliner Platz 0123', N'München', NULL, N'10168', N'Germany');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(21, 1, 8, '2006-07-30 00:00:00.000', '2006-08-27 00:00:00.000', '2006-08-02 00:00:00.000', 3, 66.29, N'Destination QJVQH', N'5ª Ave. Los Palos Grandes 5678', N'Caracas', N'DF', N'10193', N'Venezuela');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(22, 2, 5, '2006-07-31 00:00:00.000', '2006-08-14 00:00:00.000', '2006-08-09 00:00:00.000', 1, 4.56, N'Ship to 89-B', N'8901 - 12th Ave. S.', N'Seattle', N'WA', N'10357', N'USA');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(23, 3, 1, '2006-08-01 00:00:00.000', '2006-08-29 00:00:00.000', '2006-08-02 00:00:00.000', 1, 136.54, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(24, 4, 6, '2006-08-01 00:00:00.000', '2006-08-29 00:00:00.000', '2006-08-30 00:00:00.000', 2, 4.54, N'Ship to 75-C', N'P.O. Box 7890', N'Lander', N'WY', N'10316', N'USA');
INSERT INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(25, 5, 6, '2006-08-02 00:00:00.000', '2006-08-30 00:00:00.000', '2006-08-06 00:00:00.000', 2, 98.03, N'Ship to 65-A', N'7890 Milton Dr.', N'Albuquerque', N'NM', N'10285', N'USA');
SET IDENTITY_INSERT SalesOrder OFF;
================================================
FILE: demo/databases/mysql.sql
================================================
CREATE DATABASE IF NOT EXISTS llana;
USE llana;
CREATE TABLE IF NOT EXISTS `User` (
id int NOT NULL AUTO_INCREMENT
,email varchar(255) NOT NULL
,password varchar(255) NOT NULL
,role enum('ADMIN','USER') DEFAULT 'USER'
,firstName varchar(255) DEFAULT NULL
,lastName varchar(255) DEFAULT NULL
,createdAt datetime DEFAULT CURRENT_TIMESTAMP
,updatedAt datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
,deletedAt datetime DEFAULT NULL
,PRIMARY KEY (id)
,UNIQUE KEY id (id)
,UNIQUE KEY uniqueEmail (email)
) ENGINE=INNODB;
INSERT IGNORE INTO `User` (`id`, `email`, `password`, `role`, `firstName`, `lastName`, `createdAt`, `updatedAt`, `deletedAt`) VALUES (1, 'test@test.com', '$2a$10$jm6bM7acpRa18Vdy8FSqIu4yzWAdSgZgRtRrx8zknIeZhSqPJjJU.', 'ADMIN', 'Jon', 'Doe', '2000-01-01 00:00:01', '2000-01-01 00:00:00', NULL);
CREATE TABLE IF NOT EXISTS `UserApiKey` (
id int NOT NULL AUTO_INCREMENT
,userId int NOT NULL
,apiKey varchar(255) NOT NULL
,createdAt datetime DEFAULT CURRENT_TIMESTAMP
,updatedAt datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
,deletedAt datetime DEFAULT NULL
,PRIMARY KEY (id)
,KEY user (userId)
,CONSTRAINT UserApiKeyUserId FOREIGN KEY (userId) REFERENCES User (id) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE=INNODB;
INSERT IGNORE INTO `UserApiKey` (`id`, `userId`, `apiKey`, `createdAt`, `updatedAt`, `deletedAt`) VALUES (1, 1, 'Ex@mp1eS$Cu7eAp!K3y', '2000-01-01 00:00:00', '2000-01-01 00:00:00', NULL);
CREATE TABLE IF NOT EXISTS Customer (
custId INT AUTO_INCREMENT NOT NULL
,userId int NOT NULL
,companyName VARCHAR(40) NOT NULL
,contactName VARCHAR(60) NULL
,contactTitle VARCHAR(30) NULL
,address VARCHAR(60) NULL
,city VARCHAR(15) NULL
,region VARCHAR(15) NULL
,postalCode VARCHAR(10) NULL
,country VARCHAR(15) NULL
,phone VARCHAR(24) NULL
,mobile VARCHAR(24) NULL
,email VARCHAR(225) NULL
,fax VARCHAR(24) NULL
,createdAt datetime DEFAULT CURRENT_TIMESTAMP
,updatedAt datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
,deletedAt datetime DEFAULT NULL
,PRIMARY KEY (custId)
,CONSTRAINT CustomerUserId FOREIGN KEY (userId) REFERENCES User (id) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS Employee (
employeeId INT AUTO_INCREMENT NOT NULL
,lastName VARCHAR(20) NOT NULL
,firstName VARCHAR(10) NOT NULL
,title VARCHAR(30) NULL
,titleOfCourtesy VARCHAR(25) NULL
,birthDate DATETIME NULL
,hireDate DATETIME NULL
,address VARCHAR(60) NULL
,city VARCHAR(15) NULL
,region VARCHAR(15) NULL
,postalCode VARCHAR(10) NULL
,country VARCHAR(15) NULL
,phone VARCHAR(24) NULL
,extension VARCHAR(4) NULL
,mobile VARCHAR(24) NULL
,email VARCHAR(225) NULL
,photo BLOB NULL
,notes TEXT NULL
,photoPath VARCHAR(255) NULL
,mgrid INT NULL
,createdAt datetime DEFAULT CURRENT_TIMESTAMP
,updatedAt datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
,deletedAt datetime DEFAULT NULL
,PRIMARY KEY (employeeId)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS Shipper (
shipperId INT AUTO_INCREMENT NOT NULL
,companyName VARCHAR(40) NOT NULL
,phone VARCHAR(44) NULL
,createdAt datetime DEFAULT CURRENT_TIMESTAMP
,updatedAt datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
,deletedAt datetime DEFAULT NULL
,PRIMARY KEY (ShipperId)
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS SalesOrder (
orderId INT AUTO_INCREMENT NOT NULL
,custId INT NOT NULL
,employeeId INT NULL
,orderDate DATETIME NULL
,requiredDate DATETIME NULL
,shippedDate DATETIME NULL
,shipperId INT NOT NULL
,freight DECIMAL(10, 2) NULL
,shipName VARCHAR(40) NULL
,shipAddress VARCHAR(60) NULL
,shipCity VARCHAR(15) NULL
,shipRegion VARCHAR(15) NULL
,shipPostalCode VARCHAR(10) NULL
,shipCountry VARCHAR(15) NULL
,createdAt datetime DEFAULT CURRENT_TIMESTAMP
,updatedAt datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
,deletedAt datetime DEFAULT NULL
,PRIMARY KEY (orderId)
, FOREIGN KEY (shipperId)
REFERENCES Shipper(shipperId)
,FOREIGN KEY (custId)
REFERENCES Customer(custId)
) ENGINE=INNODB;
-- Populate Employess table
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(1, N'Davis', N'Sara', N'CEO', N'Ms.', '1958-12-08 00:00:00.000', '2002-05-01 00:00:00.000', N'7890 - 20th Ave. E., Apt. 2A', N'Seattle', N'WA', N'10003', N'USA', N'(206) 555-0101', NULL);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(2, N'Funk', N'Don', N'Vice President, Sales', N'Dr.', '1962-02-19 00:00:00.000', '2002-08-14 00:00:00.000', N'9012 W. Capital Way', N'Tacoma', N'WA', N'10001', N'USA', N'(206) 555-0100', 1);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(3, N'Lew', N'Judy', N'Sales Manager', N'Ms.', '1973-08-30 00:00:00.000', '2002-04-01 00:00:00.000', N'2345 Moss Bay Blvd.', N'Kirkland', N'WA', N'10007', N'USA', N'(206) 555-0103', 2);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(4, N'Peled', N'Yael', N'Sales Representative', N'Mrs.', '1947-09-19 00:00:00.000', '2003-05-03 00:00:00.000', N'5678 Old Redmond Rd.', N'Redmond', N'WA', N'10009', N'USA', N'(206) 555-0104', 3);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(5, N'Buck', N'Sven', N'Sales Manager', N'Mr.', '1965-03-04 00:00:00.000', '2003-10-17 00:00:00.000', N'8901 Garrett Hill', N'London', NULL, N'10004', N'UK', N'(71) 234-5678', 2);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(6, N'Suurs', N'Paul', N'Sales Representative', N'Mr.', '1973-07-02 00:00:00.000', '2003-10-17 00:00:00.000', N'3456 Coventry House, Miner Rd.', N'London', NULL, N'10005', N'UK', N'(71) 345-6789', 5);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(7, N'King', N'Russell', N'Sales Representative', N'Mr.', '1970-05-29 00:00:00.000', '2004-01-02 00:00:00.000', N'6789 Edgeham Hollow, Winchester Way', N'London', NULL, N'10002', N'UK', N'(71) 123-4567', 5);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(8, N'Cameron', N'Maria', N'Sales Representative', N'Ms.', '1968-01-09 00:00:00.000', '2004-03-05 00:00:00.000', N'4567 - 11th Ave. N.E.', N'Seattle', N'WA', N'10006', N'USA', N'(206) 555-0102', 3);
INSERT IGNORE INTO Employee(employeeId, lastName, firstName, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalCode, country, phone, mgrid)
VALUES(9, N'Dolgopyatova', N'Zoya', N'Sales Representative', N'Ms.', '1976-01-27 00:00:00.000', '2004-11-15 00:00:00.000', N'1234 Houndstooth Rd.', N'London', NULL, N'10008', N'UK', N'(71) 456-7890', 5);
-- ---
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(1, 1, N'Customer NRZBB', N'Allen, Michael', N'Sales Representative', N'Obere Str. 0123', N'Berlin', NULL, N'10092', N'Germany', N'030-3456789', N'030-0123456');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(2, 1, N'Customer MLTDN', N'Hassall, Mark', N'Owner', N'Avda. de la Constitución 5678', N'México D.F.', NULL, N'10077', N'Mexico', N'(5) 789-0123', N'(5) 456-7890');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(3, 1, N'Customer KBUDE', N'Peoples, John', N'Owner', N'Mataderos 7890', N'México D.F.', NULL, N'10097', N'Mexico', N'(5) 123-4567', NULL);
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(4, 1, N'Customer HFBZG', N'Arndt, Torsten', N'Sales Representative', N'7890 Hanover Sq.', N'London', NULL, N'10046', N'UK', N'(171) 456-7890', N'(171) 456-7891');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(5, 1, N'Customer HGVLZ', N'Higginbotham, Tom', N'Order Administrator', N'Berguvsvägen 5678', N'Luleå', NULL, N'10112', N'Sweden', N'0921-67 89 01', N'0921-23 45 67');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(6, 1, N'Customer XHXJV', N'Poland, Carole', N'Sales Representative', N'Forsterstr. 7890', N'Mannheim', NULL, N'10117', N'Germany', N'0621-67890', N'0621-12345');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(7, 1, N'Customer QXVLA', N'Bansal, Dushyant', N'Marketing Manager', N'2345, place Kléber', N'Strasbourg', NULL, N'10089', N'France', N'67.89.01.23', N'67.89.01.24');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(8, 1, N'Customer QUHWH', N'Ilyina, Julia', N'Owner', N'C/ Araquil, 0123', N'Madrid', NULL, N'10104', N'Spain', N'(91) 345 67 89', N'(91) 012 34 56');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(9, 1, N'Customer RTXGC', N'Raghav, Amritansh', N'Owner', N'6789, rue des Bouchers', N'Marseille', NULL, N'10105', N'France', N'23.45.67.89', N'23.45.67.80');
INSERT IGNORE INTO Customer(custId, userId, companyName, contactName, contactTitle, address, city, region, postalCode, country, phone, fax)
VALUES(10,1, N'Customer EEALV', N'Bassols, Pilar Colome', N'Accounting Manager', N'8901 Tsawassen Blvd.', N'Tsawassen', N'BC', N'10111', N'Canada', N'(604) 901-2345', N'(604) 678-9012');
INSERT IGNORE INTO Shipper(shipperId, companyName, phone)
VALUES(1, N'Shipper GVSUA', N'(503) 555-0137');
INSERT IGNORE INTO Shipper(shipperId, companyName, phone)
VALUES(2, N'Shipper ETYNR', N'(425) 555-0136');
INSERT IGNORE INTO Shipper(shipperId, companyName, phone)
VALUES(3, N'Shipper ZHISN', N'(415) 555-0138');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(1, 1, 5, '2006-07-04 00:00:00.000', '2006-08-01 00:00:00.000', '2006-07-16 00:00:00.000', 3, 32.38, N'Ship to 85-B', N'6789 rue de l''Abbaye', N'Reims', NULL, N'10345', N'France');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(2, 2, 6, '2006-07-05 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-10 00:00:00.000', 1, 11.61, N'Ship to 79-C', N'Luisenstr. 9012', N'Münster', NULL, N'10328', N'Germany');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(3, 3, 4, '2006-07-08 00:00:00.000', '2006-08-05 00:00:00.000', '2006-07-12 00:00:00.000', 2, 65.83, N'Destination SCQXA', N'Rua do Paço, 7890', N'Rio de Janeiro', N'RJ', N'10195', N'Brazil');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(4, 4, 3, '2006-07-08 00:00:00.000', '2006-08-05 00:00:00.000', '2006-07-15 00:00:00.000', 1, 41.34, N'Ship to 84-A', N'3456, rue du Commerce', N'Lyon', NULL, N'10342', N'France');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(5, 5, 4, '2006-07-09 00:00:00.000', '2006-08-06 00:00:00.000', '2006-07-11 00:00:00.000', 2, 51.30, N'Ship to 76-B', N'Boulevard Tirou, 9012', N'Charleroi', NULL, N'10318', N'Belgium');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(6, 6, 3, '2006-07-10 00:00:00.000', '2006-07-24 00:00:00.000', '2006-07-16 00:00:00.000', 2, 58.17, N'Destination JPAIY', N'Rua do Paço, 8901', N'Rio de Janeiro', N'RJ', N'10196', N'Brazil');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(7, 7, 5,'2006-07-11 00:00:00.000', '2006-08-08 00:00:00.000', '2006-07-23 00:00:00.000', 2, 22.98, N'Destination YUJRD', N'Hauptstr. 1234', N'Bern', NULL, N'10139', N'Switzerland');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(8, 8, 9, '2006-07-12 00:00:00.000', '2006-08-09 00:00:00.000', '2006-07-15 00:00:00.000', 3, 148.33, N'Ship to 68-A', N'Starenweg 6789', N'Genève', NULL, N'10294', N'Switzerland');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(9, 9, 3, '2006-07-15 00:00:00.000', '2006-08-12 00:00:00.000', '2006-07-17 00:00:00.000', 2, 13.97, N'Ship to 88-B', N'Rua do Mercado, 5678', N'Resende', N'SP', N'10354', N'Brazil');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(10, 10, 4, '2006-07-16 00:00:00.000', '2006-08-13 00:00:00.000', '2006-07-22 00:00:00.000', 3, 81.91, N'Destination JYDLM', N'Carrera1234 con Ave. Carlos Soublette #8-35', N'San Cristóbal', N'Táchira', N'10199', N'Venezuela');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(11, 1, 1, '2006-07-17 00:00:00.000', '2006-08-14 00:00:00.000', '2006-07-23 00:00:00.000', 1, 140.51, N'Destination RVDMF', N'Kirchgasse 9012', N'Graz', NULL, N'10157', N'Austria');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(12, 2, 4, '2006-07-18 00:00:00.000', '2006-08-15 00:00:00.000', '2006-07-25 00:00:00.000', 3, 3.25, N'Destination LGGCH', N'Sierras de Granada 9012', N'México D.F.', NULL, N'10137', N'Mexico');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(13, 3, 4, '2006-07-19 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-29 00:00:00.000', 1, 55.09, N'Ship to 56-A', N'Mehrheimerstr. 0123', N'Köln', NULL, N'10258', N'Germany');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(14, 4, 4,'2006-07-19 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-30 00:00:00.000', 2, 3.05, N'Ship to 61-B', N'Rua da Panificadora, 6789', N'Rio de Janeiro', N'RJ', N'10274', N'Brazil');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(15, 5, 8, '2006-07-22 00:00:00.000', '2006-08-19 00:00:00.000', '2006-07-25 00:00:00.000', 3, 48.29, N'Ship to 65-B', N'8901 Milton Dr.', N'Albuquerque', N'NM', N'10286', N'USA');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(16, 6, 9, '2006-07-23 00:00:00.000', '2006-08-20 00:00:00.000', '2006-07-31 00:00:00.000', 3, 146.06, N'Destination FFXKT', N'Kirchgasse 0123', N'Graz', NULL, N'10158', N'Austria');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(17, 7, 6, '2006-07-24 00:00:00.000', '2006-08-21 00:00:00.000', '2006-08-23 00:00:00.000', 3, 3.67, N'Destination KBSBN', N'Åkergatan 9012', N'Bräcke', NULL, N'10167', N'Sweden');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(18, 8, 2, '2006-07-25 00:00:00.000', '2006-08-22 00:00:00.000', '2006-08-12 00:00:00.000', 1, 55.28, N'Ship to 7-A', N'0123, place Kléber', N'Strasbourg', NULL, N'10329', N'France');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(19, 9, 3, '2006-07-26 00:00:00.000', '2006-09-06 00:00:00.000', '2006-07-31 00:00:00.000', 3, 25.73, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(20, 10, 4, '2006-07-29 00:00:00.000', '2006-08-26 00:00:00.000', '2006-08-06 00:00:00.000', 1, 208.58, N'Destination VAPXU', N'Berliner Platz 0123', N'München', NULL, N'10168', N'Germany');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(21, 1, 8, '2006-07-30 00:00:00.000', '2006-08-27 00:00:00.000', '2006-08-02 00:00:00.000', 3, 66.29, N'Destination QJVQH', N'5ª Ave. Los Palos Grandes 5678', N'Caracas', N'DF', N'10193', N'Venezuela');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(22, 2, 5, '2006-07-31 00:00:00.000', '2006-08-14 00:00:00.000', '2006-08-09 00:00:00.000', 1, 4.56, N'Ship to 89-B', N'8901 - 12th Ave. S.', N'Seattle', N'WA', N'10357', N'USA');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(23, 3, 1, '2006-08-01 00:00:00.000', '2006-08-29 00:00:00.000', '2006-08-02 00:00:00.000', 1, 136.54, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(24, 4, 6, '2006-08-01 00:00:00.000', '2006-08-29 00:00:00.000', '2006-08-30 00:00:00.000', 2, 4.54, N'Ship to 75-C', N'P.O. Box 7890', N'Lander', N'WY', N'10316', N'USA');
INSERT IGNORE INTO SalesOrder(orderId, custId, employeeId, orderDate, requiredDate, shippedDate, shipperId, freight, shipName, shipAddress, shipCity, shipRegion, shipPostalCode, shipCountry)
VALUES(25, 5, 6, '2006-08-02 00:00:00.000', '2006-08-30 00:00:00.000', '2006-08-06 00:00:00.000', 2, 98.03, N'Ship to 65-A', N'7890 Milton Dr.', N'Albuquerque', N'NM', N'10285', N'USA');
================================================
FILE: demo/databases/postgres.sql
================================================
DROP TABLE IF EXISTS "User";
DROP TYPE IF EXISTS userrole;
CREATE TYPE userrole AS ENUM ('ADMIN','USER');
CREATE TABLE "User"
(
"id" SERIAL PRIMARY KEY NOT NULL,
"email" VARCHAR (255) NOT NULL,
"password" VARCHAR (255) NOT NULL,
"role" userrole NOT NULL,
"firstName" VARCHAR (255) NULL,
"lastName" VARCHAR (255) NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"deletedAt" TIMESTAMP NULL,
UNIQUE("email")
);
INSERT INTO "User"("email", "password", "role", "firstName", "lastName", "createdAt", "updatedAt", "deletedAt")
VALUES('test@test.com', '$2a$10$jm6bM7acpRa18Vdy8FSqIu4yzWAdSgZgRtRrx8zknIeZhSqPJjJU.', 'ADMIN', 'Jon', 'Doe', '2000-01-01 00:00:01', '2000-01-01 00:00:00', NULL);
DROP TABLE IF EXISTS "UserApiKey";
CREATE TABLE "UserApiKey"
(
"id" SERIAL PRIMARY KEY NOT NULL,
"userId" INT NOT NULL,
"apiKey" VARCHAR (255) NOT NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"deletedAt" TIMESTAMP NULL,
CONSTRAINT UserApiKeyUserId FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE RESTRICT
);
INSERT INTO "UserApiKey"("userId", "apiKey", "createdAt", "updatedAt", "deletedAt")
VALUES (1, 'Ex@mp1eS$Cu7eAp!K3y', '2000-01-01 00:00:01', '2000-01-01 00:00:01', NULL);
DROP TABLE IF EXISTS "Customer";
CREATE TABLE "Customer"
(
"custId" SERIAL PRIMARY KEY NOT NULL,
"userId" INT NOT NULL,
"companyName" VARCHAR (40) NOT NULL,
"email" VARCHAR (255) NULL,
"contactName" VARCHAR (60) NULL,
"contactTitle" VARCHAR (30) NULL,
address VARCHAR (60) NULL,
city VARCHAR (15) NULL,
region VARCHAR (15) NULL,
"postalCode" VARCHAR (10) NULL,
country VARCHAR (15) NULL,
phone VARCHAR (24) NULL,
fax VARCHAR (24) NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"deletedAt" TIMESTAMP NULL,
CONSTRAINT CustomerUserId FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE RESTRICT
);
DROP TABLE IF EXISTS "Employee";
CREATE TABLE "Employee"
(
"employeeId" SERIAL PRIMARY KEY NOT NULL,
"email" VARCHAR (255) NULL,
"lastName" VARCHAR (20) NOT NULL,
"firstName" VARCHAR (10) NOT NULL,
title VARCHAR (30) NULL,
"titleOfCourtesy" VARCHAR (25) NULL,
"birthDate" TIMESTAMP NULL,
"hireDate" TIMESTAMP NULL,
address VARCHAR (60) NULL,
city VARCHAR (15) NULL,
region VARCHAR (15) NULL,
"postalCode" VARCHAR (10) NULL,
country VARCHAR (15) NULL,
phone VARCHAR (24) NULL,
extension VARCHAR (4) NULL,
photo BYTEA NULL,
notes TEXT NULL,
mobile VARCHAR (30) NULL,
"photoPath" VARCHAR (255) NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"deletedAt" TIMESTAMP NULL
);
DROP TABLE IF EXISTS "Supplier";
CREATE TABLE "Supplier"
(
"supplierId" SERIAL PRIMARY KEY NOT NULL,
"companyName" VARCHAR (40) NOT NULL,
"contactName" VARCHAR (60) NULL,
"contactTitle" VARCHAR (30) NULL,
address VARCHAR (60) NULL,
city VARCHAR (15) NULL,
region VARCHAR (15) NULL,
"postalCode" VARCHAR (10) NULL,
country VARCHAR (15) NULL,
phone VARCHAR (24) NULL,
fax VARCHAR (24) NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"deletedAt" TIMESTAMP NULL
);
DROP TABLE IF EXISTS "Shipper";
CREATE TABLE "Shipper"
(
"shipperId" SERIAL NOT NULL,
"companyName" VARCHAR (40) NOT NULL,
phone VARCHAR (44) NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ( "shipperId" )
);
DROP TABLE IF EXISTS "SalesOrder";
CREATE TABLE "SalesOrder"
(
"orderId" SERIAL NOT NULL,
"custId" INT NULL,
"employeeId" INT NULL,
"orderDate" TIMESTAMP NULL,
"requiredDate" TIMESTAMP NULL,
"shippedDate" TIMESTAMP NULL,
"shipperId" INT NULL,
"freight" DECIMAL(10, 2) NULL,
"shipName" VARCHAR (40) NULL,
"shipAddress" VARCHAR (60) NULL,
"shipCity" VARCHAR (15) NULL,
"shipRegion" VARCHAR (15) NULL,
"shipPostalCode" VARCHAR (10) NULL,
"shipCountry" VARCHAR (15) NULL,
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"deletedAt" TIMESTAMP NULL,
PRIMARY KEY ( "orderId" ),
FOREIGN KEY ( "custId" ) REFERENCES "Customer" ( "custId" ) ON DELETE SET NULL ON UPDATE RESTRICT,
FOREIGN KEY ( "employeeId" ) REFERENCES "Employee" ( "employeeId" ) ON DELETE SET NULL ON UPDATE RESTRICT,
FOREIGN KEY ( "shipperId" ) REFERENCES "Shipper" ( "shipperId" ) ON DELETE SET NULL ON UPDATE RESTRICT
);
-- Populate Employess table
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Davis', N'Sara', N'CEO', N'Ms.', '19581208 00:00:00.000', '20020501 00:00:00.000', N'7890 - 20th Ave. E., Apt. 2A', N'Seattle', N'WA', N'10003', N'USA', N'(206) 555-0101');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Funk', N'Don', N'Vice President, Sales', N'Dr.', '19620219 00:00:00.000', '20020814 00:00:00.000', N'9012 W. Capital Way', N'Tacoma', N'WA', N'10001', N'USA', N'(206) 555-0100');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Lew', N'Judy', N'Sales Manager', N'Ms.', '19730830 00:00:00.000', '20020401 00:00:00.000', N'2345 Moss Bay Blvd.', N'Kirkland', N'WA', N'10007', N'USA', N'(206) 555-0103');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Peled', N'Yael', N'Sales Representative', N'Mrs.', '19470919 00:00:00.000', '20030503 00:00:00.000', N'5678 Old Redmond Rd.', N'Redmond', N'WA', N'10009', N'USA', N'(206) 555-0104');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Buck', N'Sven', N'Sales Manager', N'Mr.', '19650304 00:00:00.000', '20031017 00:00:00.000', N'8901 Garrett Hill', N'London', NULL, N'10004', N'UK', N'(71) 234-5678');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Suurs', N'Paul', N'Sales Representative', N'Mr.', '19730702 00:00:00.000', '20031017 00:00:00.000', N'3456 Coventry House, Miner Rd.', N'London', NULL, N'10005', N'UK', N'(71) 345-6789');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'King', N'Russell', N'Sales Representative', N'Mr.', '19700529 00:00:00.000', '20040102 00:00:00.000', N'6789 Edgeham Hollow, Winchester Way', N'London', NULL, N'10002', N'UK', N'(71) 123-4567');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Cameron', N'Maria', N'Sales Representative', N'Ms.', '19680109 00:00:00.000', '20040305 00:00:00.000', N'4567 - 11th Ave. N.E.', N'Seattle', N'WA', N'10006', N'USA', N'(206) 555-0102');
INSERT INTO "Employee"("lastName", "firstName", "title", "titleOfCourtesy", "birthDate", "hireDate", "address", "city", "region", "postalCode", "country", "phone")
VALUES(N'Dolgopyatova', N'Zoya', N'Sales Representative', N'Ms.', '19760127 00:00:00.000', '20041115 00:00:00.000', N'1234 Houndstooth Rd.', N'London', NULL, N'10008', N'UK', N'(71) 456-7890');
-- --- Populate "Supplier"
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'"Supplier" SWRXU', N'Adolphi, Stephan', N'Purchasing Manager', N'2345 Gilbert St.', N'London', NULL, N'10023', N'UK', N'(171) 456-7890', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(2, N'"Supplier" VHQZD', N'Hance, Jim', N'Order Administrator', N'P.O. Box 5678', N'New Orleans', N'LA', N'10013', N'USA', N'(100) 555-0111', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(3, N'"Supplier" STUAZ', N'Parovszky, Alfons', N'Sales Representative', N'1234 Oxford Rd.', N'Ann Arbor', N'MI', N'10026', N'USA', N'(313) 555-0109', N'(313) 555-0112');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(4, N'"Supplier" QOVFD', N'Balázs, Erzsébet', N'Marketing Manager', N'7890 Sekimai Musashino-shi', N'Tokyo', NULL, N'10011', N'Japan', N'(03) 6789-0123', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(5, N'"Supplier" EQPNC', N'Holm, Michael', N'Export Administrator', N'Calle del Rosal 4567', N'Oviedo', N'Asturias', N'10029', N'Spain', N'(98) 123 45 67', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(6, N'"Supplier" QWUSF', N'Popkova, Darya', N'Marketing Representative', N'8901 Setsuko Chuo-ku', N'Osaka', NULL, N'10028', N'Japan', N'(06) 789-0123', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(7, N'"Supplier" GQRCV', N'Ræbild, Jesper', N'Marketing Manager', N'5678 Rose St. Moonie Ponds', N'Melbourne', N'Victoria', N'10018', N'Australia', N'(03) 123-4567', N'(03) 456-7890');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(8, N'"Supplier" BWGYE', N'Iallo, Lucio', N'Sales Representative', N'9012 King''s Way', N'Manchester', NULL, N'10021', N'UK', N'(161) 567-8901', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(9, N'"Supplier" QQYEU', N'Basalik, Evan', N'Sales Agent', N'Kaloadagatan 4567', N'Göteborg', NULL, N'10022', N'Sweden', N'031-345 67 89', N'031-678 90 12');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(10, N'"Supplier" UNAHG', N'Barnett, Dave', N'Marketing Manager', N'Av. das Americanas 2345', N'Sao Paulo', NULL, N'10034', N'Brazil', N'(11) 345 6789', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(11, N'"Supplier" ZPYVS', N'Jain, Mukesh', N'Sales Manager', N'Tiergartenstraße 3456', N'Berlin', NULL, N'10016', N'Germany', N'(010) 3456789', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(12, N'"Supplier" SVIYA', N'Regev, Barak', N'International Marketing Mgr.', N'Bogenallee 9012', N'Frankfurt', NULL, N'10024', N'Germany', N'(069) 234567', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(13, N'"Supplier" TEGSC', N'Brehm, Peter', N'Coordinator Foreign Markets', N'Frahmredder 3456', N'Cuxhaven', NULL, N'10019', N'Germany', N'(04721) 1234', N'(04721) 2345');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(14, N'"Supplier" KEREV', N'Keil, Kendall', N'Sales Representative', N'Viale Dante, 6789', N'Ravenna', NULL, N'10015', N'Italy', N'(0544) 56789', N'(0544) 34567');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(15, N'"Supplier" NZLIF', N'Sałas-Szlejter, Karolina', N'Marketing Manager', N'Hatlevegen 1234', N'Sandvika', NULL, N'10025', N'Norway', N'(0)9-012345', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(16, N'"Supplier" UHZRG', N'Scholl, Thorsten', N'Regional Account Rep.', N'8901 - 8th Avenue Suite 210', N'Bend', N'OR', N'10035', N'USA', N'(503) 555-0108', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(17, N'"Supplier" QZGUF', N'Kleinerman, Christian', N'Sales Representative', N'Brovallavägen 0123', N'Stockholm', NULL, N'10033', N'Sweden', N'08-234 56 78', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(18, N'"Supplier" LVJUA', N'Canel, Fabrice', N'Sales Manager', N'3456, Rue des Francs-Bourgeois', N'Paris', NULL, N'10031', N'France', N'(1) 90.12.34.56', N'(1) 01.23.45.67');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(19, N'"Supplier" JDNUG', N'Chapman, Greg', N'Wholesale Account Agent', N'Order Processing Dept. 7890 Paul Revere Blvd.', N'Boston', N'MA', N'10027', N'USA', N'(617) 555-0110', N'(617) 555-0113');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(20, N'"Supplier" CIYNM', N'Köszegi, Emília', N'Owner', N'6789 Serangoon Loop, Suite #402', N'Singapore', NULL, N'10037', N'Singapore', N'012-3456', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(21, N'"Supplier" XOXZA', N'Shakespear, Paul', N'Sales Manager', N'Lyngbysild Fiskebakken 9012', N'Lyngby', NULL, N'10012', N'Denmark', N'67890123', N'78901234');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(22, N'"Supplier" FNUXM', N'Skelly, Bonnie L.', N'Accounting Manager', N'Verkoop Rijnweg 8901', N'Zaandam', NULL, N'10014', N'Netherlands', N'(12345) 8901', N'(12345) 5678');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(23, N'"Supplier" ELCRN', N'LaMee, Brian', N'"Product" Manager', N'Valtakatu 1234', N'Lappeenranta', NULL, N'10032', N'Finland', N'(953) 78901', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(24, N'"Supplier" JNNES', N'Clark, Molly', N'Sales Representative', N'6789 Prince Edward Parade Hunter''s Hill', N'Sydney', N'NSW', N'10030', N'Australia', N'(02) 234-5678', N'(02) 567-8901');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(25, N'"Supplier" ERVYZ', N'Sprenger, Christof', N'Marketing Manager', N'7890 Rue St. Laurent', N'Montréal', N'Québec', N'10017', N'Canada', N'(514) 456-7890', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(26, N'"Supplier" ZWZDM', N'Cunha, Gonçalo', N'Order Administrator', N'Via dei Gelsomini, 5678', N'Salerno', NULL, N'10020', N'Italy', N'(089) 4567890', N'(089) 4567890');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(27, N'"Supplier" ZRYDZ', N'Leoni, Alessandro', N'Sales Manager', N'4567, rue H. Voiron', N'Montceau', NULL, N'10036', N'France', N'89.01.23.45', NULL);
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(28, N'"Supplier" OAVQT', N'Teper, Jeff', N'Sales Representative', N'Bat. B 2345, rue des Alpes', N'Annecy', NULL, N'10010', N'France', N'01.23.45.67', N'89.01.23.45');
INSERT INTO "Supplier"("supplierId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(29, N'"Supplier" OGLRK', N'Walters, Rob', N'Accounting Manager', N'0123 rue Chasseur', N'Ste-Hyacinthe', N'Québec', N'10009', N'Canada', N'(514) 567-890', N'(514) 678-9012');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer NRZBB', N'Allen, Michael', N'Sales Representative', N'Obere Str. 0123', N'Berlin', NULL, N'10092', N'Germany', N'030-3456789', N'030-0123456');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer MLTDN', N'Hassall, Mark', N'Owner', N'Avda. de la Constitución 5678', N'México D.F.', NULL, N'10077', N'Mexico', N'(5) 789-0123', N'(5) 456-7890');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer KBUDE', N'Peoples, John', N'Owner', N'Mataderos 7890', N'México D.F.', NULL, N'10097', N'Mexico', N'(5) 123-4567', NULL);
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer HFBZG', N'Arndt, Torsten', N'Sales Representative', N'7890 Hanover Sq.', N'London', NULL, N'10046', N'UK', N'(171) 456-7890', N'(171) 456-7891');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer HGVLZ', N'Higginbotham, Tom', N'Order Administrator', N'Berguvsvägen 5678', N'Luleå', NULL, N'10112', N'Sweden', N'0921-67 89 01', N'0921-23 45 67');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer XHXJV', N'Poland, Carole', N'Sales Representative', N'Forsterstr. 7890', N'Mannheim', NULL, N'10117', N'Germany', N'0621-67890', N'0621-12345');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer QXVLA', N'Bansal, Dushyant', N'Marketing Manager', N'2345, place Kléber', N'Strasbourg', NULL, N'10089', N'France', N'67.89.01.23', N'67.89.01.24');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer QUHWH', N'Ilyina, Julia', N'Owner', N'C/ Araquil, 0123', N'Madrid', NULL, N'10104', N'Spain', N'(91) 345 67 89', N'(91) 012 34 56');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer RTXGC', N'Raghav, Amritansh', N'Owner', N'6789, rue des Bouchers', N'Marseille', NULL, N'10105', N'France', N'23.45.67.89', N'23.45.67.80');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer EEALV', N'Bassols, Pilar Colome', N'Accounting Manager', N'8901 Tsawassen Blvd.', N'Tsawassen', N'BC', N'10111', N'Canada', N'(604) 901-2345', N'(604) 678-9012');
INSERT INTO "Customer"("userId", "companyName", "contactName", "contactTitle", address, city, region, "postalCode", country, phone, fax)
VALUES(1, N'Customer UBHAU', N'Jaffe, David', N'Sales Representative', N'Fauntleroy Circus 4567', N'London', NULL, N'10064', N'UK', N'(171) 789-0123', NULL);
INSERT INTO "Shipper"("shipperId", "companyName", phone)
VALUES(1, N'"Shipper" GVSUA', N'(503) 555-0137');
INSERT INTO "Shipper"("shipperId", "companyName", phone)
VALUES(2, N'"Shipper" ETYNR', N'(425) 555-0136');
INSERT INTO "Shipper"("shipperId", "companyName", phone)
VALUES(3, N'"Shipper" ZHISN', N'(415) 555-0138');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(1, 1, 5, '20060704 00:00:00.000', '20060801 00:00:00.000', '20060716 00:00:00.000', 3, 32.38, N'Ship to 85-B', N'6789 rue de l''Abbaye', N'Reims', NULL, N'10345', N'France');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(2, 2, 6, '20060705 00:00:00.000', '20060816 00:00:00.000', '20060710 00:00:00.000', 1, 11.61, N'Ship to 79-C', N'Luisenstr. 9012', N'Münster', NULL, N'10328', N'Germany');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(3, 3, 4, '20060708 00:00:00.000', '20060805 00:00:00.000', '20060712 00:00:00.000', 2, 65.83, N'Destination SCQXA', N'Rua do Paço, 7890', N'Rio de Janeiro', N'RJ', N'10195', N'Brazil');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(4, 4, 3, '20060708 00:00:00.000', '20060805 00:00:00.000', '20060715 00:00:00.000', 1, 41.34, N'Ship to 84-A', N'3456, rue du Commerce', N'Lyon', NULL, N'10342', N'France');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(5, 5, 4, '20060709 00:00:00.000', '20060806 00:00:00.000', '20060711 00:00:00.000', 2, 51.30, N'Ship to 76-B', N'Boulevard Tirou, 9012', N'Charleroi', NULL, N'10318', N'Belgium');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(6, 6, 3, '20060710 00:00:00.000', '20060724 00:00:00.000', '20060716 00:00:00.000', 2, 58.17, N'Destination JPAIY', N'Rua do Paço, 8901', N'Rio de Janeiro', N'RJ', N'10196', N'Brazil');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(7, 7, 5, '20060711 00:00:00.000', '20060808 00:00:00.000', '20060723 00:00:00.000', 2, 22.98, N'Destination YUJRD', N'Hauptstr. 1234', N'Bern', NULL, N'10139', N'Switzerland');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(8, 8, 9, '20060712 00:00:00.000', '20060809 00:00:00.000', '20060715 00:00:00.000', 3, 148.33, N'Ship to 68-A', N'Starenweg 6789', N'Genève', NULL, N'10294', N'Switzerland');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(9, 9, 3, '20060715 00:00:00.000', '20060812 00:00:00.000', '20060717 00:00:00.000', 2, 13.97, N'Ship to 88-B', N'Rua do Mercado, 5678', N'Resende', N'SP', N'10354', N'Brazil');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(10, 1, 4, '20060716 00:00:00.000', '20060813 00:00:00.000', '20060722 00:00:00.000', 3, 81.91, N'Destination JYDLM', N'Carrera1234 con Ave. Carlos Soublette #8-35', N'San Cristóbal', N'Táchira', N'10199', N'Venezuela');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(11, 2, 1, '20060717 00:00:00.000', '20060814 00:00:00.000', '20060723 00:00:00.000', 1, 140.51, N'Destination RVDMF', N'Kirchgasse 9012', N'Graz', NULL, N'10157', N'Austria');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(12, 3, 4, '20060718 00:00:00.000', '20060815 00:00:00.000', '20060725 00:00:00.000', 3, 3.25, N'Destination LGGCH', N'Sierras de Granada 9012', N'México D.F.', NULL, N'10137', N'Mexico');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(13, 4, 4, '20060719 00:00:00.000', '20060816 00:00:00.000', '20060729 00:00:00.000', 1, 55.09, N'Ship to 56-A', N'Mehrheimerstr. 0123', N'Köln', NULL, N'10258', N'Germany');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(14, 5, 4, '20060719 00:00:00.000', '20060816 00:00:00.000', '20060730 00:00:00.000', 2, 3.05, N'Ship to 61-B', N'Rua da Panificadora, 6789', N'Rio de Janeiro', N'RJ', N'10274', N'Brazil');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(15, 6, 8, '20060722 00:00:00.000', '20060819 00:00:00.000', '20060725 00:00:00.000', 3, 48.29, N'Ship to 65-B', N'8901 Milton Dr.', N'Albuquerque', N'NM', N'10286', N'USA');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(16, 7, 9, '20060723 00:00:00.000', '20060820 00:00:00.000', '20060731 00:00:00.000', 3, 146.06, N'Destination FFXKT', N'Kirchgasse 0123', N'Graz', NULL, N'10158', N'Austria');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(17, 8, 6, '20060724 00:00:00.000', '20060821 00:00:00.000', '20060823 00:00:00.000', 3, 3.67, N'Destination KBSBN', N'Åkergatan 9012', N'Bräcke', NULL, N'10167', N'Sweden');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(18, 7, 2, '20060725 00:00:00.000', '20060822 00:00:00.000', '20060812 00:00:00.000', 1, 55.28, N'Ship to 7-A', N'0123, place Kléber', N'Strasbourg', NULL, N'10329', N'France');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(19, 9, 3, '20060726 00:00:00.000', '20060906 00:00:00.000', '20060731 00:00:00.000', 3, 25.73, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland');
INSERT INTO "SalesOrder"("orderId", "custId", "employeeId", "orderDate", "requiredDate", "shippedDate", "shipperId", freight, "shipName", "shipAddress", "shipCity", "shipRegion", "shipPostalCode", "shipCountry")
VALUES(20, 1, 4, '20060729 00:00:00.000', '20060826 00:00:00.000', '20060806 00:00:00.000', 1, 208.58, N'Destination VAPXU', N'Berliner Platz 0123', N'München', NULL, N'10168', N'Germany');
================================================
FILE: demo/databases/sqlite.sql
================================================
-- Sqlite SQL script
PRAGMA encoding="UTF-8";
DROP TABLE IF EXISTS Customer;
CREATE TABLE Customer (
entityId INTEGER PRIMARY KEY AUTOINCREMENT,
companyName VARCHAR(40) NOT NULL,
contactName VARCHAR(30) NULL,
contactTitle VARCHAR(30) NULL,
address VARCHAR(60) NULL,
city VARCHAR(15) NULL,
region VARCHAR(15) NULL,
postalCode VARCHAR(10) NULL,
country VARCHAR(15) NULL,
phone VARCHAR(24) NULL,
mobile VARCHAR(24) NULL,
email VARCHAR(225) NULL,
fax VARCHAR(24) NULL
);
DROP TABLE IF EXISTS Employee;
CREATE TABLE Employee (
entityId INTEGER PRIMARY KEY AUTOINCREMENT,
lastname VARCHAR(20) NOT NULL,
firstname VARCHAR(10) NOT NULL,
title VARCHAR(30) NULL,
titleOfCourtesy VARCHAR(25) NULL,
birthDate DATETIME NULL,
hireDate DATETIME NULL,
address VARCHAR(60) NULL,
city VARCHAR(15) NULL,
region VARCHAR(15) NULL,
postalCode VARCHAR(10) NULL,
country VARCHAR(15) NULL,
phone VARCHAR(24) NULL,
extension VARCHAR(4) NULL,
mobile VARCHAR(24) NULL,
email VARCHAR(225) NULL,
photo BLOB NULL,
notes BLOB NULL,
mgrId INT NULL,
photoPath VARCHAR(255) NULL
);
CREATE TABLE Shipper (
entityId INTEGER PRIMARY KEY AUTOINCREMENT,
companyName VARCHAR(40) NOT NULL,
phone VARCHAR(44) NULL
);
CREATE TABLE SalesOrder (
entityId INTEGER PRIMARY KEY AUTOINCREMENT,
customerId INT NOT NULL,
employeeId INT NULL,
orderDate DATETIME NULL,
requiredDate DATETIME NULL,
shippedDate DATETIME NULL,
shipperId INT NOT NULL,
freight DECIMAL(10, 2) NULL,
shipName VARCHAR(40) NULL,
shipAddress VARCHAR(60) NULL,
shipCity VARCHAR(15) NULL,
shipRegion VARCHAR(15) NULL,
shipPostalCode VARCHAR(10) NULL,
shipCountry VARCHAR(15) NULL,
FOREIGN KEY (shipperId) REFERENCES Shipper(entityId),
FOREIGN KEY (customerId) REFERENCES Customer(entityId)
);
-- Indexing & Foreign Key
CREATE UNIQUE INDEX IF NOT EXISTS IDX_CustomerId_CustomerTypeId ON CustomerCustomerDemographics (customerId, customerTypeId);
CREATE UNIQUE INDEX IF NOT EXISTS IDX_EmployeeId_TerritoryCode ON EmployeeTerritory (employeeId, territoryCode);
CREATE UNIQUE INDEX IF NOT EXISTS IDX_OrderId_ProductId ON OrderDetail (orderId, productId);
-- Populate Employess table
INSERT INTO Employee(entityId, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(1, 'Davis', 'Sara', 'CEO', 'Ms.', '1958-12-08 00:00:00.000', '2002-05-01 00:00:00.000', '7890 - 20th Ave. E., Apt. 2A', 'Seattle', 'WA', '10003', 'USA', '(206) 555-0101', NULL);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(2, 'Funk', 'Don', 'Vice President, Sales', 'Dr.', '1962-02-19 00:00:00.000', '2002-08-14 00:00:00.000', '9012 W. Capital Way', 'Tacoma', 'WA', '10001', 'USA', '(206) 555-0100', 1);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(3, 'Lew', 'Judy', 'Sales Manager', 'Ms.', '1973-08-30 00:00:00.000', '2002-04-01 00:00:00.000', '2345 Moss Bay Blvd.', 'Kirkland', 'WA', '10007', 'USA', '(206) 555-0103', 2);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(4, 'Peled', 'Yael', 'Sales Representative', 'Mrs.', '1947-09-19 00:00:00.000', '2003-05-03 00:00:00.000', '5678 Old Redmond Rd.', 'Redmond', 'WA', '10009', 'USA', '(206) 555-0104', 3);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(5, 'Buck', 'Sven', 'Sales Manager', 'Mr.', '1965-03-04 00:00:00.000', '2003-10-17 00:00:00.000', '8901 Garrett Hill', 'London', NULL, '10004', 'UK', '(71) 234-5678', 2);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(6, 'Suurs', 'Paul', 'Sales Representative', 'Mr.', '1973-07-02 00:00:00.000', '2003-10-17 00:00:00.000', '3456 Coventry House, Miner Rd.', 'London', NULL, '10005', 'UK', '(71) 345-6789', 5);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(7, 'King', 'Russell', 'Sales Representative', 'Mr.', '1970-05-29 00:00:00.000', '2004-01-02 00:00:00.000', '6789 Edgeham Hollow, Winchester Way', 'London', NULL, '10002', 'UK', '(71) 123-4567', 5);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(8, 'Cameron', 'Maria', 'Sales Representative', 'Ms.', '1968-01-09 00:00:00.000', '2004-03-05 00:00:00.000', '4567 - 11th Ave. N.E.', 'Seattle', 'WA', '10006', 'USA', '(206) 555-0102', 3);
INSERT INTO Employee(entityid, lastname, firstname, title, titleofcourtesy, birthdate, hiredate, address, city, region, postalcode, country, phone, mgrid)
VALUES(9, 'Dolgopyatova', 'Zoya', 'Sales Representative', 'Ms.', '1976-01-27 00:00:00.000', '2004-11-15 00:00:00.000', '1234 Houndstooth Rd.', 'London', NULL, '10008', 'UK', '(71) 456-7890', 5);
-- ---
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(1, 'Customer NRZBB', 'Allen, Michael', 'Sales Representative', 'Obere Str. 0123', 'Berlin', NULL, '10092', 'Germany', '030-3456789', '030-0123456');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(2, 'Customer MLTDN', 'Hassall, Mark', 'Owner', 'Avda. de la Constitución 5678', 'México D.F.', NULL, '10077', 'Mexico', '(5) 789-0123', '(5) 456-7890');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(3, 'Customer KBUDE', 'Peoples, John', 'Owner', 'Mataderos 7890', 'México D.F.', NULL, '10097', 'Mexico', '(5) 123-4567', NULL);
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(4, 'Customer HFBZG', 'Arndt, Torsten', 'Sales Representative', '7890 Hanover Sq.', 'London', NULL, '10046', 'UK', '(171) 456-7890', '(171) 456-7891');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(5, 'Customer HGVLZ', 'Higginbotham, Tom', 'Order Administrator', 'Berguvsvägen 5678', 'Luleå', NULL, '10112', 'Sweden', '0921-67 89 01', '0921-23 45 67');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(6, 'Customer XHXJV', 'Poland, Carole', 'Sales Representative', 'Forsterstr. 7890', 'Mannheim', NULL, '10117', 'Germany', '0621-67890', '0621-12345');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(7, 'Customer QXVLA', 'Bansal, Dushyant', 'Marketing Manager', '2345, place Kléber', 'Strasbourg', NULL, '10089', 'France', '67.89.01.23', '67.89.01.24');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(8, 'Customer QUHWH', 'Ilyina, Julia', 'Owner', 'C/ Araquil, 0123', 'Madrid', NULL, '10104', 'Spain', '(91) 345 67 89', '(91) 012 34 56');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(9, 'Customer RTXGC', 'Raghav, Amritansh', 'Owner', '6789, rue des Bouchers', 'Marseille', NULL, '10105', 'France', '23.45.67.89', '23.45.67.80');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(10, 'Customer EEALV', 'Bassols, Pilar Colome', 'Accounting Manager', '8901 Tsawassen Blvd.', 'Tsawassen', 'BC', '10111', 'Canada', '(604) 901-2345', '(604) 678-9012');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(11, 'Customer UBHAU', 'Jaffe, David', 'Sales Representative', 'Fauntleroy Circus 4567', 'London', NULL, '10064', 'UK', '(171) 789-0123', NULL);
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(12, 'Customer PSNMQ', 'Ray, Mike', 'Sales Agent', 'Cerrito 3456', 'Buenos Aires', NULL, '10057', 'Argentina', '(1) 890-1234', '(1) 567-8901');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(13, 'Customer VMLOG', 'Benito, Almudena', 'Marketing Manager', 'Sierras de Granada 7890', 'México D.F.', NULL, '10056', 'Mexico', '(5) 456-7890', '(5) 123-4567');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(14, 'Customer WNMAF', 'Jelitto, Jacek', 'Owner', 'Hauptstr. 0123', 'Bern', NULL, '10065', 'Switzerland', '0452-678901', NULL);
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(15, 'Customer JUWXK', 'Richardson, Shawn', 'Sales Associate', 'Av. dos Lusíadas, 6789', 'Sao Paulo', 'SP', '10087', 'Brazil', '(11) 012-3456', NULL);
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(16, 'Customer GYBBY', 'Birkby, Dana', 'Sales Representative', 'Berkeley Gardens 0123 Brewery', 'London', NULL, '10039', 'UK', '(171) 234-5678', '(171) 234-5679');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(17, 'Customer FEVNN', 'Jones, TiAnna', 'Order Administrator', 'Walserweg 4567', 'Aachen', NULL, '10067', 'Germany', '0241-789012', '0241-345678');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(18, 'Customer BSVAR', 'Rizaldy, Arif', 'Owner', '3456, rue des Cinquante Otages', 'Nantes', NULL, '10041', 'France', '89.01.23.45', '89.01.23.46');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(19, 'Customer RFNQC', 'Boseman, Randall', 'Sales Agent', '5678 King George', 'London', NULL, '10110', 'UK', '(171) 345-6789', '(171) 345-6780');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(20, 'Customer THHDP', 'Kane, John', 'Sales Manager', 'Kirchgasse 9012', 'Graz', NULL, '10059', 'Austria', '1234-5678', '9012-3456');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(21, 'Customer KIdPX', 'Russo, Giuseppe', 'Marketing Assistant', 'Rua Orós, 3456', 'Sao Paulo', 'SP', '10096', 'Brazil', '(11) 456-7890', NULL);
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(22, 'Customer DTDMN', 'Bueno, Janaina Burdan, Neville', 'Accounting Manager', 'C/ Moralzarzal, 5678', 'Madrid', NULL, '10080', 'Spain', '(91) 890 12 34', '(91) 567 89 01');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(23, 'Customer WVFAF', 'Khanna, Karan', 'Assistant Sales Agent', '4567, chaussée de Tournai', 'Lille', NULL, '10048', 'France', '45.67.89.01', '45.67.89.02');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(24, 'Customer CYZTN', 'San Juan, Patricia', 'Owner', 'Åkergatan 5678', 'Bräcke', NULL, '10114', 'Sweden', '0695-67 89 01', NULL);
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(25, 'Customer AZJED', 'Carlson, Jason', 'Marketing Manager', 'Berliner Platz 9012', 'München', NULL, '10091', 'Germany', '089-8901234', '089-5678901');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(26, 'Customer USDBG', 'Koch, Paul', 'Marketing Manager', '9012, rue Royale', 'Nantes', NULL, '10101', 'France', '34.56.78.90', '34.56.78.91');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(27, 'Customer WMFEA', 'Schmöllerl, Martin', 'Sales Representative', 'Via Monte Bianco 4567', 'Torino', NULL, '10099', 'Italy', '011-2345678', '011-9012345');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(28, 'Customer XYUFB', 'Cavaglieri, Giorgio', 'Sales Manager', 'Jardim das rosas n. 8901', 'Lisboa', NULL, '10054', 'Portugal', '(1) 456-7890', '(1) 123-4567');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(29, 'Customer MDLWA', 'Kolesnikova, Katerina', 'Marketing Manager', 'Rambla de Cataluña, 8901', 'Barcelona', NULL, '10081', 'Spain', '(93) 789 0123', '(93) 456 7890');
INSERT INTO Customer(entityid, companyname, contactname, contacttitle, address, city, region, postalcode, country, phone, fax)
VALUES(30, 'Customer KSLQF', 'Shabalin, Rostislav', 'Sales Manager', 'C/ Romero, 1234', 'Sevilla', NULL, '10075', 'Spain', '(95) 901 23 45', NULL);
-- Shipper
INSERT INTO Shipper(entityid, companyname, phone)
VALUES(1, 'Shipper GVSUA', '(503) 555-0137');
INSERT INTO Shipper(entityid, companyname, phone)
VALUES(2, 'Shipper ETYNR', '(425) 555-0136');
INSERT INTO Shipper(entityid, companyname, phone)
VALUES(3, 'Shipper ZHISN', '(415) 555-0138');
-- Sales Order
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10248, 85, 5, '2006-07-04 00:00:00.000', '2006-08-01 00:00:00.000', '2006-07-16 00:00:00.000', 3, 32.38, 'Ship to 85-B', '6789 rue de l''Abbaye', 'Reims', NULL, '10345', 'France');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10249, 79, 6, '2006-07-05 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-10 00:00:00.000', 1, 11.61, 'Ship to 79-C', 'Luisenstr. 9012', 'Münster', NULL, '10328', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10250, 34, 4, '2006-07-08 00:00:00.000', '2006-08-05 00:00:00.000', '2006-07-12 00:00:00.000', 2, 65.83, 'Destination SCQXA', 'Rua do Paço, 7890', 'Rio de Janeiro', 'RJ', '10195', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10251, 84, 3, '2006-07-08 00:00:00.000', '2006-08-05 00:00:00.000', '2006-07-15 00:00:00.000', 1, 41.34, 'Ship to 84-A', '3456, rue du Commerce', 'Lyon', NULL, '10342', 'France');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10252, 76, 4, '2006-07-09 00:00:00.000', '2006-08-06 00:00:00.000', '2006-07-11 00:00:00.000', 2, 51.30, 'Ship to 76-B', 'Boulevard Tirou, 9012', 'Charleroi', NULL, '10318', 'Belgium');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10253, 34, 3, '2006-07-10 00:00:00.000', '2006-07-24 00:00:00.000', '2006-07-16 00:00:00.000', 2, 58.17, 'Destination JPAIY', 'Rua do Paço, 8901', 'Rio de Janeiro', 'RJ', '10196', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10254, 14, 5, '2006-07-11 00:00:00.000', '2006-08-08 00:00:00.000', '2006-07-23 00:00:00.000', 2, 22.98, 'Destination YUJRD', 'Hauptstr. 1234', 'Bern', NULL, '10139', 'Switzerland');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10255, 68, 9, '2006-07-12 00:00:00.000', '2006-08-09 00:00:00.000', '2006-07-15 00:00:00.000', 3, 148.33, 'Ship to 68-A', 'Starenweg 6789', 'Genève', NULL, '10294', 'Switzerland');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10256, 88, 3, '2006-07-15 00:00:00.000', '2006-08-12 00:00:00.000', '2006-07-17 00:00:00.000', 2, 13.97, 'Ship to 88-B', 'Rua do Mercado, 5678', 'Resende', 'SP', '10354', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10257, 35, 4, '2006-07-16 00:00:00.000', '2006-08-13 00:00:00.000', '2006-07-22 00:00:00.000', 3, 81.91, 'Destination JYDLM', 'Carrera1234 con Ave. Carlos Soublette #8-35', 'San Cristóbal', 'Táchira', '10199', 'Venezuela');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10258, 20, 1, '2006-07-17 00:00:00.000', '2006-08-14 00:00:00.000', '2006-07-23 00:00:00.000', 1, 140.51, 'Destination RVDMF', 'Kirchgasse 9012', 'Graz', NULL, '10157', 'Austria');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10259, 13, 4, '2006-07-18 00:00:00.000', '2006-08-15 00:00:00.000', '2006-07-25 00:00:00.000', 3, 3.25, 'Destination LGGCH', 'Sierras de Granada 9012', 'México D.F.', NULL, '10137', 'Mexico');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10260, 56, 4, '2006-07-19 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-29 00:00:00.000', 1, 55.09, 'Ship to 56-A', 'Mehrheimerstr. 0123', 'Köln', NULL, '10258', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10261, 61, 4, '2006-07-19 00:00:00.000', '2006-08-16 00:00:00.000', '2006-07-30 00:00:00.000', 2, 3.05, 'Ship to 61-B', 'Rua da Panificadora, 6789', 'Rio de Janeiro', 'RJ', '10274', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10262, 65, 8, '2006-07-22 00:00:00.000', '2006-08-19 00:00:00.000', '2006-07-25 00:00:00.000', 3, 48.29, 'Ship to 65-B', '8901 Milton Dr.', 'Albuquerque', 'NM', '10286', 'USA');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10263, 20, 9, '2006-07-23 00:00:00.000', '2006-08-20 00:00:00.000', '2006-07-31 00:00:00.000', 3, 146.06, 'Destination FFXKT', 'Kirchgasse 0123', 'Graz', NULL, '10158', 'Austria');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10264, 24, 6, '2006-07-24 00:00:00.000', '2006-08-21 00:00:00.000', '2006-08-23 00:00:00.000', 3, 3.67, 'Destination KBSBN', 'Åkergatan 9012', 'Bräcke', NULL, '10167', 'Sweden');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10265, 7, 2, '2006-07-25 00:00:00.000', '2006-08-22 00:00:00.000', '2006-08-12 00:00:00.000', 1, 55.28, 'Ship to 7-A', '0123, place Kléber', 'Strasbourg', NULL, '10329', 'France');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10266, 87, 3, '2006-07-26 00:00:00.000', '2006-09-06 00:00:00.000', '2006-07-31 00:00:00.000', 3, 25.73, 'Ship to 87-B', 'Torikatu 2345', 'Oulu', NULL, '10351', 'Finland');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10267, 25, 4, '2006-07-29 00:00:00.000', '2006-08-26 00:00:00.000', '2006-08-06 00:00:00.000', 1, 208.58, 'Destination VAPXU', 'Berliner Platz 0123', 'München', NULL, '10168', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10268, 33, 8, '2006-07-30 00:00:00.000', '2006-08-27 00:00:00.000', '2006-08-02 00:00:00.000', 3, 66.29, 'Destination QJVQH', '5ª Ave. Los Palos Grandes 5678', 'Caracas', 'DF', '10193', 'Venezuela');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10269, 89, 5, '2006-07-31 00:00:00.000', '2006-08-14 00:00:00.000', '2006-08-09 00:00:00.000', 1, 4.56, 'Ship to 89-B', '8901 - 12th Ave. S.', 'Seattle', 'WA', '10357', 'USA');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10270, 87, 1, '2006-08-01 00:00:00.000', '2006-08-29 00:00:00.000', '2006-08-02 00:00:00.000', 1, 136.54, 'Ship to 87-B', 'Torikatu 2345', 'Oulu', NULL, '10351', 'Finland');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10271, 75, 6, '2006-08-01 00:00:00.000', '2006-08-29 00:00:00.000', '2006-08-30 00:00:00.000', 2, 4.54, 'Ship to 75-C', 'P.O. Box 7890', 'Lander', 'WY', '10316', 'USA');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10272, 65, 6, '2006-08-02 00:00:00.000', '2006-08-30 00:00:00.000', '2006-08-06 00:00:00.000', 2, 98.03, 'Ship to 65-A', '7890 Milton Dr.', 'Albuquerque', 'NM', '10285', 'USA');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10273, 63, 3, '2006-08-05 00:00:00.000', '2006-09-02 00:00:00.000', '2006-08-12 00:00:00.000', 3, 76.07, 'Ship to 63-A', 'Taucherstraße 1234', 'Cunewalde', NULL, '10279', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10274, 85, 6, '2006-08-06 00:00:00.000', '2006-09-03 00:00:00.000', '2006-08-16 00:00:00.000', 1, 6.01, 'Ship to 85-B', '6789 rue de l''Abbaye', 'Reims', NULL, '10345', 'France');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10275, 49, 1, '2006-08-07 00:00:00.000', '2006-09-04 00:00:00.000', '2006-08-09 00:00:00.000', 1, 26.93, 'Ship to 49-A', 'Via Ludovico il Moro 8901', 'Bergamo', NULL, '10235', 'Italy');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10276, 80, 8, '2006-08-08 00:00:00.000', '2006-08-22 00:00:00.000', '2006-08-14 00:00:00.000', 3, 13.84, 'Ship to 80-C', 'Avda. Azteca 5678', 'México D.F.', NULL, '10334', 'Mexico');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10277, 52, 2, '2006-08-09 00:00:00.000', '2006-09-06 00:00:00.000', '2006-08-13 00:00:00.000', 3, 125.77, 'Ship to 52-A', 'Heerstr. 9012', 'Leipzig', NULL, '10247', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10278, 5, 8, '2006-08-12 00:00:00.000', '2006-09-09 00:00:00.000', '2006-08-16 00:00:00.000', 2, 92.69, 'Ship to 5-C', 'Berguvsvägen 1234', 'Luleå', NULL, '10269', 'Sweden');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10279, 44, 8, '2006-08-13 00:00:00.000', '2006-09-10 00:00:00.000', '2006-08-16 00:00:00.000', 2, 25.83, 'Ship to 44-A', 'Magazinweg 4567', 'Frankfurt a.M.', NULL, '10222', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10280, 5, 2, '2006-08-14 00:00:00.000', '2006-09-11 00:00:00.000', '2006-09-12 00:00:00.000', 1, 8.98, 'Ship to 5-B', 'Berguvsvägen 0123', 'Luleå', NULL, '10268', 'Sweden');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10281, 69, 4, '2006-08-14 00:00:00.000', '2006-08-28 00:00:00.000', '2006-08-21 00:00:00.000', 1, 2.94, 'Ship to 69-A', 'Gran Vía, 9012', 'Madrid', NULL, '10297', 'Spain');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10282, 69, 4, '2006-08-15 00:00:00.000', '2006-09-12 00:00:00.000', '2006-08-21 00:00:00.000', 1, 12.69, 'Ship to 69-B', 'Gran Vía, 0123', 'Madrid', NULL, '10298', 'Spain');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10283, 46, 3, '2006-08-16 00:00:00.000', '2006-09-13 00:00:00.000', '2006-08-23 00:00:00.000', 3, 84.81, 'Ship to 46-A', 'Carrera 0123 con Ave. Bolívar #65-98 Llano Largo', 'Barquisimeto', 'Lara', '10227', 'Venezuela');
INSERT INTO SalesOrder(entityid, customerid, employeeid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10284, 44, 4, '2006-08-19 00:00:00.000', '2006-09-16 00:00:00.000', '2006-08-27 00:00:00.000', 1, 76.56, 'Ship to 44-A', 'Magazinweg 4567', 'Frankfurt a.M.', NULL, '10222', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10285, 63, 1, '2006-08-20 00:00:00.000', '2006-09-17 00:00:00.000', '2006-08-26 00:00:00.000', 2, 76.83, 'Ship to 63-B', 'Taucherstraße 2345', 'Cunewalde', NULL, '10280', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10286, 63, 8, '2006-08-21 00:00:00.000', '2006-09-18 00:00:00.000', '2006-08-30 00:00:00.000', 3, 229.24, 'Ship to 63-B', 'Taucherstraße 2345', 'Cunewalde', NULL, '10280', 'Germany');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10287, 67, 8, '2006-08-22 00:00:00.000', '2006-09-19 00:00:00.000', '2006-08-28 00:00:00.000', 3, 12.76, 'Ship to 67-A', 'Av. Copacabana, 3456', 'Rio de Janeiro', 'RJ', '10291', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10288, 66, 4, '2006-08-23 00:00:00.000', '2006-09-20 00:00:00.000', '2006-09-03 00:00:00.000', 1, 7.45, 'Ship to 66-C', 'Strada Provinciale 2345', 'Reggio Emilia', NULL, '10290', 'Italy');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10289, 11, 7, '2006-08-26 00:00:00.000', '2006-09-23 00:00:00.000', '2006-08-28 00:00:00.000', 3, 22.77, 'Destination DLEUN', 'Fauntleroy Circus 4567', 'London', NULL, '10132', 'UK');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10290, 15, 8, '2006-08-27 00:00:00.000', '2006-09-24 00:00:00.000', '2006-09-03 00:00:00.000', 1, 79.70, 'Destination HQZHO', 'Av. dos Lusíadas, 4567', 'Sao Paulo', 'SP', '10142', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10291, 61, 6, '2006-08-27 00:00:00.000', '2006-09-24 00:00:00.000', '2006-09-04 00:00:00.000', 2, 6.40, 'Ship to 61-A', 'Rua da Panificadora, 5678', 'Rio de Janeiro', 'RJ', '10273', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10292, 81, 1, '2006-08-28 00:00:00.000', '2006-09-25 00:00:00.000', '2006-09-02 00:00:00.000', 2, 1.35, 'Ship to 81-A', 'Av. Inês de Castro, 6789', 'Sao Paulo', 'SP', '10335', 'Brazil');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10293, 80, 1, '2006-08-29 00:00:00.000', '2006-09-26 00:00:00.000', '2006-09-11 00:00:00.000', 3, 21.18, 'Ship to 80-B', 'Avda. Azteca 4567', 'México D.F.', NULL, '10333', 'Mexico');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10294, 65, 4, '2006-08-30 00:00:00.000', '2006-09-27 00:00:00.000', '2006-09-05 00:00:00.000', 2, 147.26, 'Ship to 65-A', '7890 Milton Dr.', 'Albuquerque', 'NM', '10285', 'USA');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10295, 85, 2, '2006-09-02 00:00:00.000', '2006-09-30 00:00:00.000', '2006-09-10 00:00:00.000', 2, 1.15, 'Ship to 85-C', '7890 rue de l''Abbaye', 'Reims', NULL, '10346', 'France');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10296, 46, 6, '2006-09-03 00:00:00.000', '2006-10-01 00:00:00.000', '2006-09-11 00:00:00.000', 1, 0.12, 'Ship to 46-C', 'Carrera 2345 con Ave. Bolívar #65-98 Llano Largo', 'Barquisimeto', 'Lara', '10229', 'Venezuela');
INSERT INTO SalesOrder(entityid, customerid, employeeid,orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry)
VALUES(10297, 7, 5, '2006-09-04 00:00:00.000', '2006-10-16 00:00:00.000', '2006-09-10 00:00:00.000', 2, 5.74, 'Ship to 7-C', '2345, place Kléber', 'Strasbourg', NULL, '10331', 'France');
================================================
FILE: docker/docker-compose.dev.yml
================================================
name: llana
networks:
llana-network:
driver: bridge
name: llana-network
volumes:
llana-mysql-data:
name: llana-mysql-data
driver: local
llana-postgres-data:
name: llana-postgres-data
driver: local
llana-mongodb-data:
name: llana-mongodb-data
driver: local
llana-mssql-data:
name: llana-mssql-data
driver: local
llana-redis-cache: #To be used for caching not as a data source
name: llana-redis-cache
driver: local
services:
llana-mysql:
image: mysql
restart: always
container_name: llana-mysql
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: pass
MYSQL_USER: user
MYSQL_PASSWORD: pass
MYSQL_DATABASE: llana
MYSQL_ROOT_HOST: '%'
command: ['--init-file', '/docker-entrypoint-initdb.d/init.sql']
volumes:
- llana-mysql-data:/var/lib/mysql
- ../demo/databases/mysql.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- llana-network
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
interval: 10s
timeout: 3s
retries: 10
start_period: 10s
llana-postgres:
image: postgres
restart: always
container_name: llana-postgres
ports:
- '5432:5432'
environment:
POSTGRES_DB: llana
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
ALLOW_IP_RANGE: '0.0.0.0/0'
volumes:
- llana-postgres-data:/var/lib/postgresql/data/
- ../demo/databases/postgres.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- llana-network
llana-mongodb:
image: mongo
restart: always
container_name: llana-mongodb
ports:
- '27017:27017'
environment:
MONGO_INITDB_ROOT_USERNAME: user
MONGO_INITDB_ROOT_PASSWORD: pass
MONGO_INITDB_DATABASE: llana
volumes:
- llana-mongodb-data:/data/db
- ../demo/databases/mongodb.js:/docker-entrypoint-initdb.d/seed.js
networks:
- llana-network
llana-mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
restart: always
container_name: llana-mssql
ports:
- '1433:1433'
environment:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: 'S7!0nGpAw0rD'
volumes:
- llana-mssql-data:/var/opt/mssql
- ../demo/databases/mssql.sql:/docker-entrypoint-initdb.d/mssql.sql
networks:
- llana-network
healthcheck:
test: /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P "$$MSSQL_SA_PASSWORD" -Q "SELECT 1" -b -o /dev/null
interval: 10s
timeout: 3s
retries: 10
start_period: 10s
command:
- /bin/bash
- -c
- |
/opt/mssql/bin/sqlservr &
pid=$$!
echo "Waiting for MS SQL to be available ⏳"
/opt/mssql-tools18/bin/sqlcmd -C -l 30 -S localhost -h-1 -V1 -U sa -P $$MSSQL_SA_PASSWORD -Q "SET NOCOUNT ON SELECT \"YAY WE ARE UP\" , @@servername"
is_up=$$?
while [ $$is_up -ne 0 ] ; do
echo -e $$(date)
/opt/mssql-tools18/bin/sqlcmd -C -l 30 -S localhost -h-1 -V1 -U sa -P $$MSSQL_SA_PASSWORD -Q "SET NOCOUNT ON SELECT \"YAY WE ARE UP\" , @@servername"
is_up=$$?
sleep 5
done
echo "MS SQL is up and running 🚀"
/opt/mssql-tools18/bin/sqlcmd -C -U sa -P $$MSSQL_SA_PASSWORD -Q "CREATE DATABASE llana;"
/opt/mssql-tools18/bin/sqlcmd -C -U sa -P $$MSSQL_SA_PASSWORD -l 30 -e -i /docker-entrypoint-initdb.d/mssql.sql
echo "Script Execution is complete. Waiting for MS SQL Process to terminate 🎉"
wait $$pid
llana-redis-cache:
image: redis
restart: always
container_name: llana-redis-cache
ports:
- '6379:6379'
networks:
- llana-network
volumes:
- llana-redis-cache:/data
================================================
FILE: docker/docker-compose.test.prod.build.yml
================================================
name: llana
services:
llana-test-prod-build-app:
container_name: llana-test-prod-build-app
build:
context: .
dockerfile: docker/images/base/Dockerfile
ports:
- "3000:3000"
environment:
DATABASE_URI: ${DATABASE_URI}
JWT_KEY: ${JWT_KEY}
JWT_REFRESH_KEY: ${JWT_REFRESH_KEY}
HOSTS: ${HOSTS}
SOFT_DELETE_COLUMN: ${SOFT_DELETE_COLUMN}
================================================
FILE: docker/docker-compose.test.prod.yml
================================================
name: llana
services:
llana-prod-test-app:
container_name: llana-prod-test-app
image: juicyllama/llana:latest
ports:
- "3000:3000"
environment:
DATABASE_URI: ${DATABASE_URI}
JWT_KEY: ${JWT_KEY}
JWT_REFRESH_KEY: ${JWT_REFRESH_KEY}
HOSTS: ${HOSTS}
SOFT_DELETE_COLUMN: ${SOFT_DELETE_COLUMN}
================================================
FILE: docker/images/base/Dockerfile
================================================
###################
# BUILD
###################
ARG NODE_VERSION=22
# Use a builder step to download various dependencies
FROM node:${NODE_VERSION}-alpine AS build
# Install git and other OS dependencies
RUN apk add --no-cache git
WORKDIR /usr/src/app
COPY . .
RUN chown -R node:node /usr/src/app
USER node
RUN cd /usr/src/app
# Install the dependencies
RUN npm ci
RUN npm run build
###################
# PRODUCTION
###################
FROM node:${NODE_VERSION}-alpine AS production
WORKDIR /usr/src/app
# Copy the app from the build stage
COPY --chown=node:node --from=build /usr/src/app .
RUN chown -R node:node /usr/src/app
USER node
RUN cd /usr/src/app
CMD [ "npm", "run", "start" ]
================================================
FILE: docker/images/llana/Dockerfile
================================================
###################
# PRODUCTION
###################
FROM juicyllama/llana:latest
USER node
RUN cd /usr/src/app
CMD [ "npm", "run", "start" ]
================================================
FILE: eslint.config.mjs
================================================
import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [
{
ignores: ['**/.eslintrc.js', '**/*.spec.ts', '**/*.test.ts', '**/*.paused.ts'],
},
...compat.extends('plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'),
{
plugins: {
'@typescript-eslint': typescriptEslintEslintPlugin,
"simple-import-sort": simpleImportSort,
},
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
parser: tsParser,
ecmaVersion: 5,
sourceType: 'commonjs',
parserOptions: {
project: 'tsconfig.json',
},
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'prefer-const': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
]
================================================
FILE: nest-cli.json
================================================
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true,
"assets": [{
"include": "**/*.handlebars",
"outDir": "./dist/src"
},{
"include": "../public",
"outDir": "dist/public",
"watchAssets": true
},
{
"include": "../views",
"outDir": "dist/views",
"watchAssets": true
}],
"watchAssets": true,
"tsConfigPath": "tsconfig.build.json"
},
"watchOptions": {
"aggregateTimeout": 500,
"poll": 1000
}
}
================================================
FILE: package.json
================================================
{
"name": "@juicyllama/llana",
"version": "1.32.0",
"description": "API Wrapper for Databases - Llana is a no-code API wrapper that exposes a REST API for any database within minutes. No longer spend time building APIs, just connect your database and start using the API. Open source, free to use, and no vendor lock-in.",
"author": {
"name": "JuicyLlama Studio",
"email": "studio@juicyllama.com",
"url": "https://juicyllama.com"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "https://github.com/juicyllama/llana"
},
"bugs": "https://llana.io",
"license": "BSD-4-Clause",
"readmeFilename": "README.md",
"tags": [
"llana",
"api"
],
"keywords": [
"llana",
"api"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:ngrok": "~/ngrok http http://localhost:3000/ --subdomain=llana",
"docker:dev": "sh ./scripts/docker.dev.sh",
"docker:dev:up": "docker compose -f ./docker/docker-compose.dev.yml up --build --detach",
"docker:dev:down": "docker compose -f ./docker/docker-compose.dev.yml down --remove-orphans --volumes",
"docker:prod:build": "sh ./scripts/docker.build.prod.sh",
"docker:prod:test": "sh ./scripts/docker.prod.sh",
"precommit": "npm run test && npm run lint && npm run format",
"commit": "git pull && git add . && git commit -m \"chore: update\" && git push",
"test": "sh ./scripts/test.sh",
"test:current": "jest --bail --runInBand --detectOpenHandles --forceExit",
"test:mysql": "export DATABASE_URI=mysql://user:pass@localhost:3306/llana && jest --bail --runInBand --detectOpenHandles --forceExit",
"test:postgresql": "export DATABASE_URI=postgresql://user:pass@localhost:5432/llana && jest --bail --runInBand --detectOpenHandles --forceExit",
"test:mongodb": "export DATABASE_URI=mongodb://user:pass@localhost:27017/llana && jest --bail --runInBand --detectOpenHandles --forceExit",
"test:mssql": "export DATABASE_URI=mssql://sa:S7!0nGpAw0rD@localhost:1433/llana && jest --bail --runInBand --detectOpenHandles --forceExit",
"seed:airtable": "ts-node ./demo/databases/airtable.ts"
},
"dependencies": {
"@nestjs/cache-manager": "^3.0.1",
"@nestjs/common": "^11.1.1",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^11.1.1",
"@nestjs/jwt": "^11.0.0",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^11.1.1",
"@nestjs/platform-socket.io": "^11.1.1",
"@nestjs/schedule": "^6.0.0",
"@nestjs/websockets": "^11.1.1",
"@types/mssql": "^9.1.7",
"@types/pg": "^8.15.2",
"argon2": "^0.43.0",
"axios": "^1.9.0",
"bcrypt": "^6.0.0",
"cache-manager": "^6.4.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.2",
"escape-html": "^1.0.3",
"express-basic-auth": "^1.2.1",
"express-handlebars": "^8.0.3",
"hbs": "^4.2.0",
"ioredis": "^5.6.1",
"joi": "^17.13.3",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"mongodb": "^6.16.0",
"mssql": "^11.0.1",
"mysql2": "^3.14.1",
"openapi-types": "^12.1.3",
"passport-local": "^1.0.0",
"pg": "^8.16.0",
"pg-promise": "^11.13.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.2",
"socket.io": "^4.8.1",
"sqlstring": "^2.3.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.27.0",
"@nestjs/cli": "^11.0.7",
"@nestjs/schematics": "^11.0.5",
"@nestjs/testing": "^11.1.1",
"@swc/cli": "^0.7.7",
"@swc/core": "^1.11.29",
"@types/bcrypt": "^5.0.2",
"@types/express": "^5.0.2",
"@types/jest": "^29.5.14",
"@types/node": "^22.15.21",
"@types/supertest": "^6.0.3",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.4.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^16.1.0",
"jest": "^29.7.0",
"prettier": "^3.5.3",
"rimraf": "^5.0.5",
"socket.io-client": "^4.8.1",
"source-map-support": "^0.5.21",
"supertest": "^7.1.1",
"ts-jest": "^29.3.4",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.8.3",
"webpack": "^5.99.9"
},
"overrides": {
"multer": "2.0.0"
},
"resolutions": {
"multer": "2.0.0"
},
"engines": {
"node": ">=22.0.0",
"npm": ">=8.3.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node",
"testTimeout": 20000,
"moduleNameMapper": {
"^src/(.*)$": "<rootDir>/$1"
}
},
"prettier": {
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4,
"useTabs": true,
"semi": false,
"printWidth": 120,
"arrowParens": "avoid",
"bracketSpacing": true,
"bracketSameLine": true
}
}
================================================
FILE: pr_description.md
================================================
# Improve Response Errors to be More Descriptive
## Description
This PR implements standardized error handling across all datasources with consistent error enums and descriptive messages. It addresses [Issue #150](https://github.com/juicyllama/llana/issues/150) by providing more meaningful errors from requests to controllers when datasources fail.
## Changes
- Added `DatabaseErrorType` enum with common error types (DUPLICATE_RECORD, UNIQUE_KEY_VIOLATION, etc.)
- Updated `IsUniqueResponse` to include an `error` field for descriptive messages
- Enhanced all datasources (MySQL, PostgreSQL, MSSQL, MongoDB, Airtable) to map database-specific errors to standardized types
- Updated controllers to return structured error responses with both `message` (enum value) and `error` (descriptive text) fields
- Added test for duplicate record error response format
## Example Error Response
```json
{
"message": "DUPLICATE_RECORD",
"error": "Error inserting record as a duplicate already exists"
}
```
## Testing
- Ve
gitextract_3wslf_j3/
├── .dockerignore
├── .env.example
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── codeql.yml
│ ├── pr.yml
│ ├── release.yml
│ └── snyk-security.yml
├── .gitignore
├── .vscode/
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
├── README.md
├── demo/
│ └── databases/
│ ├── airtable.ts
│ ├── json/
│ │ ├── Customer.json
│ │ ├── Employee.json
│ │ └── Shipper.json
│ ├── mongodb.js
│ ├── mssql.sql
│ ├── mysql.sql
│ ├── postgres.sql
│ └── sqlite.sql
├── docker/
│ ├── docker-compose.dev.yml
│ ├── docker-compose.test.prod.build.yml
│ ├── docker-compose.test.prod.yml
│ └── images/
│ ├── base/
│ │ └── Dockerfile
│ └── llana/
│ └── Dockerfile
├── eslint.config.mjs
├── nest-cli.json
├── package.json
├── pr_description.md
├── scripts/
│ ├── docker.build.prod.sh
│ ├── docker.dev.sh
│ ├── docker.prod.sh
│ ├── install.sh
│ └── test.sh
├── src/
│ ├── app.constants.ts
│ ├── app.controller.auth.test.spec.ts
│ ├── app.controller.auth.ts
│ ├── app.controller.delete.test.spec.ts
│ ├── app.controller.delete.ts
│ ├── app.controller.docs.ts
│ ├── app.controller.get.test.spec.ts
│ ├── app.controller.get.ts
│ ├── app.controller.post.test.spec.ts
│ ├── app.controller.post.ts
│ ├── app.controller.put.test.spec.ts
│ ├── app.controller.put.ts
│ ├── app.module.test.spec.ts
│ ├── app.module.ts
│ ├── app.service.auth.ts
│ ├── app.service.bootup.ts
│ ├── app.service.tasks.ts
│ ├── auth/
│ │ ├── auth.constants.ts
│ │ ├── guards/
│ │ │ ├── jwt-auth.guard.ts
│ │ │ └── local-auth.guard.ts
│ │ └── strategies/
│ │ └── local.strategy.ts
│ ├── config/
│ │ ├── auth.config.ts
│ │ ├── class-validator.config.ts
│ │ ├── database.config.ts
│ │ ├── env.validation.spec.ts
│ │ ├── env.validation.ts
│ │ ├── hosts.config.ts
│ │ ├── jwt.config.ts
│ │ └── roles.config.ts
│ ├── datasources/
│ │ ├── airtable.datasource.ts
│ │ ├── mongo.datasource.ts
│ │ ├── mssql.datasource.ts
│ │ ├── mysql.datasource.ts
│ │ └── postgres.datasource.ts
│ ├── dtos/
│ │ ├── requests.dto.ts
│ │ ├── response.dto.ts
│ │ └── webhook.dto.ts
│ ├── helpers/
│ │ ├── Authentication.ts
│ │ ├── CircuitBreaker.ts
│ │ ├── Database.ts
│ │ ├── Documentation.ts
│ │ ├── Encryption.ts
│ │ ├── Logger.ts
│ │ ├── Pagination.test.spec.ts
│ │ ├── Pagination.ts
│ │ ├── Query.ts
│ │ ├── Response.ts
│ │ ├── Roles.ts
│ │ ├── Schema.ts
│ │ └── Webhook.ts
│ ├── main.ts
│ ├── middleware/
│ │ ├── HostCheck.ts
│ │ ├── Robots.ts
│ │ └── request-path-logger.middleware.ts
│ ├── modules/
│ │ ├── cache/
│ │ │ ├── dataCache.constants.ts
│ │ │ └── dataCache.service.ts
│ │ ├── websocket/
│ │ │ ├── redis-mock-with-pub-sub.ts
│ │ │ ├── websocket.constants.ts
│ │ │ ├── websocket.gateway.spec.ts
│ │ │ ├── websocket.gateway.ts
│ │ │ ├── websocket.jwt-auth.middleware.test.spec.ts
│ │ │ ├── websocket.jwt-auth.middleware.ts
│ │ │ └── websocket.service.ts
│ │ └── welcome/
│ │ ├── welcome.controller.ts
│ │ └── welcome.module.ts
│ ├── testing/
│ │ ├── auth.testing.service.ts
│ │ ├── customer.testing.service.ts
│ │ ├── employee.testing.service.ts
│ │ ├── relations.testing.service.ts
│ │ ├── salesorder.testing.service.ts
│ │ ├── shipper.testing.service.ts
│ │ ├── testing.const.ts
│ │ └── user.testing.service.ts
│ ├── types/
│ │ ├── auth.types.ts
│ │ ├── datasource.types.ts
│ │ ├── datasources/
│ │ │ ├── airtable.types.ts
│ │ │ ├── mssql.types.ts
│ │ │ ├── mysql.types.ts
│ │ │ └── postgres.types.ts
│ │ ├── response.types.ts
│ │ ├── roles.types.ts
│ │ └── schema.types.ts
│ └── utils/
│ ├── Env.ts
│ ├── Env.types.ts
│ ├── Find.ts
│ ├── String.ts
│ └── redoc/
│ ├── interfaces/
│ │ └── redoc.interface.ts
│ ├── redoc.ts
│ └── views/
│ └── redoc.handlebars
├── tsconfig.build.json
├── tsconfig.json
└── views/
└── welcome.hbs
SYMBOL INDEX (543 symbols across 77 files)
FILE: demo/databases/airtable.ts
constant ENDPOINT (line 10) | const ENDPOINT = 'https://api.airtable.com/v0'
constant AIRTABLE (line 11) | const AIRTABLE = process.env.DATABASE_URI as string
constant DOMAIN (line 12) | const DOMAIN = 'AIRTABLE'
FILE: demo/databases/mysql.sql
type `User` (line 5) | CREATE TABLE IF NOT EXISTS `User` (
type `UserApiKey` (line 22) | CREATE TABLE IF NOT EXISTS `UserApiKey` (
type Customer (line 36) | CREATE TABLE IF NOT EXISTS Customer (
type Employee (line 58) | CREATE TABLE IF NOT EXISTS Employee (
type Shipper (line 86) | CREATE TABLE IF NOT EXISTS Shipper (
type SalesOrder (line 97) | CREATE TABLE IF NOT EXISTS SalesOrder (
FILE: demo/databases/postgres.sql
type "User" (line 6) | CREATE TABLE "User"
type "UserApiKey" (line 26) | CREATE TABLE "UserApiKey"
type "Customer" (line 42) | CREATE TABLE "Customer"
type "Employee" (line 65) | CREATE TABLE "Employee"
type "Supplier" (line 92) | CREATE TABLE "Supplier"
type "Shipper" (line 111) | CREATE TABLE "Shipper"
type "SalesOrder" (line 122) | CREATE TABLE "SalesOrder"
FILE: demo/databases/sqlite.sql
type Customer (line 8) | CREATE TABLE Customer (
type Employee (line 27) | CREATE TABLE Employee (
type Shipper (line 51) | CREATE TABLE Shipper (
type SalesOrder (line 60) | CREATE TABLE SalesOrder (
type IDX_CustomerId_CustomerTypeId (line 85) | CREATE UNIQUE INDEX IF NOT EXISTS IDX_CustomerId_CustomerTypeId ON Custo...
type IDX_EmployeeId_TerritoryCode (line 87) | CREATE UNIQUE INDEX IF NOT EXISTS IDX_EmployeeId_TerritoryCode ON Employ...
type IDX_OrderId_ProductId (line 89) | CREATE UNIQUE INDEX IF NOT EXISTS IDX_OrderId_ProductId ON OrderDetail (...
FILE: src/app.constants.ts
constant NON_FIELD_PARAMS (line 3) | const NON_FIELD_PARAMS = ['fields', 'limit', 'offset', 'sort', 'page', '...
constant LLANA_PUBLIC_TABLES (line 4) | const LLANA_PUBLIC_TABLES = '_llana_public_tables'
constant LLANA_ROLES_TABLE (line 5) | const LLANA_ROLES_TABLE = '_llana_role'
constant LLANA_RELATION_TABLE (line 6) | const LLANA_RELATION_TABLE = '_llana_relation'
constant LLANA_WEBHOOK_TABLE (line 7) | const LLANA_WEBHOOK_TABLE = '_llana_webhook'
constant LLANA_WEBHOOK_LOG_TABLE (line 8) | const LLANA_WEBHOOK_LOG_TABLE = '_llana_webhook_log'
constant LLANA_DATA_CACHING_TABLE (line 9) | const LLANA_DATA_CACHING_TABLE = '_llana_data_caching'
constant APP_BOOT_CONTEXT (line 10) | const APP_BOOT_CONTEXT = 'AppBootup'
constant CACHE_DEFAULT_TABLE_SCHEMA_TTL (line 11) | const CACHE_DEFAULT_TABLE_SCHEMA_TTL = 3600000 // 1 hour
constant CACHE_DEFAULT_IDENTITY_DATA_TTL (line 12) | const CACHE_DEFAULT_IDENTITY_DATA_TTL = 600000 // 10 minutes
constant CACHE_DEFAULT_WS_IDENTITY_DATA_TTL (line 13) | const CACHE_DEFAULT_WS_IDENTITY_DATA_TTL = 3600000 * 24 * 2 // 2 days
constant CACHE_DEFAULT_WEBHOOK_TTL (line 14) | const CACHE_DEFAULT_WEBHOOK_TTL = 3600000 * 24 * 2 // 2 days
constant WEBHOOK_LOG_DAYS (line 15) | const WEBHOOK_LOG_DAYS = 1
constant NON_RELATIONAL_DBS (line 16) | const NON_RELATIONAL_DBS = [DataSourceType.MONGODB]
FILE: src/app.controller.auth.test.spec.ts
function getCookieValueFromHeader (line 211) | function getCookieValueFromHeader(res: any, cookieName: string) {
FILE: src/app.controller.auth.ts
class AuthController (line 31) | class AuthController {
method constructor (line 34) | constructor(
method login (line 48) | async login(@Req() req: AuthenticatedRequest, @Res({ passthrough: true...
method refresh (line 64) | async refresh(@Req() req: AuthenticatedRequest, @Res({ passthrough: tr...
method logout (line 89) | async logout(@Res({ passthrough: true }) res: ExpressResponse): Promis...
method profile (line 102) | async profile(
function getAuthCookieOpts (line 189) | function getAuthCookieOpts(isRefreshToken: boolean): CookieOptions {
function setAccessAndRefreshTokenCookies (line 205) | function setAccessAndRefreshTokenCookies(res: ExpressResponse, accessTok...
function convertJwtExpiryToMs (line 210) | function convertJwtExpiryToMs(expiry: string): number {
FILE: src/app.controller.delete.ts
class DeleteController (line 28) | class DeleteController {
method constructor (line 29) | constructor(
method deleteById (line 42) | async deleteById(
method deleteMany (line 169) | async deleteMany(
FILE: src/app.controller.docs.ts
class DocsController (line 10) | class DocsController {
method constructor (line 11) | constructor(private readonly documentation: Documentation) {}
method index (line 14) | async index(@Res() res) {
method openapi (line 28) | openapi(@Res() res): string {
method fav (line 37) | fav(@Res() res): string {
FILE: src/app.controller.get.ts
class GetController (line 26) | class GetController {
method constructor (line 27) | constructor(
method listTables (line 39) | async listTables(@Req() req, @Res() res, @Headers() headers: HeaderPar...
method getSchema (line 60) | async getSchema(@Req() req, @Res() res, @Headers() headers: HeaderPara...
method getById (line 137) | async getById(
method list (line 364) | async list(
FILE: src/app.controller.post.ts
class PostController (line 20) | class PostController {
method constructor (line 21) | constructor(
method create (line 37) | async create(
method createOneRecord (line 205) | private async createOneRecord(
FILE: src/app.controller.put.ts
class PutController (line 20) | class PutController {
method constructor (line 21) | constructor(
method updateById (line 33) | async updateById(
method updateMany (line 207) | async updateMany(
method updateByIdPatch (line 440) | async updateByIdPatch(
method updateManyPatch (line 451) | async updateManyPatch(
FILE: src/app.module.ts
function createPubSubOnlyRedisClient (line 55) | function createPubSubOnlyRedisClient() {
function createRedisCache (line 68) | function createRedisCache() {
class AppModule (line 163) | class AppModule implements NestModule {
method configure (line 164) | configure(consumer: MiddlewareConsumer) {
FILE: src/app.service.auth.ts
type LoginPayload (line 10) | type LoginPayload = {
type User (line 15) | type User = FindOneResponseObject & {
class AuthService (line 21) | class AuthService {
method constructor (line 23) | constructor(
method getUserPK (line 30) | private async getUserPK() {
method getUserId (line 39) | async getUserId(jwt: string): Promise<any> {
method constructLoginPayload (line 44) | private async constructLoginPayload(user: User | LoginPayload) {
method login (line 52) | async login(user: any): Promise<{ access_token: string }> {
method createRefreshToken (line 61) | async createRefreshToken(user: User | LoginPayload) {
method decodeRefreshToken (line 73) | decodeRefreshToken(token: string): LoginPayload {
FILE: src/app.service.bootup.ts
class AppBootup (line 38) | class AppBootup implements OnApplicationBootstrap {
method constructor (line 39) | constructor(
method onApplicationBootstrap (line 49) | async onApplicationBootstrap() {
FILE: src/app.service.tasks.ts
class TasksService (line 12) | class TasksService {
method constructor (line 13) | constructor(
method sendWebhooks (line 27) | async sendWebhooks() {
method checkCache (line 40) | async checkCache() {
FILE: src/auth/auth.constants.ts
constant JWT (line 1) | const JWT = 'jwt'
constant ACCESS_TOKEN_COOKIE_NAME (line 3) | const ACCESS_TOKEN_COOKIE_NAME = 'accessToken'
constant REFRESH_TOKEN_COOKIE_NAME (line 4) | const REFRESH_TOKEN_COOKIE_NAME = 'refreshToken'
constant IS_LOGGED_IN_COOKIE_NAME (line 5) | const IS_LOGGED_IN_COOKIE_NAME = 'isLlanaLoggedIn'
FILE: src/auth/guards/jwt-auth.guard.ts
class JwtAuthGuard (line 7) | class JwtAuthGuard extends AuthGuard(JWT) {}
FILE: src/auth/guards/local-auth.guard.ts
class LocalAuthGuard (line 5) | class LocalAuthGuard extends AuthGuard('local') {}
FILE: src/auth/strategies/local.strategy.ts
class LocalStrategy (line 15) | class LocalStrategy extends PassportStrategy(Strategy) {
method constructor (line 16) | constructor(
method validate (line 26) | async validate(req: Request, username: string, pass: string): Promise<...
FILE: src/datasources/airtable.datasource.ts
constant DATABASE_TYPE (line 32) | const DATABASE_TYPE = DataSourceType.AIRTABLE
constant ENDPOINT (line 33) | const ENDPOINT = 'https://api.airtable.com/v0'
class Airtable (line 36) | class Airtable {
method constructor (line 37) | constructor(
method createRequest (line 43) | async createRequest(options: {
method checkConnection (line 87) | async checkConnection(options: { x_request_id?: string }): Promise<boo...
method listTables (line 108) | async listTables(options: { x_request_id?: string }): Promise<string[]> {
method getSchema (line 134) | async getSchema(options: { table: string; x_request_id?: string }): Pr...
method createOne (line 226) | async createOne(options: DataSourceCreateOneOptions, x_request_id?: st...
method findOne (line 299) | async findOne(options: DataSourceFindOneOptions, x_request_id: string)...
method findMany (line 362) | async findMany(options: DataSourceFindManyOptions, x_request_id: strin...
method findTotalRecords (line 539) | async findTotalRecords(options: DataSourceFindTotalRecords, x_request_...
method updateOne (line 599) | async updateOne(options: DataSourceUpdateOneOptions, x_request_id: str...
method deleteOne (line 671) | async deleteOne(options: DataSourceDeleteOneOptions, x_request_id: str...
method createTable (line 720) | async createTable(schema: DataSourceSchema, x_request_id?: string): Pr...
method truncate (line 813) | async truncate(table: string, x_request_id?: string): Promise<void> {
method uniqueCheck (line 854) | async uniqueCheck(options: DataSourceUniqueCheckOptions, x_request_id:...
method mapAirtableError (line 936) | private mapAirtableError(error: any): IsUniqueResponse {
method whereToFilter (line 972) | async whereToFilter(where: DataSourceWhere[], schema: DataSourceSchema...
method fieldMapper (line 1064) | private fieldMapper(type: AirtableColumnType): DataSourceColumnType {
method fieldMapperRev (line 1120) | private fieldMapperRev(type: DataSourceColumnType): AirtableColumnType {
method formatOutput (line 1145) | private formatOutput(options: DataSourceFindOneOptions, data: { [key: ...
method formatField (line 1169) | private formatField(type: DataSourceColumnType, value: any): any {
FILE: src/datasources/mongo.datasource.ts
constant DATABASE_TYPE (line 32) | const DATABASE_TYPE = DataSourceType.MONGODB
class Mongo (line 35) | class Mongo {
method constructor (line 36) | constructor(
method createConnection (line 42) | async createConnection(
method checkConnection (line 75) | async checkConnection(options: { x_request_id?: string }): Promise<boo...
method listTables (line 92) | async listTables(options: { x_request_id?: string }): Promise<string[]> {
method getSchema (line 115) | async getSchema(options: { table: string; x_request_id?: string }): Pr...
method createOne (line 226) | async createOne(options: DataSourceCreateOneOptions, x_request_id?: st...
method findOne (line 264) | async findOne(options: DataSourceFindOneOptions, x_request_id: string)...
method findMany (line 307) | async findMany(options: DataSourceFindManyOptions, x_request_id: strin...
method findTotalRecords (line 394) | async findTotalRecords(options: DataSourceFindTotalRecords, x_request_...
method updateOne (line 424) | async updateOne(options: DataSourceUpdateOneOptions, x_request_id: str...
method deleteOne (line 469) | async deleteOne(options: DataSourceDeleteOneOptions, x_request_id: str...
method createTable (line 522) | async createTable(schema: DataSourceSchema, x_request_id?: string): Pr...
method truncate (line 551) | async truncate(table: string): Promise<void> {
method uniqueCheck (line 568) | async uniqueCheck(options: DataSourceUniqueCheckOptions, x_request_id:...
method mapMongoDBError (line 660) | private mapMongoDBError(error: any): IsUniqueResponse {
method whereToFilter (line 687) | async whereToFilter(where: DataSourceWhere[]): Promise<any> {
method fieldMapper (line 803) | private fieldMapper(field: any): DataSourceColumnType {
method formatOutput (line 828) | private formatOutput(options: DataSourceFindOneOptions, data: { [key: ...
method formatField (line 842) | private formatField(type: DataSourceColumnType, value: any): any {
method pipeObjectToMongo (line 855) | private pipeObjectToMongo(
FILE: src/datasources/mssql.datasource.ts
constant DATABASE_TYPE (line 33) | const DATABASE_TYPE = DataSourceType.MSSQL
constant RESERVED_WORDS (line 34) | const RESERVED_WORDS = ['USER', 'TABLE']
class MSSQL (line 37) | class MSSQL {
method constructor (line 38) | constructor(
method reserveWordFix (line 44) | reserveWordFix(word: string): string {
method createConnection (line 51) | async createConnection(): Promise<sql.ConnectionPool> {
method checkConnection (line 73) | async checkConnection(options: { x_request_id?: string }): Promise<boo...
method performQuery (line 85) | async performQuery(options: { sql: string; values?: any[]; x_request_i...
method listTables (line 139) | async listTables(options: { x_request_id?: string }): Promise<string[]> {
method getSchema (line 159) | async getSchema(options: { table: string; x_request_id?: string }): Pr...
method createOne (line 308) | async createOne(options: DataSourceCreateOneOptions, x_request_id?: st...
method findOne (line 378) | async findOne(options: DataSourceFindOneOptions, x_request_id: string)...
method findMany (line 394) | async findMany(options: DataSourceFindManyOptions, x_request_id: strin...
method findTotalRecords (line 455) | async findTotalRecords(options: DataSourceFindTotalRecords, x_request_...
method updateOne (line 465) | async updateOne(options: DataSourceUpdateOneOptions, x_request_id: str...
method deleteOne (line 520) | async deleteOne(options: DataSourceDeleteOneOptions, x_request_id: str...
method uniqueCheck (line 554) | async uniqueCheck(options: DataSourceUniqueCheckOptions, x_request_id:...
method mapMSSQLError (line 656) | private mapMSSQLError(error: any): IsUniqueResponse {
method createTable (line 698) | async createTable(schema: DataSourceSchema, x_request_id?: string): Pr...
method find (line 753) | private find(
method fieldMapper (line 861) | private fieldMapper(type: MSSQLColumnType): DataSourceColumnType {
method fieldMapperReverse (line 911) | private fieldMapperReverse(type: DataSourceColumnType): MSSQLColumnType {
method pipeObjectToMSSQL (line 926) | private pipeObjectToMSSQL(
method formatOutput (line 965) | private formatOutput(options: DataSourceFindOneOptions, data: { [key: ...
method formatField (line 984) | private formatField(type: DataSourceColumnType, value: any): any {
method truncate (line 1001) | async truncate(table: string): Promise<void> {
method isIdentity (line 1005) | private isIdentity(options: DataSourceCreateOneOptions, columns: strin...
FILE: src/datasources/mysql.datasource.ts
constant DATABASE_TYPE (line 35) | const DATABASE_TYPE = DataSourceType.MYSQL
class MySQL (line 38) | class MySQL implements OnModuleInit, OnModuleDestroy {
method constructor (line 41) | constructor(
method onModuleInit (line 47) | async onModuleInit(): Promise<void> {
method logPoolStatistics (line 82) | private logPoolStatistics(): void {
method onModuleDestroy (line 102) | async onModuleDestroy(): Promise<void> {
method checkDataSource (line 109) | async checkDataSource(options: { x_request_id?: string }): Promise<boo...
method query (line 129) | async query(options: { sql: string; values?: any[]; x_request_id?: str...
method uniqueCheck (line 196) | async uniqueCheck(options: DataSourceUniqueCheckOptions, x_request_id:...
method mapMySQLError (line 317) | private mapMySQLError(e: any): IsUniqueResponse {
method getSchema (line 358) | async getSchema(options: { table: string; x_request_id?: string }): Pr...
method createTable (line 414) | async createTable(schema: DataSourceSchema, x_request_id?: string): Pr...
method listTables (line 475) | async listTables(options: { x_request_id?: string }): Promise<string[]> {
method createOne (line 491) | async createOne(options: DataSourceCreateOneOptions, x_request_id?: st...
method findOne (line 525) | async findOne(options: DataSourceFindOneOptions, x_request_id: string)...
method findMany (line 542) | async findMany(options: DataSourceFindManyOptions, x_request_id: strin...
method findTotalRecords (line 598) | async findTotalRecords(options: DataSourceFindTotalRecords, x_request_...
method updateOne (line 608) | async updateOne(options: DataSourceUpdateOneOptions, x_request_id: str...
method deleteOne (line 643) | async deleteOne(options: DataSourceDeleteOneOptions, x_request_id: str...
method truncate (line 681) | async truncate(table: string): Promise<void> {
method columnTypeFromDataSource (line 689) | private columnTypeFromDataSource(type: MySQLColumnType): DataSourceCol...
method columnTypeToDataSource (line 759) | private columnTypeToDataSource(type: DataSourceColumnType): MySQLColum...
method pipeObjectToDataSource (line 782) | private pipeObjectToDataSource(
method pipeObjectFromDataSource (line 819) | private pipeObjectFromDataSource(options: DataSourceFindOneOptions, da...
method find (line 853) | private find(
FILE: src/datasources/postgres.datasource.ts
constant DATABASE_TYPE (line 32) | const DATABASE_TYPE = DataSourceType.POSTGRES
class Postgres (line 35) | class Postgres {
method constructor (line 36) | constructor(
method createConnection (line 42) | async createConnection(): Promise<pg.Client> {
method checkConnection (line 59) | async checkConnection(options: { x_request_id?: string }): Promise<boo...
method performQuery (line 72) | async performQuery(options: { sql: string; values?: any[]; x_request_i...
method listTables (line 119) | async listTables(options: { x_request_id?: string }): Promise<string[]> {
method getSchema (line 140) | async getSchema(options: { table: string; x_request_id?: string }): Pr...
method createOne (line 235) | async createOne(options: DataSourceCreateOneOptions, x_request_id?: st...
method findOne (line 265) | async findOne(options: DataSourceFindOneOptions, x_request_id: string)...
method findMany (line 282) | async findMany(options: DataSourceFindManyOptions, x_request_id: strin...
method findTotalRecords (line 338) | async findTotalRecords(options: DataSourceFindTotalRecords, x_request_...
method updateOne (line 348) | async updateOne(options: DataSourceUpdateOneOptions, x_request_id: str...
method deleteOne (line 375) | async deleteOne(options: DataSourceDeleteOneOptions, x_request_id: str...
method uniqueCheck (line 407) | async uniqueCheck(options: DataSourceUniqueCheckOptions, x_request_id:...
method mapPostgreSQLError (line 504) | private mapPostgreSQLError(error: any): IsUniqueResponse {
method createTable (line 544) | async createTable(schema: DataSourceSchema, x_request_id?: string): Pr...
method find (line 614) | private find(
method fieldMapper (line 715) | private fieldMapper(type: PostgreSQLColumnType): DataSourceColumnType {
method fieldMapperReverse (line 747) | private fieldMapperReverse(type: DataSourceColumnType): PostgreSQLColu...
method pipeObjectToPostgres (line 766) | private pipeObjectToPostgres(
method formatOutput (line 799) | private formatOutput(options: DataSourceFindOneOptions, data: { [key: ...
method formatField (line 818) | private formatField(type: DataSourceColumnType, value: any): any {
method truncate (line 837) | async truncate(table: string): Promise<void> {
method resetSequences (line 844) | async resetSequences(x_request_id?: string): Promise<boolean> {
FILE: src/dtos/requests.dto.ts
class HeaderParams (line 3) | class HeaderParams {
class FindQueryParams (line 16) | class FindQueryParams {
class FindOneQueryParams (line 26) | class FindOneQueryParams extends FindQueryParams {}
class FindManyQueryParams (line 28) | class FindManyQueryParams extends FindQueryParams {
class CreateOneQueryParams (line 49) | class CreateOneQueryParams {}
class UpdateOneQueryParams (line 51) | class UpdateOneQueryParams {}
class DeleteOneQueryParams (line 53) | class DeleteOneQueryParams {}
FILE: src/dtos/response.dto.ts
class PaginationPage (line 3) | class PaginationPage {
class Pagination (line 24) | class Pagination {
class FindOneResponseObject (line 32) | class FindOneResponseObject {
class FindManyResponseObject (line 36) | class FindManyResponseObject {
class IsUniqueResponse (line 57) | class IsUniqueResponse {
class DeleteResponseObject (line 74) | class DeleteResponseObject {
class ListTablesResponseObject (line 83) | class ListTablesResponseObject {
class CreateResponseError (line 92) | class CreateResponseError {
class CreateManyResponseObject (line 100) | class CreateManyResponseObject {
class UpdateManyResponseObject (line 122) | class UpdateManyResponseObject extends CreateManyResponseObject {}
class DeleteManyResponseObject (line 124) | class DeleteManyResponseObject {
FILE: src/dtos/webhook.dto.ts
class Webhook (line 6) | class Webhook {
class WebhookLog (line 32) | class WebhookLog {
FILE: src/helpers/Authentication.ts
class Authentication (line 27) | class Authentication {
method constructor (line 28) | constructor(
method public (line 41) | async public(options: {
method auth (line 101) | async auth(options: {
method handleApiKeyAuth (line 139) | private async handleApiKeyAuth(
method handleJwtAuth (line 350) | private async handleJwtAuth(options: {
method getIdentityTable (line 420) | getIdentityTable(): string {
method getIdentityColumn (line 424) | async getIdentityColumn(x_request_id?: string): Promise<string> {
method skipAuth (line 437) | skipAuth(): boolean {
FILE: src/helpers/CircuitBreaker.ts
type CircuitState (line 5) | enum CircuitState {
class CircuitBreaker (line 12) | class CircuitBreaker {
method constructor (line 19) | constructor(private readonly logger: Logger) {}
method isAllowed (line 21) | public isAllowed(): boolean {
method reportSuccess (line 39) | public reportSuccess(): void {
method reportFailure (line 47) | public reportFailure(): void {
FILE: src/helpers/Database.ts
function deconstructConnectionString (line 7) | function deconstructConnectionString(connectionString: string): {
function UrlToTable (line 47) | function UrlToTable(uri: string, dropSlashes?: number): string {
function getDatabaseType (line 62) | function getDatabaseType(uri: string): DataSourceType {
function getDatabaseName (line 78) | function getDatabaseName(connectionString: string): string {
FILE: src/helpers/Documentation.ts
class Documentation (line 18) | class Documentation {
method constructor (line 19) | constructor(
method skipDocs (line 31) | skipDocs(): boolean {
method generateDocumentation (line 45) | async generateDocumentation(): Promise<OpenAPIV3_1.Document> {
method getAuthLoginPath (line 372) | getAuthLoginPath(): OpenAPIV3_1.OperationObject {
method getAuthLoginComponent (line 393) | getAuthLoginComponent(): OpenAPIV3_1.SchemaObject {
method getRequestBody (line 407) | getRequestBody(properties: object, required: string[], bodyRequired = ...
method get200Response (line 429) | get200Response(example: object, schemaName: string): OpenAPIV3_1.Respo...
method get400Response (line 447) | get400Response(): OpenAPIV3_1.ResponseObject {
method get401Response (line 453) | get401Response(): OpenAPIV3_1.ResponseObject {
method convertSchemaToOpenAPIBodyRequest (line 463) | convertSchemaToOpenAPIBodyRequest(schema: DataSourceSchema): object {
method convertSchemaToOpenAPIExample (line 481) | convertSchemaToOpenAPIExample(schema: DataSourceSchema): object {
method convertSchemaRequiredToOpenAPI (line 494) | convertSchemaRequiredToOpenAPI(schema: DataSourceSchema): string[] {
method convertSchemaToOpenAPISchema (line 502) | convertSchemaToOpenAPISchema(schema: DataSourceSchema): OpenAPIV3_1.Sc...
method getSecurityDefinitions (line 520) | getSecurityDefinitions(type): OpenAPIV3_1.SecuritySchemeObject {
method getListRequestBody (line 538) | getListRequestBody(schema: DataSourceSchema): OpenAPIV3_1.RequestBodyO...
method getSingleRequestBody (line 618) | getSingleRequestBody(schema: DataSourceSchema): OpenAPIV3_1.RequestBod...
FILE: src/helpers/Encryption.ts
class Encryption (line 11) | class Encryption {
method constructor (line 12) | constructor(private readonly logger: Logger) {}
method compare (line 18) | async compare(raw: string, encrypted: string, type: AuthPasswordEncryp...
method encrypt (line 38) | async encrypt(type: AuthPasswordEncryption, string: string, salt?: any...
FILE: src/helpers/Logger.ts
class Logger (line 8) | class Logger extends ConsoleLogger {
method constructor (line 9) | constructor(context = 'Llana') {
method error (line 13) | error(message: any, ...optionalParams: [...any, string?]): void {
method warn (line 19) | warn(message: any, ...optionalParams: [...any, string?]): void {
method log (line 25) | log(message: any, ...optionalParams: [...any, string?]): void {
method debug (line 31) | debug(message: any, ...optionalParams: [...any, string?]): void {
method verbose (line 37) | verbose(message: any, ...optionalParams: [...any, string?]): void {
method status (line 43) | status(): void {
method table (line 53) | table(data: any): void {
function logLevel (line 58) | function logLevel(): LogLevel[] {
FILE: src/helpers/Pagination.ts
class Pagination (line 7) | class Pagination {
method constructor (line 8) | constructor(private readonly configService: ConfigService) {}
method get (line 14) | get(query: FindManyQueryParams): { limit: number; offset: number } {
method set (line 33) | set(limit: number, offset: number): string {
method encodePage (line 37) | encodePage(options: { limit: number; offset: number }): string {
method decodePage (line 41) | decodePage(page: string): { limit: number; offset: number } {
method current (line 45) | current(limit: number, offset: number): string {
method previous (line 49) | previous(limit: number, offset: number): string {
method next (line 54) | next(limit: number, offset: number, total: number): string {
method first (line 59) | first(limit: number): string {
method last (line 63) | last(limit: number, total: number): string {
FILE: src/helpers/Query.ts
class Query (line 40) | class Query {
method constructor (line 41) | constructor(
method perform (line 54) | async perform(
method buildFindManyOptionsFromRequest (line 207) | async buildFindManyOptionsFromRequest(options: {
method createTable (line 350) | private async createTable(schema: DataSourceSchema, x_request_id: stri...
method createOne (line 372) | private async createOne(options: DataSourceCreateOneOptions, x_request...
method findOne (line 408) | private async findOne(options: DataSourceFindOneOptions, x_request_id:...
method findMany (line 448) | private async findMany(options: DataSourceFindManyOptions, x_request_i...
method updateOne (line 484) | private async updateOne(options: DataSourceUpdateOneOptions, x_request...
method deleteOne (line 520) | private async deleteOne(options: DataSourceDeleteOneOptions, x_request...
method isUnique (line 557) | private async isUnique(options: DataSourceUniqueCheckOptions, x_reques...
method truncate (line 593) | private async truncate(table_name: string, x_request_id?: string): Pro...
method identityOperationCheck (line 621) | private async identityOperationCheck(
method checkConnection (line 643) | private async checkConnection(options: { x_request_id?: string }): Pro...
method listTables (line 667) | private async listTables(
method buildRelations (line 716) | async buildRelations(
method resetSequences (line 779) | private async resetSequences(x_request_id?: string): Promise<boolean> {
method getTableRelationColumn (line 788) | getTableRelationColumn(relation: DataSourceSchemaRelation, currentTabl...
method getChildTableRelation (line 800) | getChildTableRelation(relation: DataSourceSchemaRelation, currentTable...
FILE: src/helpers/Response.ts
class Response (line 5) | class Response {
method constructor (line 6) | constructor() {}
method text (line 12) | text(string: string): string {
FILE: src/helpers/Roles.ts
class Roles (line 18) | class Roles {
method constructor (line 19) | constructor(
method tablePermission (line 36) | async tablePermission(options: {
method getRole (line 255) | private async getRole(identifier: string, x_request_id: string): Promi...
function comparePermissions (line 293) | function comparePermissions(permission: RolePermission, access: RolePerm...
FILE: src/helpers/Schema.ts
class Schema (line 35) | class Schema {
method constructor (line 36) | constructor(
method getSchema (line 51) | async getSchema(options: { table: string; x_request_id?: string; field...
method getPrimaryKey (line 176) | getPrimaryKey(schema: DataSourceSchema): string {
method schemaToClass (line 188) | schemaToClass(schema: DataSourceSchema, data?: { [key: string]: any })...
method pipeResponse (line 241) | async pipeResponse(
method validateData (line 329) | async validateData(
method validateFields (line 387) | async validateFields(options: {
method validateField (line 434) | validateField(schema: DataSourceSchema, field: string): boolean {
method validateRelations (line 442) | async validateRelations(options: {
method validateWhereParams (line 522) | async validateWhereParams(options: { schema: DataSourceSchema; params:...
method validateSort (line 622) | validateSort(options: { schema: DataSourceSchema; sort: string[] }): V...
method convertDeepWhere (line 664) | async convertDeepWhere(options: {
method convertDeepField (line 707) | async convertDeepField(options: {
method convertDeepRelation (line 762) | async convertDeepRelation(options: {
method createSortArray (line 809) | createSortArray(sort: string[]): SortCondition[] {
FILE: src/helpers/Webhook.ts
class Webhook (line 19) | class Webhook {
method constructor (line 20) | constructor(
method publish (line 29) | async publish(
method getPendingWebhooks (line 128) | async getPendingWebhooks(): Promise<WebhookLog[]> {
method sendWebhook (line 154) | async sendWebhook(webhook: WebhookLog): Promise<void> {
method addWebhook (line 207) | async addWebhook(data: Partial<WebhookType>): Promise<FindOneResponseO...
method editWebhook (line 217) | async editWebhook(id: string, data: Partial<WebhookType>): Promise<Fin...
method deleteWebhook (line 234) | async deleteWebhook(id: string): Promise<void> {
FILE: src/main.ts
function bootstrap (line 14) | async function bootstrap() {
FILE: src/middleware/HostCheck.ts
class HostCheckMiddleware (line 9) | class HostCheckMiddleware implements NestMiddleware {
method constructor (line 10) | constructor(
method use (line 15) | use(req: Request, res: Response, next: NextFunction) {
method validateHost (line 30) | validateHost(headers: any, domain?: string): boolean {
FILE: src/middleware/Robots.ts
class RobotsMiddleware (line 5) | class RobotsMiddleware implements NestMiddleware {
method use (line 6) | use(req: Request, res: Response, next: NextFunction) {
FILE: src/middleware/request-path-logger.middleware.ts
class RequestPathLoggerMiddleware (line 7) | class RequestPathLoggerMiddleware implements NestMiddleware {
method use (line 8) | use(req: Request, res: Response, next: NextFunction) {
FILE: src/modules/cache/dataCache.constants.ts
constant REDIS_CACHE_TOKEN (line 1) | const REDIS_CACHE_TOKEN = 'REDIS_CACHE'
FILE: src/modules/cache/dataCache.service.ts
class DataCacheService (line 20) | class DataCacheService implements OnApplicationShutdown {
method constructor (line 21) | constructor(
method onApplicationShutdown (line 30) | onApplicationShutdown() {
method useRedis (line 36) | public useRedis(): boolean {
method cacheType (line 42) | public cacheType(): 'READ' | 'WRITE' | undefined {
method read (line 66) | public async read(key: string): Promise<any> {
method write (line 85) | public async write(key: string, value: any, ttl: number): Promise<void> {
method del (line 104) | public async del(key: string): Promise<void> {
method get (line 120) | async get(options: { originalUrl: string; x_request_id: string }): Pro...
method ping (line 202) | async ping(table: string) {
method refresh (line 249) | async refresh(cronSchedule: CronExpression) {
FILE: src/modules/websocket/redis-mock-with-pub-sub.ts
class RedisMockWithPubSub (line 3) | class RedisMockWithPubSub {
method publish (line 8) | async publish(channel: string, message: string) {
method subscribe (line 19) | subscribe() {}
method on (line 21) | on(event: string, callback: (channel, message) => void) {
method unsubscribe (line 26) | unsubscribe() {}
method disconnect (line 28) | disconnect() {}
FILE: src/modules/websocket/websocket.constants.ts
constant REDIS_PUB_CLIENT_TOKEN (line 1) | const REDIS_PUB_CLIENT_TOKEN = 'REDIS_PUB_CLIENT'
constant REDIS_SUB_CLIENT_TOKEN (line 2) | const REDIS_SUB_CLIENT_TOKEN = 'REDIS_SUB_CLIENT'
constant WEBSOCKETS_REDIS_CHANNEL (line 3) | const WEBSOCKETS_REDIS_CHANNEL = 'websockets'
type WebsocketRedisEvent (line 4) | type WebsocketRedisEvent = {
FILE: src/modules/websocket/websocket.gateway.spec.ts
constant SOCKET_TIMEOUT (line 19) | const SOCKET_TIMEOUT = 3000
constant PORT1 (line 28) | const PORT1 = 8998
constant PORT2 (line 29) | const PORT2 = 8999
type App (line 31) | type App = {
function listenAndOpenSocket (line 58) | async function listenAndOpenSocket(authToken: string, table: string, por...
function waitForSocketToBeReady (line 290) | async function waitForSocketToBeReady(clientSocket: Socket, timeoutMs: n...
function waitForSocketEvent (line 314) | async function waitForSocketEvent(clientSocket: Socket, timeoutMs: numbe...
function createApp (line 330) | async function createApp(port: number): Promise<App> {
function createSocket (line 370) | function createSocket(port: number, token: string, table: string): Socket {
FILE: src/modules/websocket/websocket.gateway.ts
class WebsocketGateway (line 27) | class WebsocketGateway
method constructor (line 33) | constructor(
method afterInit (line 41) | async afterInit(server: Server) {
method onApplicationShutdown (line 51) | onApplicationShutdown() {
method subscribeToEvents (line 55) | private async subscribeToEvents() {
method emitToSockets (line 73) | private async emitToSockets(msg: WebsocketRedisEvent) {
method handleConnection (line 114) | handleConnection(client: any) {
method handleDisconnect (line 123) | handleDisconnect(client: any) {
method handleMessage (line 139) | handleMessage(client: any, payload: any): string {
FILE: src/modules/websocket/websocket.jwt-auth.middleware.ts
type SocketIOMiddleware (line 8) | type SocketIOMiddleware = {
type AuthSocket (line 12) | interface AuthSocket extends Socket {
FILE: src/modules/websocket/websocket.service.ts
class WebsocketService (line 9) | class WebsocketService implements OnApplicationShutdown {
method constructor (line 10) | constructor(
method onApplicationShutdown (line 15) | onApplicationShutdown() {
method publish (line 19) | public async publish(schema: DataSourceSchema, type: PublishType, id: ...
FILE: src/modules/welcome/welcome.controller.ts
class WelcomeController (line 4) | class WelcomeController {
method root (line 7) | root() {
FILE: src/modules/welcome/welcome.module.ts
class WelcomeModule (line 8) | class WelcomeModule {}
FILE: src/testing/auth.testing.service.ts
class AuthTestingService (line 21) | class AuthTestingService {
method constructor (line 22) | constructor(
method login (line 30) | async login(): Promise<string> {
method getUserId (line 42) | async getUserId(jwt: string): Promise<number> {
method findUser (line 47) | async findUser(username: string): Promise<[any, string]> {
method createPublicTablesRecord (line 80) | async createPublicTablesRecord(data: {
method deletePublicTablesRecord (line 92) | async deletePublicTablesRecord(data: any): Promise<void> {
method createRole (line 100) | async createRole(data: {
method deleteRole (line 116) | async deleteRole(data: any): Promise<void> {
FILE: src/testing/customer.testing.service.ts
class CustomerTestingService (line 12) | class CustomerTestingService {
method constructor (line 13) | constructor(
method mockCustomer (line 18) | mockCustomer(userId: any): any {
method getSchema (line 36) | async getSchema(): Promise<any> {
method createCustomer (line 40) | async createCustomer(customer: any): Promise<any> {
method deleteCustomer (line 58) | async deleteCustomer(id: any): Promise<void> {
FILE: src/testing/employee.testing.service.ts
class EmployeeTestingService (line 12) | class EmployeeTestingService {
method constructor (line 13) | constructor(
method mockEmployee (line 18) | mockEmployee(): any {
method getSchema (line 43) | async getSchema(): Promise<any> {
method createEmployee (line 47) | async createEmployee(employee: any): Promise<any> {
method getEmployee (line 65) | async getEmployee(): Promise<any> {
method deleteEmployee (line 77) | async deleteEmployee(id: any): Promise<void> {
FILE: src/testing/relations.testing.service.ts
class RelationsTestingService (line 10) | class RelationsTestingService {
method constructor (line 11) | constructor(
method createRelationsRecord (line 16) | async createRelationsRecord(data: DataSourceSchemaRelation): Promise<F...
method deleteRelationsRecord (line 24) | async deleteRelationsRecord(data: any): Promise<void> {
FILE: src/testing/salesorder.testing.service.ts
class SalesOrderTestingService (line 12) | class SalesOrderTestingService {
method constructor (line 13) | constructor(
method mockOrder (line 18) | mockOrder(): any {
method getSchema (line 34) | async getSchema(): Promise<any> {
method createOrder (line 38) | async createOrder(order: { custId; employeeId; shipperId; orderId? }):...
method deleteOrder (line 56) | async deleteOrder(id: any): Promise<void> {
FILE: src/testing/shipper.testing.service.ts
class ShipperTestingService (line 12) | class ShipperTestingService {
method constructor (line 13) | constructor(
method mockShipper (line 18) | mockShipper(): any {
method getSchema (line 27) | async getSchema(): Promise<any> {
method createShipper (line 31) | async createShipper(shipper: any): Promise<any> {
method getShipper (line 49) | async getShipper(): Promise<any> {
method deleteShipper (line 61) | async deleteShipper(id: any): Promise<void> {
FILE: src/testing/testing.const.ts
constant TIMEOUT (line 1) | const TIMEOUT = 120000
FILE: src/testing/user.testing.service.ts
class UserTestingService (line 12) | class UserTestingService {
method constructor (line 13) | constructor(
method mockUser (line 18) | mockUser(props = {}): any {
method getSchema (line 32) | async getSchema(): Promise<any> {
method createUser (line 36) | async createUser(user?: any): Promise<any> {
method deleteUser (line 54) | async deleteUser(id: any): Promise<void> {
FILE: src/types/auth.types.ts
type Auth (line 5) | interface Auth {
type AuthType (line 12) | enum AuthType {
type AuthLocation (line 17) | enum AuthLocation {
type AuthAPIKey (line 23) | interface AuthAPIKey extends AuthTableSettings {
type AuthJWT (line 27) | interface AuthJWT extends AuthTableSettings {
type AuthTableSettings (line 38) | interface AuthTableSettings {
type AuthPasswordEncryption (line 43) | enum AuthPasswordEncryption {
type AuthRestrictionsResponse (line 52) | interface AuthRestrictionsResponse {
type AuthTablePermissionSuccessResponse (line 59) | interface AuthTablePermissionSuccessResponse extends AuthTablePermission...
type AuthTablePermissionFailResponse (line 64) | interface AuthTablePermissionFailResponse extends AuthTablePermissionRes...
type AuthTablePermissionResponse (line 68) | interface AuthTablePermissionResponse {
type AuthenticatedRequest (line 72) | interface AuthenticatedRequest extends Request {
FILE: src/types/datasource.types.ts
type DataSourceType (line 3) | enum DataSourceType {
type DataSourceNaming (line 11) | enum DataSourceNaming {
type QueryPerform (line 16) | enum QueryPerform {
type PublishType (line 30) | enum PublishType {
type WhereOperator (line 36) | enum WhereOperator {
type DataSourceColumnType (line 52) | enum DataSourceColumnType {
type ImportMode (line 62) | enum ImportMode {
type ChartsPeriod (line 69) | enum ChartsPeriod {
type ChartResult (line 80) | interface ChartResult {
type DataSourceSchema (line 86) | interface DataSourceSchema {
type DataSourceWhere (line 94) | interface DataSourceWhere {
type ColumnExtraNumber (line 100) | interface ColumnExtraNumber {
type ColumnExtraString (line 104) | interface ColumnExtraString {
type DataSourceSchemaColumn (line 108) | interface DataSourceSchemaColumn {
type DataSourceSchemaRelation (line 122) | interface DataSourceSchemaRelation {
type DataSourceCreateOneOptions (line 129) | interface DataSourceCreateOneOptions {
type DataSourceRelations (line 134) | interface DataSourceRelations {
type DataSourceFindOneOptions (line 142) | interface DataSourceFindOneOptions extends DataSourceFindOptions {}
type DataSourceFindManyOptions (line 144) | interface DataSourceFindManyOptions extends DataSourceFindOptions {
type DataSourceFindOptions (line 150) | interface DataSourceFindOptions {
type DataSourceUpdateOneOptions (line 157) | interface DataSourceUpdateOneOptions {
type DataSourceDeleteOneOptions (line 163) | interface DataSourceDeleteOneOptions {
type DataSourceFindTotalRecords (line 169) | interface DataSourceFindTotalRecords {
type DataSourceConfig (line 174) | interface DataSourceConfig {
type DataSourceUniqueCheckOptions (line 190) | interface DataSourceUniqueCheckOptions {
type DataSourceListTablesOptions (line 199) | interface DataSourceListTablesOptions {
type DatabaseErrorType (line 204) | enum DatabaseErrorType {
type DataSourceInterface (line 213) | interface DataSourceInterface {
FILE: src/types/datasources/airtable.types.ts
type AirtableColumnType (line 1) | enum AirtableColumnType {
FILE: src/types/datasources/mssql.types.ts
type MSSQLColumnType (line 1) | enum MSSQLColumnType {
FILE: src/types/datasources/mysql.types.ts
type MySQLColumnType (line 1) | enum MySQLColumnType {
FILE: src/types/datasources/postgres.types.ts
type PostgreSQLColumnType (line 1) | enum PostgreSQLColumnType {
FILE: src/types/response.types.ts
type Method (line 1) | enum Method {
FILE: src/types/roles.types.ts
type RolePermission (line 1) | enum RolePermission {
type TableRole (line 8) | interface TableRole extends Role {
type Role (line 12) | interface Role {
type DefaultRole (line 19) | interface DefaultRole extends Role {}
type CustomRole (line 21) | interface CustomRole extends Role {
type RoleLocation (line 27) | interface RoleLocation {
type RolesConfig (line 33) | interface RolesConfig {
FILE: src/types/schema.types.ts
type ValidateFieldsResponse (line 3) | interface ValidateFieldsResponse extends ValidateResponse {
type validateRelationsResponse (line 8) | interface validateRelationsResponse extends ValidateResponse {
type validateWhereResponse (line 12) | interface validateWhereResponse extends ValidateResponse {
type ValidateSortResponse (line 16) | interface ValidateSortResponse extends ValidateResponse {
type ValidateResponse (line 20) | interface ValidateResponse {
type SortCondition (line 25) | interface SortCondition {
FILE: src/utils/Env.ts
class Env (line 7) | class Env {
method get (line 12) | static get(): Environment {
method IsProd (line 20) | static IsProd(): boolean {
method IsDev (line 28) | static IsDev(): boolean {
method IsTest (line 36) | static IsTest(): boolean {
method IsNotTest (line 44) | static IsNotTest(): boolean {
method IsNotProd (line 52) | static IsNotProd(): boolean {
method IsSandbox (line 60) | static IsSandbox(): boolean {
method useCache (line 65) | static useCache(): boolean {
method readEnvVars (line 72) | static readEnvVars(options: { envPath: string; fileName: string }) {
method getEnvValue (line 82) | static getEnvValue(options: { key: string; envPath: string; fileName: ...
method setEnvValue (line 97) | static setEnvValue(options: { key: string; value: string; envPath?: st...
method setEnv (line 114) | static setEnv(options: { values: { [key: string]: string }; envPath?: ...
FILE: src/utils/Env.types.ts
type Environment (line 1) | enum Environment {
function fromStringToEnv (line 8) | function fromStringToEnv(env = process.env.NODE_ENV): Environment {
FILE: src/utils/Find.ts
function findDotNotation (line 5) | function findDotNotation(obj: any, search: string): boolean {
FILE: src/utils/String.ts
function replaceQ (line 7) | function replaceQ(string: string, array: any[]): string {
function plural (line 32) | function plural(word: string, amount?: number): string {
function commaStringToArray (line 119) | function commaStringToArray(string: string): string[] {
function cronToSeconds (line 131) | function cronToSeconds(cron: CronExpression): number {
FILE: src/utils/redoc/interfaces/redoc.interface.ts
type RedocOptions (line 1) | interface RedocOptions {
type LogoOptions (line 61) | interface LogoOptions {
type TagGroupOptions (line 72) | interface TagGroupOptions {
FILE: src/utils/redoc/redoc.ts
class RedocModule (line 6) | class RedocModule {
method setup (line 10) | public static async setup(options: RedocOptions): Promise<string> {
Condensed preview — 127 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (869K chars).
[
{
"path": ".dockerignore",
"chars": 127,
"preview": "/.docker\n/.github\n/.vscode\n/docker\n/Dockerfile\n/docker-compose.yml\n/node_modules\nnpm-debug.log*\nyarn-debug.log*\nyarn-err"
},
{
"path": ".env.example",
"chars": 515,
"preview": "### Please consult https://llana.io/configuration for full details ###\n\nSOFTWARE_VERSION_TAG=latest\nPORT=3000\nADMIN_EMA"
},
{
"path": ".github/dependabot.yml",
"chars": 268,
"preview": "# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.y"
},
{
"path": ".github/workflows/codeql.yml",
"chars": 4267,
"preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
},
{
"path": ".github/workflows/pr.yml",
"chars": 1613,
"preview": "#\n# GitHub Actions workflow.\n#\n# Perfoms the following actions on a pull request:\n# * Checkout the code\n# * Install Node"
},
{
"path": ".github/workflows/release.yml",
"chars": 4219,
"preview": "#\n# GitHub Actions workflow.\n#\n# Releases the package to npm when a push into main is detected.\n# * Checkout the code\n# "
},
{
"path": ".github/workflows/snyk-security.yml",
"chars": 1423,
"preview": "name: Snyk Security\n\non:\n pull_request:\n branches: [\"main\"]\n\npermissions:\n contents: read\n\njobs:\n snyk:\n permis"
},
{
"path": ".gitignore",
"chars": 6813,
"preview": "#Env\n.env\n.env.*\n!.env.example\n\n#llana specific\nopenapi.json\n\n\n# Created by .ignore support plugin (hsz.mobi)\n### JetBra"
},
{
"path": ".vscode/launch.json",
"chars": 1329,
"preview": "{\n\t\"version\": \"0.2.0\",\n\t\"configurations\": [\n\t\t{\n\t\t\t\"name\": \"start\",\n\t\t\t\"type\": \"node\",\n\t\t\t\"request\": \"launch\",\n\t\t\t\"runti"
},
{
"path": ".vscode/settings.json",
"chars": 65,
"preview": "{\n \"cSpell.words\": [\n \"Bootup\",\n \"LLANA\"\n ]\n}"
},
{
"path": ".vscode/tasks.json",
"chars": 503,
"preview": "{\n \"version\": \"2.0.0\",\n \"tasks\": [\n {\n \"label\": \"Start Docker\",\n \"type\": \"shell\",\n "
},
{
"path": "README.md",
"chars": 1835,
"preview": "<div align=\"center\">\n\n# Llana\n\n <a href=\"https://juicyllama.com/\" target=\"_blank\">\n <img src=\"https://juicyllama.com"
},
{
"path": "demo/databases/airtable.ts",
"chars": 23488,
"preview": "import 'dotenv/config'\nimport { Logger } from '../../src/helpers/Logger'\nimport axios, { AxiosRequestConfig } from 'axio"
},
{
"path": "demo/databases/json/Customer.json",
"chars": 3784,
"preview": "[{\n \"userId\": 1,\n \"custId\": 1,\n \"fax\": \"030-0123456\",\n \"city\": \"Berlin\",\n \"email\": null,\n \"phone\": \"03"
},
{
"path": "demo/databases/json/Employee.json",
"chars": 2566,
"preview": "[{\n \"employeeId\": 1,\n \"city\": \"Seattle\",\n \"email\": null,\n \"notes\": null,\n \"phone\": \"(206) 555-0101\",\n "
},
{
"path": "demo/databases/json/Shipper.json",
"chars": 273,
"preview": "[{\n \"shipperId\": 1,\n \"phone\": \"(503) 555-0137\",\n \"companyName\": \"Shipper GVSUA\"\n}, {\n \"shipperId\": 2,\n \"p"
},
{
"path": "demo/databases/mongodb.js",
"chars": 24553,
"preview": "//seed\ndb = db.getSiblingDB('llana');\n\ndb.User.insert({\n \"email\": \"test@test.com\", \n \"password\": \"$2a$10$jm6bM7acp"
},
{
"path": "demo/databases/mssql.sql",
"chars": 20500,
"preview": "CREATE DATABASE llana;\n\nUSE llana;\n\nCREATE TABLE [User] (\n id int NOT NULL IDENTITY\n ,email varchar(255) NOT NULL\n ,p"
},
{
"path": "demo/databases/mysql.sql",
"chars": 20588,
"preview": "CREATE DATABASE IF NOT EXISTS llana;\n\nUSE llana;\n\nCREATE TABLE IF NOT EXISTS `User` (\n id int NOT NULL AUTO_INCREMENT\n "
},
{
"path": "demo/databases/postgres.sql",
"chars": 29519,
"preview": "DROP TABLE IF EXISTS \"User\";\n\nDROP TYPE IF EXISTS userrole;\nCREATE TYPE userrole AS ENUM ('ADMIN','USER');\n\nCREATE TABLE"
},
{
"path": "demo/databases/sqlite.sql",
"chars": 33397,
"preview": "-- Sqlite SQL script \n\nPRAGMA encoding=\"UTF-8\";\n\n\nDROP TABLE IF EXISTS Customer;\n\nCREATE TABLE Customer (\n entityId INT"
},
{
"path": "docker/docker-compose.dev.yml",
"chars": 4407,
"preview": "name: llana\n\nnetworks:\n llana-network:\n driver: bridge\n name: llana-network\n\nvolumes:\n llana-mysql-d"
},
{
"path": "docker/docker-compose.test.prod.build.yml",
"chars": 461,
"preview": "name: llana\n\nservices:\n llana-test-prod-build-app:\n container_name: llana-test-prod-build-app\n build:\n "
},
{
"path": "docker/docker-compose.test.prod.yml",
"chars": 396,
"preview": "name: llana\n\nservices:\n llana-prod-test-app:\n container_name: llana-prod-test-app\n image: juicyllama/ll"
},
{
"path": "docker/images/base/Dockerfile",
"chars": 705,
"preview": "###################\n# BUILD\n###################\n\nARG NODE_VERSION=22\n\n# Use a builder step to download various dependenc"
},
{
"path": "docker/images/llana/Dockerfile",
"chars": 145,
"preview": "###################\n# PRODUCTION\n###################\n\nFROM juicyllama/llana:latest\n\nUSER node\n\nRUN cd /usr/src/app\n\nCMD "
},
{
"path": "eslint.config.mjs",
"chars": 1541,
"preview": "import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin'\nimport globals from 'globals'\nimport tsParse"
},
{
"path": "nest-cli.json",
"chars": 614,
"preview": "{\n \"$schema\": \"https://json.schemastore.org/nest-cli\",\n \"collection\": \"@nestjs/schematics\",\n \"sourceRoot\": \"src\",\n \""
},
{
"path": "package.json",
"chars": 5146,
"preview": "{\n\t\"name\": \"@juicyllama/llana\",\n\t\"version\": \"1.32.0\",\n\t\"description\": \"API Wrapper for Databases - Llana is a no-code AP"
},
{
"path": "pr_description.md",
"chars": 1309,
"preview": "# Improve Response Errors to be More Descriptive\n\n## Description\nThis PR implements standardized error handling across a"
},
{
"path": "scripts/docker.build.prod.sh",
"chars": 149,
"preview": "#!/bin/bash\ndocker-compose rm -f ./docker/docker-compose.test.prod.build.yml\ndocker compose -f ./docker/docker-compose.t"
},
{
"path": "scripts/docker.dev.sh",
"chars": 218,
"preview": "#!/bin/bash\ndocker compose -f ./docker/docker-compose.dev.yml down --remove-orphans --volumes\ndocker compose -f ./docke"
},
{
"path": "scripts/docker.prod.sh",
"chars": 137,
"preview": "#!/bin/bash\ndocker-compose rm -f ./docker/docker-compose.test.prod.yml\ndocker compose -f ./docker/docker-compose.test.pr"
},
{
"path": "scripts/install.sh",
"chars": 961,
"preview": "#!/bin/bash\n\n## check if .env file exists, if not create it from .env.example\n\nif [ ! -f .env ]; then\n echo \"Creating"
},
{
"path": "scripts/test.sh",
"chars": 829,
"preview": "#!/bin/sh\n\n## Objective is to run over each data source and run the tests, allowing us to fully test every datasource ea"
},
{
"path": "src/app.constants.ts",
"chars": 905,
"preview": "import { DataSourceType } from './types/datasource.types'\n\nexport const NON_FIELD_PARAMS = ['fields', 'limit', 'offset',"
},
{
"path": "src/app.controller.auth.test.spec.ts",
"chars": 6740,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { Test } from '@nestjs/testing'\nimport { JwtModule } from '@nes"
},
{
"path": "src/app.controller.auth.ts",
"chars": 7039,
"preview": "import {\n\tBadRequestException,\n\tController,\n\tGet,\n\tHeaders,\n\tParseArrayPipe,\n\tPost,\n\tQuery as QueryParams,\n\tReq,\n\tRes,\n\t"
},
{
"path": "src/app.controller.delete.test.spec.ts",
"chars": 12807,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { ConfigFactory, ConfigModule, ConfigService } from '@nestjs/co"
},
{
"path": "src/app.controller.delete.ts",
"chars": 8304,
"preview": "import { Body, Controller, Delete, Headers, Param, Query as QueryParams, Req, Res } from '@nestjs/common'\nimport { Confi"
},
{
"path": "src/app.controller.docs.ts",
"chars": 1041,
"preview": "import { Controller, Get, Res } from '@nestjs/common'\nimport * as fs from 'fs'\n\nimport { version } from '../package.json"
},
{
"path": "src/app.controller.get.test.spec.ts",
"chars": 31409,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { ConfigFactory, ConfigModule, ConfigService } from '@nestjs/co"
},
{
"path": "src/app.controller.get.ts",
"chars": 18205,
"preview": "import { Controller, Get, Headers, Param, ParseArrayPipe, Query as QueryParams, Req, Res } from '@nestjs/common'\nimport "
},
{
"path": "src/app.controller.post.test.spec.ts",
"chars": 25527,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { Test } from '@nestjs/testing'\nimport { ConfigModule, ConfigSe"
},
{
"path": "src/app.controller.post.ts",
"chars": 7242,
"preview": "import { Body, Controller, Headers, Post, Req, Res } from '@nestjs/common'\n\nimport { LLANA_WEBHOOK_TABLE } from './app.c"
},
{
"path": "src/app.controller.put.test.spec.ts",
"chars": 23325,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { Test } from '@nestjs/testing'\nimport { ConfigModule, ConfigSe"
},
{
"path": "src/app.controller.put.ts",
"chars": 12051,
"preview": "import { Body, Controller, Headers, Param, Patch, Put, Req, Res } from '@nestjs/common'\n\nimport { LLANA_WEBHOOK_TABLE } "
},
{
"path": "src/app.module.test.spec.ts",
"chars": 676,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { Test } from '@nestjs/testing'\nimport * as request from 'super"
},
{
"path": "src/app.module.ts",
"chars": 5514,
"preview": "import { CacheModule } from '@nestjs/cache-manager'\nimport { MiddlewareConsumer, Module, NestModule } from '@nestjs/comm"
},
{
"path": "src/app.service.auth.ts",
"chars": 2449,
"preview": "import { Injectable, UnauthorizedException } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport"
},
{
"path": "src/app.service.bootup.ts",
"chars": 25158,
"preview": "import { CACHE_MANAGER } from '@nestjs/cache-manager'\nimport { Inject, Injectable, OnApplicationBootstrap } from '@nestj"
},
{
"path": "src/app.service.tasks.ts",
"chars": 1262,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport { Cron, CronExpression"
},
{
"path": "src/auth/auth.constants.ts",
"chars": 194,
"preview": "export const JWT = 'jwt'\n\nexport const ACCESS_TOKEN_COOKIE_NAME = 'accessToken'\nexport const REFRESH_TOKEN_COOKIE_NAME ="
},
{
"path": "src/auth/guards/jwt-auth.guard.ts",
"chars": 197,
"preview": "import { Injectable } from '@nestjs/common'\nimport { AuthGuard } from '@nestjs/passport'\n\nimport { JWT } from '../auth.c"
},
{
"path": "src/auth/guards/local-auth.guard.ts",
"chars": 162,
"preview": "import { Injectable } from '@nestjs/common'\nimport { AuthGuard } from '@nestjs/passport'\n\n@Injectable()\nexport class Loc"
},
{
"path": "src/auth/strategies/local.strategy.ts",
"chars": 2514,
"preview": "import { Injectable, UnauthorizedException } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport"
},
{
"path": "src/config/auth.config.ts",
"chars": 1290,
"preview": "import { registerAs } from '@nestjs/config'\n\nimport { Auth, AuthAPIKey, AuthJWT, AuthLocation, AuthPasswordEncryption, A"
},
{
"path": "src/config/class-validator.config.ts",
"chars": 69,
"preview": "export const classValidatorConfig = {\n\tforbidUnknownValues: false,\n}\n"
},
{
"path": "src/config/database.config.ts",
"chars": 719,
"preview": "import 'dotenv/config'\n\nimport { registerAs } from '@nestjs/config'\n\nimport { getDatabaseType } from '../helpers/Databas"
},
{
"path": "src/config/env.validation.spec.ts",
"chars": 1453,
"preview": "import { envValidationSchema } from './env.validation'\n\ndescribe('Environment Validation', () => {\n\tdescribe('PORT valid"
},
{
"path": "src/config/env.validation.ts",
"chars": 1919,
"preview": "import * as Joi from 'joi'\n\nimport { AuthPasswordEncryption } from '../types/auth.types'\n\nexport const envValidationSche"
},
{
"path": "src/config/hosts.config.ts",
"chars": 248,
"preview": "import { registerAs } from '@nestjs/config'\n\n/**\n * If you would like to globally lock down your API to specific hosts, "
},
{
"path": "src/config/jwt.config.ts",
"chars": 202,
"preview": "import { registerAs } from '@nestjs/config'\nexport default registerAs(\n\t'jwt',\n\t() =>\n\t\t<any>{\n\t\t\tsecret: process.env.JW"
},
{
"path": "src/config/roles.config.ts",
"chars": 475,
"preview": "import { registerAs } from '@nestjs/config'\n\nimport { RoleLocation, RolesConfig } from '../types/roles.types'\n\nexport de"
},
{
"path": "src/datasources/airtable.datasource.ts",
"chars": 29689,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport axios from 'axios'\n\nim"
},
{
"path": "src/datasources/mongo.datasource.ts",
"chars": 21944,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport { Collection, Db, Mong"
},
{
"path": "src/datasources/mssql.datasource.ts",
"chars": 28888,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport * as sql from 'mssql'\n"
},
{
"path": "src/datasources/mysql.datasource.ts",
"chars": 26576,
"preview": "import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config"
},
{
"path": "src/datasources/postgres.datasource.ts",
"chars": 27034,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport * as pg from 'pg'\n\nimp"
},
{
"path": "src/dtos/requests.dto.ts",
"chars": 816,
"preview": "import { IsNumber, IsOptional, IsString } from 'class-validator'\n\nexport class HeaderParams {\n\t@IsOptional()\n\t@IsString("
},
{
"path": "src/dtos/response.dto.ts",
"chars": 1921,
"preview": "import { IsArray, IsBoolean, IsNumber, IsObject, IsOptional, IsString } from 'class-validator'\n\nexport class PaginationP"
},
{
"path": "src/dtos/webhook.dto.ts",
"chars": 1055,
"preview": "import { IsBoolean, IsDate, IsDateString, IsEnum, IsNumber, IsOptional, IsString } from 'class-validator'\n\nimport { Publ"
},
{
"path": "src/helpers/Authentication.ts",
"chars": 11641,
"preview": "import { CACHE_MANAGER } from '@nestjs/cache-manager'\nimport { Inject, Injectable } from '@nestjs/common'\nimport { Confi"
},
{
"path": "src/helpers/CircuitBreaker.ts",
"chars": 1470,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { Logger } from './Logger'\n\nexport enum CircuitState {\n\tCLOSED, // N"
},
{
"path": "src/helpers/Database.ts",
"chars": 2061,
"preview": "import 'dotenv/config'\n\nimport * as escape from 'escape-html'\n\nimport { DataSourceType } from '../types/datasource.types"
},
{
"path": "src/helpers/Documentation.ts",
"chars": 16843,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport { isUndefined } from '"
},
{
"path": "src/helpers/Encryption.ts",
"chars": 2286,
"preview": "import { createHash, createHmac } from 'node:crypto'\n\nimport { Injectable } from '@nestjs/common'\nimport * as argon2 fro"
},
{
"path": "src/helpers/Logger.ts",
"chars": 2275,
"preview": "import { ConsoleLogger, Injectable, LogLevel } from '@nestjs/common'\n\nimport { APP_BOOT_CONTEXT } from '../app.constants"
},
{
"path": "src/helpers/Pagination.test.spec.ts",
"chars": 1785,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport { Test } from '@"
},
{
"path": "src/helpers/Pagination.ts",
"chars": 1908,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\n\nimport { FindManyQueryParams"
},
{
"path": "src/helpers/Query.ts",
"chars": 24095,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\n\nimport { Airtable } from '.."
},
{
"path": "src/helpers/Response.ts",
"chars": 254,
"preview": "import { Injectable } from '@nestjs/common'\nimport * as escape from 'escape-html'\n\n@Injectable()\nexport class Response {"
},
{
"path": "src/helpers/Roles.ts",
"chars": 9185,
"preview": "import { CACHE_MANAGER } from '@nestjs/cache-manager'\nimport { Inject, Injectable } from '@nestjs/common'\nimport { Confi"
},
{
"path": "src/helpers/Schema.ts",
"chars": 21426,
"preview": "import { CACHE_MANAGER } from '@nestjs/cache-manager'\nimport { Inject, Injectable } from '@nestjs/common'\nimport { Confi"
},
{
"path": "src/helpers/Webhook.ts",
"chars": 7144,
"preview": "import { CACHE_MANAGER } from '@nestjs/cache-manager'\nimport { Inject, Injectable } from '@nestjs/common'\nimport { Confi"
},
{
"path": "src/main.ts",
"chars": 1322,
"preview": "import 'dotenv/config'\nimport 'reflect-metadata'\n\nimport { ValidationPipe } from '@nestjs/common'\nimport { NestFactory }"
},
{
"path": "src/middleware/HostCheck.ts",
"chars": 1858,
"preview": "import { Injectable, NestMiddleware } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport { Next"
},
{
"path": "src/middleware/Robots.ts",
"chars": 323,
"preview": "import { Injectable, NestMiddleware } from '@nestjs/common'\nimport { NextFunction, Request, Response } from 'express'\n\n@"
},
{
"path": "src/middleware/request-path-logger.middleware.ts",
"chars": 1385,
"preview": "import { Injectable, NestMiddleware } from '@nestjs/common'\nimport { NextFunction, Request, Response } from 'express'\n\ni"
},
{
"path": "src/modules/cache/dataCache.constants.ts",
"chars": 47,
"preview": "export const REDIS_CACHE_TOKEN = 'REDIS_CACHE'\n"
},
{
"path": "src/modules/cache/dataCache.service.ts",
"chars": 10401,
"preview": "import { CACHE_MANAGER } from '@nestjs/cache-manager'\nimport { Inject, Injectable, OnApplicationShutdown } from '@nestjs"
},
{
"path": "src/modules/websocket/redis-mock-with-pub-sub.ts",
"chars": 702,
"preview": "import { Logger } from '../../helpers/Logger'\n\nexport class RedisMockWithPubSub {\n\tprivate callbacks = []\n\tlogger = new "
},
{
"path": "src/modules/websocket/websocket.constants.ts",
"chars": 277,
"preview": "export const REDIS_PUB_CLIENT_TOKEN = 'REDIS_PUB_CLIENT'\nexport const REDIS_SUB_CLIENT_TOKEN = 'REDIS_SUB_CLIENT'\nexport"
},
{
"path": "src/modules/websocket/websocket.gateway.spec.ts",
"chars": 13357,
"preview": "import { INestApplication } from '@nestjs/common'\nimport { Test, TestingModule } from '@nestjs/testing'\nimport * as json"
},
{
"path": "src/modules/websocket/websocket.gateway.ts",
"chars": 5411,
"preview": "import { Inject, OnApplicationShutdown } from '@nestjs/common'\nimport {\n\tOnGatewayConnection,\n\tOnGatewayDisconnect,\n\tOnG"
},
{
"path": "src/modules/websocket/websocket.jwt-auth.middleware.test.spec.ts",
"chars": 5229,
"preview": "import { Test } from '@nestjs/testing'\nimport { Authentication } from '../../helpers/Authentication'\nimport { HostCheckM"
},
{
"path": "src/modules/websocket/websocket.jwt-auth.middleware.ts",
"chars": 2565,
"preview": "import { Socket } from 'socket.io'\nimport { Authentication } from 'src/helpers/Authentication'\nimport { HostCheckMiddlew"
},
{
"path": "src/modules/websocket/websocket.service.ts",
"chars": 1267,
"preview": "import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'\nimport Redis from 'ioredis'\nimport { DataSour"
},
{
"path": "src/modules/welcome/welcome.controller.ts",
"chars": 192,
"preview": "import { Controller, Get, Render } from '@nestjs/common'\n\n@Controller()\nexport class WelcomeController {\n\t@Get()\n\t@Rende"
},
{
"path": "src/modules/welcome/welcome.module.ts",
"chars": 177,
"preview": "import { Module } from '@nestjs/common'\n\nimport { WelcomeController } from './welcome.controller'\n\n@Module({\n\tcontroller"
},
{
"path": "src/testing/auth.testing.service.ts",
"chars": 3758,
"preview": "import { Injectable } from '@nestjs/common'\nimport { ConfigService } from '@nestjs/config'\nimport { Auth, AuthJWT, AuthT"
},
{
"path": "src/testing/customer.testing.service.ts",
"chars": 1591,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { FindOneResponseObject } from '../dtos/response.dto'\nimport { Query"
},
{
"path": "src/testing/employee.testing.service.ts",
"chars": 2149,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { FindOneResponseObject } from '../dtos/response.dto'\nimport { Query"
},
{
"path": "src/testing/relations.testing.service.ts",
"chars": 1097,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { LLANA_RELATION_TABLE } from '../app.constants'\nimport { FindOneRes"
},
{
"path": "src/testing/salesorder.testing.service.ts",
"chars": 1737,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { FindOneResponseObject } from '../dtos/response.dto'\nimport { Query"
},
{
"path": "src/testing/shipper.testing.service.ts",
"chars": 1548,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { FindOneResponseObject } from '../dtos/response.dto'\nimport { Query"
},
{
"path": "src/testing/testing.const.ts",
"chars": 30,
"preview": "export const TIMEOUT = 120000\n"
},
{
"path": "src/testing/user.testing.service.ts",
"chars": 1392,
"preview": "import { Injectable } from '@nestjs/common'\n\nimport { FindOneResponseObject } from '../dtos/response.dto'\nimport { Query"
},
{
"path": "src/types/auth.types.ts",
"chars": 1409,
"preview": "import { Request } from 'express'\n\nimport { DataSourceWhere } from './datasource.types'\n\nexport interface Auth {\n\ttype: "
},
{
"path": "src/types/datasource.types.ts",
"chars": 4751,
"preview": "import { SortCondition } from './schema.types'\n\nexport enum DataSourceType {\n\tMYSQL = 'mysql',\n\tPOSTGRES = 'postgres',\n\t"
},
{
"path": "src/types/datasources/airtable.types.ts",
"chars": 48953,
"preview": "export enum AirtableColumnType {\n\t/**\n\t * A single line of text.\n\t *\n\t * **Cell format**\n\t * ```js\n\t * string\n\t * ```\n\t "
},
{
"path": "src/types/datasources/mssql.types.ts",
"chars": 690,
"preview": "export enum MSSQLColumnType {\n\tINT = 'int',\n\tTINYINT = 'tinyint',\n\tSMALLINT = 'smallint',\n\tBIGINT = 'bigint',\n\tFLOAT = '"
},
{
"path": "src/types/datasources/mysql.types.ts",
"chars": 686,
"preview": "export enum MySQLColumnType {\n\tINT = 'int',\n\tTINYINT = 'tinyint',\n\tSMALLINT = 'smallint',\n\tMEDIUMINT = 'mediumint',\n\tBIG"
},
{
"path": "src/types/datasources/postgres.types.ts",
"chars": 353,
"preview": "export enum PostgreSQLColumnType {\n\tINT = 'INT',\n\tDOUBLE = 'double precision',\n\tNUMERIC = 'numeric',\n\tREAL = 'real',\n\tTI"
},
{
"path": "src/types/response.types.ts",
"chars": 105,
"preview": "export enum Method {\n\tGET = 'GET',\n\tPOST = 'POST',\n\tPUT = 'PUT',\n\tPATCH = 'PATCH',\n\tDELETE = 'DELETE',\n}\n"
},
{
"path": "src/types/roles.types.ts",
"chars": 1021,
"preview": "export enum RolePermission {\n\tNONE = 'NONE',\n\tREAD = 'READ',\n\tWRITE = 'WRITE',\n\tDELETE = 'DELETE',\n}\n\nexport interface T"
},
{
"path": "src/types/schema.types.ts",
"chars": 645,
"preview": "import { DataSourceRelations, DataSourceWhere } from './datasource.types'\n\nexport interface ValidateFieldsResponse exten"
},
{
"path": "src/utils/Env.ts",
"chars": 3294,
"preview": "import * as fs from 'fs'\nimport * as os from 'os'\nimport * as path from 'path'\n\nimport { Environment, fromStringToEnv } "
},
{
"path": "src/utils/Env.types.ts",
"chars": 465,
"preview": "export enum Environment {\n\tproduction = 'production',\n\tsandbox = 'sandbox',\n\tdevelopment = 'development',\n\ttest = 'test'"
},
{
"path": "src/utils/Find.ts",
"chars": 184,
"preview": "/**\n * Find an element in an object with a . notation\n */\n\nexport function findDotNotation(obj: any, search: string): bo"
},
{
"path": "src/utils/String.ts",
"chars": 3543,
"preview": "/**\n * Replace ? symbols with the values from a any[]\n */\n\nimport { CronExpression } from '@nestjs/schedule'\n\nexport fun"
},
{
"path": "src/utils/redoc/interfaces/redoc.interface.ts",
"chars": 2937,
"preview": "export interface RedocOptions {\n\t/** Location of the OpenApi json file */\n\tdocUrl: string\n\t/** Web site title (e.g: ReDo"
},
{
"path": "src/utils/redoc/redoc.ts",
"chars": 1032,
"preview": "import * as handlebars from 'express-handlebars'\nimport { join } from 'path'\n\nimport { RedocOptions } from './interfaces"
},
{
"path": "src/utils/redoc/views/redoc.handlebars",
"chars": 1467,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n <title>{{ data.title }}</title>\n <meta charset=\"utf-8\" />\n {{#if data.favicon}}\n <lin"
},
{
"path": "tsconfig.build.json",
"chars": 98,
"preview": "{\n \"extends\": \"./tsconfig.json\",\n \"exclude\": [\"node_modules\", \"dist\", \"test\", \"**/*spec.ts\"],\n}\n"
},
{
"path": "tsconfig.json",
"chars": 499,
"preview": "{\n \"compilerOptions\": {\n \"module\": \"commonjs\",\n \"declaration\": true,\n \"removeComments\": true,\n \"emitDecorat"
},
{
"path": "views/welcome.hbs",
"chars": 7916,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\" />\n <title>Welcome :: Llana</title>\n <script src=\"https:"
}
]
About this extraction
This page contains the full source code of the juicyllama/llana GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 127 files (757.7 KB), approximately 217.6k tokens, and a symbol index with 543 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.