Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sandbox): added example for user tenant service #2024

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 43 additions & 42 deletions packages/core/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
{
"Bearer realm=\"Users\"": "Bearer realm=\"Users\"",
"Not Found": "Not Found",
"EntityNotFound": "EntityNotFound",
"WorkflowVersionNotFound": "WorkflowVersionNotFound",
"[{\"instancePath\"": "\"/valueB\",\"schemaPath\":\"#/properties/valueB/type\",\"keyword\":\"type\",\"params\":{\"type\":\"string\"},\"message\":\"must be string\"}]",
"WorkflowNotFound": "WorkflowNotFound",
"The request body is invalid. See error object `details` property for more info.": "The request body is invalid. See error object `details` property for more info.",
"Client Invalid": "Client Invalid",
"Token Invalid": "Token Invalid",
"PasswordCannotBeChangedForExternalUser": "PasswordCannotBeChangedForExternalUser",
"Required parameter token is missing!": "Required parameter token is missing!",
"Password cannot be same as previous password!": "Password cannot be same as previous password!",
"Token Expired": "Token Expired",
"Invalid Credentials": "Invalid Credentials",
"NotAllowedAccess": "NotAllowedAccess",
"ReceiverNotFound": "ReceiverNotFound",
"No user is found with given criteria to send notifications.": "No user is found with given criteria to send notifications.",
"Entity not found": " message_files with id \"1\"",
"Cannot set properties of undefined (setting 'modifiedBy')": "Cannot set properties of undefined (setting 'modifiedBy')",
"Start Date Can Not Greater Then End Date": "Start Date Can Not Greater Then End Date",
"Primary Calendar Not Exist": "Primary Calendar Not Exist",
"Calendar Not Exist": "Calendar Not Exist",
"Subscription Not exist": "Subscription Not exist",
"Duplicate DayOfWeek": "Duplicate DayOfWeek",
"Id in Request Body not matching with Query Parameters": "Id in Request Body not matching with Query Parameters",
"Event Not Exist": "Event Not Exist",
"could not update the task": "could not update the task",
"Invalid API key or secret": "Invalid API key or secret",
"Action prohibited.": "Action prohibited.",
"Bad Request": "Bad Request",
"Display Order is missing in the request": "Display Order is missing in the request",
"Invalid survey Id": "Invalid survey Id",
"Entity not found.": "Entity not found.",
"Survey Id in path and body does not match": "Survey Id in path and body does not match",
"Responder Already Added": "Responder Already Added",
"Survey can not be deleted in this status": "Survey can not be deleted in this status",
"Survey start date should be current date only and status should be active": "Survey start date should be current date only and status should be active",
"End date can not be less than start date": "End date can not be less than start date",
"Survey can not be activated without a start date": "Survey can not be activated without a start date",
"Invalid value entered in name": "Invalid value entered in name",
"API not found !": "API not found !"
}
"Bearer realm=\"Users\"": "Bearer realm=\"Users\"",
"Not Found": "Not Found",
"EntityNotFound": "EntityNotFound",
"WorkflowVersionNotFound": "WorkflowVersionNotFound",
"[{\"instancePath\"": "\"/valueB\",\"schemaPath\":\"#/properties/valueB/type\",\"keyword\":\"type\",\"params\":{\"type\":\"string\"},\"message\":\"must be string\"}]",
"WorkflowNotFound": "WorkflowNotFound",
"The request body is invalid. See error object `details` property for more info.": "The request body is invalid. See error object `details` property for more info.",
"Client Invalid": "Client Invalid",
"Token Invalid": "Token Invalid",
"PasswordCannotBeChangedForExternalUser": "PasswordCannotBeChangedForExternalUser",
"Required parameter token is missing!": "Required parameter token is missing!",
"Password cannot be same as previous password!": "Password cannot be same as previous password!",
"Token Expired": "Token Expired",
"Invalid Credentials": "Invalid Credentials",
"NotAllowedAccess": "NotAllowedAccess",
"ReceiverNotFound": "ReceiverNotFound",
"No user is found with given criteria to send notifications.": "No user is found with given criteria to send notifications.",
"Entity not found": " message_files with id \"1\"",
"Cannot set properties of undefined (setting 'modifiedBy')": "Cannot set properties of undefined (setting 'modifiedBy')",
"Start Date Can Not Greater Then End Date": "Start Date Can Not Greater Then End Date",
"Primary Calendar Not Exist": "Primary Calendar Not Exist",
"Calendar Not Exist": "Calendar Not Exist",
"Subscription Not exist": "Subscription Not exist",
"Duplicate DayOfWeek": "Duplicate DayOfWeek",
"Id in Request Body not matching with Query Parameters": "Id in Request Body not matching with Query Parameters",
"Event Not Exist": "Event Not Exist",
"could not update the task": "could not update the task",
"Invalid API key or secret": "Invalid API key or secret",
"Action prohibited.": "Action prohibited.",
"Bad Request": "Bad Request",
"Display Order is missing in the request": "Display Order is missing in the request",
"Invalid survey Id": "Invalid survey Id",
"Entity not found.": "Entity not found.",
"Survey Id in path and body does not match": "Survey Id in path and body does not match",
"Responder Already Added": "Responder Already Added",
"Survey can not be deleted in this status": "Survey can not be deleted in this status",
"Survey start date should be current date only and status should be active": "Survey start date should be current date only and status should be active",
"End date can not be less than start date": "End date can not be less than start date",
"Survey can not be activated without a start date": "Survey can not be activated without a start date",
"Invalid value entered in name": "Invalid value entered in name",
"API not found !": "API not found !",
"User Task not found": "User Task not found"
}
5 changes: 5 additions & 0 deletions sandbox/user-tenant-example/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
npm-debug.log
/dist
# Cache used by TypeScript's incremental build
*.tsbuildinfo
17 changes: 17 additions & 0 deletions sandbox/user-tenant-example/.env.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PORT=
NODE_ENV=production
LOG_LEVEL=info

DB_HOST=
DB_PORT=
DB_USER=
DB_PASSWORD=
DB_DATABASE=
DB_SCHEMA=
REDIS_HOST=
REDIS_PORT=
REDIS_URL=
REDIS_PASSWORD=
REDIS_DATABASE=
JWT_SECRET=
JWT_ISSUER=
17 changes: 17 additions & 0 deletions sandbox/user-tenant-example/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PORT=
NODE_ENV=
LOG_LEVEL=

DB_HOST=
DB_PORT=
DB_USER=
DB_PASSWORD=
DB_DATABASE=
DB_SCHEMA=
REDIS_HOST=
REDIS_PORT=
REDIS_URL=
REDIS_PASSWORD=
REDIS_DATABASE=
JWT_SECRET=
JWT_ISSUER=
4 changes: 4 additions & 0 deletions sandbox/user-tenant-example/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
coverage/
.eslintrc.js
12 changes: 12 additions & 0 deletions sandbox/user-tenant-example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
extends: '@loopback/eslint-config',
rules: {
'no-extra-boolean-cast': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'no-prototype-builtins': 'off',
},
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
64 changes: 64 additions & 0 deletions sandbox/user-tenant-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# Transpiled JavaScript files from Typescript
/dist

# Cache used by TypeScript's incremental build
*.tsbuildinfo
5 changes: 5 additions & 0 deletions sandbox/user-tenant-example/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exit": true,
"recursive": true,
"require": "source-map-support/register"
}
5 changes: 5 additions & 0 deletions sandbox/user-tenant-example/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"reporter": ["html", "text-summary"]
}
3 changes: 3 additions & 0 deletions sandbox/user-tenant-example/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
*.json
coverage
7 changes: 7 additions & 0 deletions sandbox/user-tenant-example/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all",
"arrowParens": "avoid"
}
38 changes: 38 additions & 0 deletions sandbox/user-tenant-example/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/dist/index.js",
},
{
"type": "node",
"request": "launch",
"name": "Run Mocha tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"runtimeArgs": [
"-r",
"${workspaceRoot}/node_modules/source-map-support/register"
],
"cwd": "${workspaceRoot}",
"autoAttachChildProcesses": true,
"args": [
"--config",
"${workspaceRoot}/.mocharc.json",
"${workspaceRoot}/dist/__tests__/**/*.js",
"-t",
"0"
]
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 5858
}
]
}
32 changes: 32 additions & 0 deletions sandbox/user-tenant-example/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"editor.rulers": [80],
"editor.tabCompletion": "on",
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll.eslint": true
},

"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/CVS": true,
"dist": true,
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"typescript.preferences.quoteStyle": "single",
"eslint.run": "onSave",
"eslint.nodePath": "./node_modules",
"eslint.validate": [
"javascript",
"typescript"
]
}
29 changes: 29 additions & 0 deletions sandbox/user-tenant-example/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Watch and Compile Project",
"type": "shell",
"command": "npm",
"args": ["--silent", "run", "build:watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc-watch"
},
{
"label": "Build, Test and Lint",
"type": "shell",
"command": "npm",
"args": ["--silent", "run", "test:dev"],
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": ["$tsc", "$eslint-compact", "$eslint-stylish"]
}
]
}
6 changes: 6 additions & 0 deletions sandbox/user-tenant-example/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@sourceloop/cli": {
"packageManager": "npm",
"version": "5.2.4"
}
}
36 changes: 36 additions & 0 deletions sandbox/user-tenant-example/DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Developer's Guide

We use Visual Studio Code for developing LoopBack and recommend the same to our
users.

## VSCode setup

Install the following extensions:

- [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- [prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)

## Development workflow

### Visual Studio Code

1. Start the build task (Cmd+Shift+B) to run TypeScript compiler in the
background, watching and recompiling files as you change them. Compilation
errors will be shown in the VSCode's "PROBLEMS" window.

2. Execute "Run Rest Task" from the Command Palette (Cmd+Shift+P) to re-run the
test suite and lint the code for both programming and style errors. Linting
errors will be shown in VSCode's "PROBLEMS" window. Failed tests are printed
to terminal output only.

### Other editors/IDEs

1. Open a new terminal window/tab and start the continuous build process via
`npm run build:watch`. It will run TypeScript compiler in watch mode,
recompiling files as you change them. Any compilation errors will be printed
to the terminal.

2. In your main terminal window/tab, run `npm run test:dev` to re-run the test
suite and lint the code for both programming and style errors. You should run
this command manually whenever you have new changes to test. Test failures
and linter errors will be printed to the terminal.
Loading
Loading