Initial commit
This commit is contained in:
commit
20a3893375
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
node_modules
|
||||
npm-debug.log
|
||||
/dist
|
||||
|
3
.eslintignore
Normal file
3
.eslintignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
dist/
|
||||
coverage/
|
3
.eslintrc.js
Normal file
3
.eslintrc.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
extends: '@loopback/eslint-config',
|
||||
};
|
64
.gitignore
vendored
Normal file
64
.gitignore
vendored
Normal file
|
@ -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
|
4
.mocharc.json
Normal file
4
.mocharc.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"recursive": true,
|
||||
"require": "source-map-support/register"
|
||||
}
|
2
.prettierignore
Normal file
2
.prettierignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
dist
|
||||
*.json
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"bracketSpacing": false,
|
||||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"trailingComma": "all"
|
||||
}
|
18
.vscode/launch.json
vendored
Normal file
18
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/index.js",
|
||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
30
.vscode/settings.json
vendored
Normal file
30
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"editor.rulers": [80],
|
||||
"editor.tabCompletion": "on",
|
||||
"editor.tabSize": 2,
|
||||
"editor.trimAutoWhitespace": true,
|
||||
"editor.formatOnSave": 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",
|
||||
"eslint.autoFixOnSave": true,
|
||||
"eslint.run": "onSave",
|
||||
"eslint.nodePath": "./node_modules",
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
{
|
||||
"language": "typescript",
|
||||
"autoFix": true
|
||||
}
|
||||
]
|
||||
}
|
29
.vscode/tasks.json
vendored
Normal file
29
.vscode/tasks.json
vendored
Normal file
|
@ -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"]
|
||||
}
|
||||
]
|
||||
}
|
1
.yo-rc.json
Normal file
1
.yo-rc.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
36
DEVELOPING.md
Normal file
36
DEVELOPING.md
Normal file
|
@ -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 continous 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.
|
28
Dockerfile
Normal file
28
Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Check out https://hub.docker.com/_/node to select a new base image
|
||||
FROM node:10-slim
|
||||
|
||||
# Set to a non-root built-in user `node`
|
||||
USER node
|
||||
|
||||
# Create app directory (with user `node`)
|
||||
RUN mkdir -p /home/node/app
|
||||
|
||||
WORKDIR /home/node/app
|
||||
|
||||
# Install app dependencies
|
||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||
# where available (npm@5+)
|
||||
COPY --chown=node package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
# Bundle app source code
|
||||
COPY --chown=node . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Bind to all network interfaces so that it can be mapped to the host OS
|
||||
ENV HOST=0.0.0.0 PORT=3000
|
||||
|
||||
EXPOSE ${PORT}
|
||||
CMD [ "node", "." ]
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# exo-api
|
||||
|
||||
[![LoopBack](https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png)](http://loopback.io/)
|
21
index.js
Normal file
21
index.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const application = require('./dist');
|
||||
|
||||
module.exports = application;
|
||||
|
||||
if (require.main === module) {
|
||||
// Run the application
|
||||
const config = {
|
||||
rest: {
|
||||
port: +(process.env.PORT || 3000),
|
||||
host: process.env.HOST,
|
||||
openApiSpec: {
|
||||
// useful when used with OASGraph to locate your application
|
||||
setServersFromRequest: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
application.main(config).catch(err => {
|
||||
console.error('Cannot start the application.', err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
4749
package-lock.json
generated
Normal file
4749
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
72
package.json
Normal file
72
package.json
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"name": "exo-api",
|
||||
"version": "1.0.0",
|
||||
"description": "API Rest for eXO (associacio expansio xarxa oberta) an associative ISP",
|
||||
"keywords": [
|
||||
"loopback-application",
|
||||
"loopback"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8.9"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "lb-tsc",
|
||||
"build:watch": "lb-tsc --watch",
|
||||
"clean": "lb-clean dist *.tsbuildinfo",
|
||||
"lint": "npm run prettier:check && npm run eslint",
|
||||
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
|
||||
"prettier:cli": "lb-prettier \"**/*.ts\" \"**/*.js\"",
|
||||
"prettier:check": "npm run prettier:cli -- -l",
|
||||
"prettier:fix": "npm run prettier:cli -- --write",
|
||||
"eslint": "lb-eslint --report-unused-disable-directives .",
|
||||
"eslint:fix": "npm run eslint -- --fix",
|
||||
"pretest": "npm run clean && npm run build",
|
||||
"test": "lb-mocha --allow-console-logs \"dist/__tests__\"",
|
||||
"posttest": "npm run lint",
|
||||
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
|
||||
"docker:build": "docker build -t exo-api .",
|
||||
"docker:run": "docker run -p 3000:3000 -d exo-api",
|
||||
"migrate": "node ./dist/migrate",
|
||||
"prestart": "npm run build",
|
||||
"start": "node .",
|
||||
"prepublishOnly": "npm run test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "",
|
||||
"files": [
|
||||
"README.md",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"dist",
|
||||
"src",
|
||||
"!*/__tests__"
|
||||
],
|
||||
"dependencies": {
|
||||
"@loopback/boot": "^1.4.3",
|
||||
"@loopback/context": "^1.20.1",
|
||||
"@loopback/core": "^1.8.4",
|
||||
"@loopback/openapi-v3": "^1.6.4",
|
||||
"@loopback/repository": "^1.8.1",
|
||||
"@loopback/rest": "^1.16.2",
|
||||
"@loopback/rest-explorer": "^1.2.4",
|
||||
"@loopback/service-proxy": "^1.2.4",
|
||||
"loopback-connector-mysql": "^5.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@loopback/build": "^2.0.2",
|
||||
"@loopback/testlab": "^1.6.2",
|
||||
"@types/node": "^10.14.9",
|
||||
"@typescript-eslint/parser": "^1.10.2",
|
||||
"@typescript-eslint/eslint-plugin": "^1.10.2",
|
||||
"@loopback/eslint-config": "^1.1.2",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-prettier": "^5.0.0",
|
||||
"eslint-plugin-eslint-plugin": "^2.1.0",
|
||||
"eslint-plugin-mocha": "^5.3.0",
|
||||
"typescript": "~3.5.2"
|
||||
}
|
||||
}
|
73
public/index.html
Normal file
73
public/index.html
Normal file
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>API Rest for eXO (associacio expansio xarxa oberta) an associative ISP</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="//v4.loopback.io/favicon.ico">
|
||||
|
||||
<style>
|
||||
h3 {
|
||||
margin-left: 25px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
color: #3f5dff;
|
||||
}
|
||||
|
||||
h3 a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
a:hover, a:focus, a:active {
|
||||
color: #001956;
|
||||
}
|
||||
|
||||
.power {
|
||||
position: absolute;
|
||||
bottom: 25px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.info {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%)
|
||||
}
|
||||
|
||||
.info h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.info p {
|
||||
text-align: center;
|
||||
margin-bottom: 3em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="info">
|
||||
<h1>exo-api</h1>
|
||||
<p>Version 1.0.0</p>
|
||||
|
||||
<h3>OpenAPI spec: <a href="/openapi.json">/openapi.json</a></h3>
|
||||
<h3>API Explorer: <a href="/explorer">/explorer</a></h3>
|
||||
</div>
|
||||
|
||||
<footer class="power">
|
||||
<a href="https://v4.loopback.io" target="_blank">
|
||||
<img src="https://loopback.io/images/branding/powered-by-loopback/blue/powered-by-loopback-sm.png" />
|
||||
</a>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
3
src/__tests__/README.md
Normal file
3
src/__tests__/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Tests
|
||||
|
||||
Please place your tests in this folder.
|
31
src/__tests__/acceptance/home-page.acceptance.ts
Normal file
31
src/__tests__/acceptance/home-page.acceptance.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import {Client} from '@loopback/testlab';
|
||||
import {ExoApiApplication} from '../..';
|
||||
import {setupApplication} from './test-helper';
|
||||
|
||||
describe('HomePage', () => {
|
||||
let app: ExoApiApplication;
|
||||
let client: Client;
|
||||
|
||||
before('setupApplication', async () => {
|
||||
({app, client} = await setupApplication());
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await app.stop();
|
||||
});
|
||||
|
||||
it('exposes a default home page', async () => {
|
||||
await client
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /text\/html/);
|
||||
});
|
||||
|
||||
it('exposes self-hosted explorer', async () => {
|
||||
await client
|
||||
.get('/explorer/')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /text\/html/)
|
||||
.expect(/<title>LoopBack API Explorer/);
|
||||
});
|
||||
});
|
21
src/__tests__/acceptance/ping.controller.acceptance.ts
Normal file
21
src/__tests__/acceptance/ping.controller.acceptance.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import {Client, expect} from '@loopback/testlab';
|
||||
import {ExoApiApplication} from '../..';
|
||||
import {setupApplication} from './test-helper';
|
||||
|
||||
describe('PingController', () => {
|
||||
let app: ExoApiApplication;
|
||||
let client: Client;
|
||||
|
||||
before('setupApplication', async () => {
|
||||
({app, client} = await setupApplication());
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await app.stop();
|
||||
});
|
||||
|
||||
it('invokes GET /ping', async () => {
|
||||
const res = await client.get('/ping?msg=world').expect(200);
|
||||
expect(res.body).to.containEql({greeting: 'Hello from LoopBack'});
|
||||
});
|
||||
});
|
32
src/__tests__/acceptance/test-helper.ts
Normal file
32
src/__tests__/acceptance/test-helper.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import {ExoApiApplication} from '../..';
|
||||
import {
|
||||
createRestAppClient,
|
||||
givenHttpServerConfig,
|
||||
Client,
|
||||
} from '@loopback/testlab';
|
||||
|
||||
export async function setupApplication(): Promise<AppWithClient> {
|
||||
const restConfig = givenHttpServerConfig({
|
||||
// Customize the server configuration here.
|
||||
// Empty values (undefined, '') will be ignored by the helper.
|
||||
//
|
||||
// host: process.env.HOST,
|
||||
// port: +process.env.PORT,
|
||||
});
|
||||
|
||||
const app = new ExoApiApplication({
|
||||
rest: restConfig,
|
||||
});
|
||||
|
||||
await app.boot();
|
||||
await app.start();
|
||||
|
||||
const client = createRestAppClient(app);
|
||||
|
||||
return {app, client};
|
||||
}
|
||||
|
||||
export interface AppWithClient {
|
||||
app: ExoApiApplication;
|
||||
client: Client;
|
||||
}
|
42
src/application.ts
Normal file
42
src/application.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import {BootMixin} from '@loopback/boot';
|
||||
import {ApplicationConfig} from '@loopback/core';
|
||||
import {
|
||||
RestExplorerBindings,
|
||||
RestExplorerComponent,
|
||||
} from '@loopback/rest-explorer';
|
||||
import {RepositoryMixin} from '@loopback/repository';
|
||||
import {RestApplication} from '@loopback/rest';
|
||||
import {ServiceMixin} from '@loopback/service-proxy';
|
||||
import * as path from 'path';
|
||||
import {MySequence} from './sequence';
|
||||
|
||||
export class ExoApiApplication extends BootMixin(
|
||||
ServiceMixin(RepositoryMixin(RestApplication)),
|
||||
) {
|
||||
constructor(options: ApplicationConfig = {}) {
|
||||
super(options);
|
||||
|
||||
// Set up the custom sequence
|
||||
this.sequence(MySequence);
|
||||
|
||||
// Set up default home page
|
||||
this.static('/', path.join(__dirname, '../public'));
|
||||
|
||||
// Customize @loopback/rest-explorer configuration here
|
||||
this.bind(RestExplorerBindings.CONFIG).to({
|
||||
path: '/explorer',
|
||||
});
|
||||
this.component(RestExplorerComponent);
|
||||
|
||||
this.projectRoot = __dirname;
|
||||
// Customize @loopback/boot Booter Conventions here
|
||||
this.bootOptions = {
|
||||
controllers: {
|
||||
// Customize ControllerBooter Conventions here
|
||||
dirs: ['controllers'],
|
||||
extensions: ['.controller.js'],
|
||||
nested: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
9
src/controllers/README.md
Normal file
9
src/controllers/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Controllers
|
||||
|
||||
This directory contains source files for the controllers exported by this app.
|
||||
|
||||
To add a new empty controller, type in `lb4 controller [<name>]` from the
|
||||
command-line of your application's root directory.
|
||||
|
||||
For more information, please visit
|
||||
[Controller generator](http://loopback.io/doc/en/lb4/Controller-generator.html).
|
2
src/controllers/index.ts
Normal file
2
src/controllers/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export * from './ping.controller';
|
||||
export * from './radius.controller';
|
51
src/controllers/ping.controller.ts
Normal file
51
src/controllers/ping.controller.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
import {Request, RestBindings, get, ResponseObject} from '@loopback/rest';
|
||||
import {inject} from '@loopback/context';
|
||||
|
||||
/**
|
||||
* OpenAPI response for ping()
|
||||
*/
|
||||
const PING_RESPONSE: ResponseObject = {
|
||||
description: 'Ping Response',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
greeting: {type: 'string'},
|
||||
date: {type: 'string'},
|
||||
url: {type: 'string'},
|
||||
headers: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
'Content-Type': {type: 'string'},
|
||||
},
|
||||
additionalProperties: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* A simple controller to bounce back http requests
|
||||
*/
|
||||
export class PingController {
|
||||
constructor(@inject(RestBindings.Http.REQUEST) private req: Request) {}
|
||||
|
||||
// Map to `GET /ping`
|
||||
@get('/ping', {
|
||||
responses: {
|
||||
'200': PING_RESPONSE,
|
||||
},
|
||||
})
|
||||
ping(): object {
|
||||
// Reply with a greeting, the current time, the url, and request headers
|
||||
return {
|
||||
greeting: 'Hello from LoopBack',
|
||||
date: new Date(),
|
||||
url: this.req.url,
|
||||
headers: Object.assign({}, this.req.headers),
|
||||
};
|
||||
}
|
||||
}
|
101
src/controllers/radius.controller.ts
Normal file
101
src/controllers/radius.controller.ts
Normal file
|
@ -0,0 +1,101 @@
|
|||
import { post, get, param, requestBody } from "@loopback/rest";
|
||||
// Uncomment these imports to begin using these cool features!
|
||||
|
||||
import { inject } from '@loopback/context';
|
||||
import { RadreplyRepository, SubscriptionIdsRepository, UserinfoRepository, RadcheckRepository, RadusergroupRepository } from "../repositories";
|
||||
import { SubscriptionIds, Userinfo, Radcheck, Radusergroup, Radreply } from "../models";
|
||||
|
||||
// TODO move to declarations class or similar
|
||||
export interface BatchUser {
|
||||
name: string;
|
||||
password: string;
|
||||
['remote-address']: string;
|
||||
}
|
||||
|
||||
export interface BatchBody {
|
||||
data: Array<BatchUser>;
|
||||
}
|
||||
|
||||
export class RadiusController {
|
||||
constructor(
|
||||
@inject('repositories.RadreplyRepository')
|
||||
public radReplyRepository: RadreplyRepository,
|
||||
@inject('repositories.SubscriptionIdsRepository')
|
||||
public subscriptionIdsRepository: SubscriptionIdsRepository,
|
||||
@inject('repositories.UserinfoRepository')
|
||||
public userinfoRepository: UserinfoRepository,
|
||||
@inject('repositories.RadcheckRepository')
|
||||
public radcheckRepository: RadcheckRepository,
|
||||
@inject('repositories.RadusergroupRepository')
|
||||
public radusergroupRepository: RadusergroupRepository, ) { }
|
||||
|
||||
@post('/radius/batch')
|
||||
async subscriptionAddBatch(@requestBody() body: BatchBody) {
|
||||
console.log('Users:', body);
|
||||
body.data.forEach(async (item) => {
|
||||
// 1: look for an available subscriptionid
|
||||
const id = await this.subscriptionIdsRepository.find(
|
||||
{ where: { isAvailable: true }, limit: 1, order: ['id ASC'] });
|
||||
|
||||
// 2: Add user to Userinfo repo
|
||||
const userInfo = new Userinfo();
|
||||
userInfo.username = item.name;
|
||||
userInfo.creationby = 'administrator'; // TODO: Remove hardcoded
|
||||
userInfo.creationdate = new Date();
|
||||
userInfo.updatedate = new Date();
|
||||
|
||||
// Wait for user creation
|
||||
await this.userinfoRepository.create(userInfo);
|
||||
|
||||
// 3: Add user password
|
||||
const userRadCheck = new Radcheck();
|
||||
userRadCheck.username = item.name;
|
||||
userRadCheck.op = ':=';
|
||||
userRadCheck.attribute = 'Cleartext-Password'
|
||||
userRadCheck.value = item.password;
|
||||
|
||||
await this.radcheckRepository.create(userRadCheck);
|
||||
|
||||
// 4: Add user to group
|
||||
const userRadGroup = new Radusergroup();
|
||||
userRadGroup.username = item.name;
|
||||
userRadGroup.groupname = 'PPP-Standard';
|
||||
userRadGroup.priority = 1;
|
||||
|
||||
await this.radusergroupRepository.create(userRadGroup);
|
||||
|
||||
// 5: Add IPs to subscription & nas-id
|
||||
const userReplyIpv4 = new Radreply();
|
||||
userReplyIpv4.username = item.name;
|
||||
userReplyIpv4.op = ':=';
|
||||
userReplyIpv4.attribute = 'Framed-IP-Address';
|
||||
userReplyIpv4.value = item['remote-address'];
|
||||
|
||||
await this.radReplyRepository.create(userReplyIpv4);
|
||||
|
||||
const userReplyNas = new Radreply();
|
||||
userReplyNas.username = item.name;
|
||||
userReplyNas.op = ':=';
|
||||
userReplyNas.attribute = 'NAS-Port-Id';
|
||||
userReplyNas.value = `i${id[0].id}c0`;
|
||||
|
||||
await this.radReplyRepository.create(userReplyNas);
|
||||
|
||||
});
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@get('/radius/test')
|
||||
async test() {
|
||||
// TODO put in another endpoint
|
||||
const subs = [];
|
||||
for (let i = 10; i <= 8999; ++i) {
|
||||
const item = new SubscriptionIds();
|
||||
item.id = i;
|
||||
item.isAvailable = true;
|
||||
subs.push(item);
|
||||
}
|
||||
return await this.subscriptionIdsRepository.createAll(subs);
|
||||
}
|
||||
}
|
3
src/datasources/README.md
Normal file
3
src/datasources/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Datasources
|
||||
|
||||
This directory contains config for datasources used by this app.
|
1
src/datasources/index.ts
Normal file
1
src/datasources/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './radius.datasource';
|
9
src/datasources/radius.datasource.json
Normal file
9
src/datasources/radius.datasource.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "radius",
|
||||
"connector": "mysql",
|
||||
"host": "localhost",
|
||||
"port": 3306,
|
||||
"user": "radius",
|
||||
"password": "radius",
|
||||
"database": "radius"
|
||||
}
|
14
src/datasources/radius.datasource.ts
Normal file
14
src/datasources/radius.datasource.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import {inject} from '@loopback/core';
|
||||
import {juggler} from '@loopback/repository';
|
||||
import * as config from './radius.datasource.json';
|
||||
|
||||
export class RadiusDataSource extends juggler.DataSource {
|
||||
static dataSourceName = 'radius';
|
||||
|
||||
constructor(
|
||||
@inject('datasources.config.radius', {optional: true})
|
||||
dsConfig: object = config,
|
||||
) {
|
||||
super(dsConfig);
|
||||
}
|
||||
}
|
16
src/index.ts
Normal file
16
src/index.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {ExoApiApplication} from './application';
|
||||
import {ApplicationConfig} from '@loopback/core';
|
||||
|
||||
export {ExoApiApplication};
|
||||
|
||||
export async function main(options: ApplicationConfig = {}) {
|
||||
const app = new ExoApiApplication(options);
|
||||
await app.boot();
|
||||
await app.start();
|
||||
|
||||
const url = app.restServer.url;
|
||||
console.log(`Server is running at ${url}`);
|
||||
console.log(`Try ${url}/ping`);
|
||||
|
||||
return app;
|
||||
}
|
21
src/migrate.ts
Normal file
21
src/migrate.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { ExoApiApplication } from './application';
|
||||
|
||||
export async function migrate(args: string[]) {
|
||||
const existingSchema = args.includes('--rebuild') ? 'drop' : 'alter';
|
||||
console.log('Migrating schemas (%s existing schema)', existingSchema);
|
||||
|
||||
const app = new ExoApiApplication();
|
||||
await app.boot();
|
||||
// We only add custom eXO models
|
||||
await app.migrateSchema({ existingSchema, models: ['SubscriptionIds'] });
|
||||
|
||||
// Connectors usually keep a pool of opened connections,
|
||||
// this keeps the process running even after all work is done.
|
||||
// We need to exit explicitly.
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
migrate(process.argv).catch(err => {
|
||||
console.error('Cannot migrate database schema', err);
|
||||
process.exit(1);
|
||||
});
|
3
src/models/README.md
Normal file
3
src/models/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Models
|
||||
|
||||
This directory contains code for models provided by this app.
|
13
src/models/index.ts
Normal file
13
src/models/index.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export * from './realms.model';
|
||||
export * from './radusergroup.model';
|
||||
export * from './radgroupreply.model';
|
||||
export * from './radpostauth.model';
|
||||
export * from './radcheck.model';
|
||||
export * from './radreply.model';
|
||||
export * from './userinfo.model';
|
||||
export * from './operators-acl.model';
|
||||
export * from './radgroupcheck.model';
|
||||
export * from './operators-acl-files.model';
|
||||
export * from './operators.model';
|
||||
export * from './userbillinfo.model';
|
||||
export * from './subscription-ids.model';
|
56
src/models/operators-acl-files.model.ts
Normal file
56
src/models/operators-acl-files.model.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'operators_acl_files' } }
|
||||
})
|
||||
export class OperatorsAclFiles extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 128,
|
||||
mysql: { "columnName": "file", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
file: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 128,
|
||||
mysql: { "columnName": "category", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
category: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 128,
|
||||
mysql: { "columnName": "section", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
section: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<OperatorsAclFiles>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface OperatorsAclFilesRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type OperatorsAclFilesWithRelations = OperatorsAclFiles & OperatorsAclFilesRelations;
|
58
src/models/operators-acl.model.ts
Normal file
58
src/models/operators-acl.model.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'operators_acl' } }
|
||||
})
|
||||
export class OperatorsAcl extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "operator_id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
operatorId: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 128,
|
||||
mysql: { "columnName": "file", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
file: String;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: true,
|
||||
precision: 3,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "access", "dataType": "tinyint", "dataLength": null, "dataPrecision": 3, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
access: Number;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<OperatorsAcl>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface OperatorsAclRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type OperatorsAclWithRelations = OperatorsAcl & OperatorsAclRelations;
|
179
src/models/operators.model.ts
Normal file
179
src/models/operators.model.ts
Normal file
|
@ -0,0 +1,179 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({ settings: { idInjection: false, mysql: { schema: 'radius', table: 'operators' } } })
|
||||
export class Operators extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
username: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "password", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
password: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "firstname", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
firstname: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "lastname", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
lastname: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "title", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
title: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "department", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
department: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "company", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
company: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "phone1", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
phone1: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "phone2", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
phone2: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "email1", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
email1: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "email2", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
email2: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "messenger1", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
messenger1: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "messenger2", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
messenger2: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 128,
|
||||
mysql: { "columnName": "notes", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
notes: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "lastlogin", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
lastlogin?: Date;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "creationdate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationdate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "creationby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationby?: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "updatedate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updatedate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "updateby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updateby?: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Operators>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface OperatorsRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type OperatorsWithRelations = Operators & OperatorsRelations;
|
62
src/models/radcheck.model.ts
Normal file
62
src/models/radcheck.model.ts
Normal file
|
@ -0,0 +1,62 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({ settings: { idInjection: false, mysql: { schema: 'radius', table: 'radcheck' } } })
|
||||
export class Radcheck extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
username: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "attribute", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
attribute: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 2,
|
||||
mysql: { "columnName": "op", "dataType": "char", "dataLength": 2, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
op: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 253,
|
||||
mysql: { "columnName": "value", "dataType": "varchar", "dataLength": 253, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
value: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Radcheck>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RadcheckRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RadcheckWithRelations = Radcheck & RadcheckRelations;
|
64
src/models/radgroupcheck.model.ts
Normal file
64
src/models/radgroupcheck.model.ts
Normal file
|
@ -0,0 +1,64 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'radgroupcheck' } }
|
||||
})
|
||||
export class Radgroupcheck extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "groupname", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
groupname: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "attribute", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
attribute: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 2,
|
||||
mysql: { "columnName": "op", "dataType": "char", "dataLength": 2, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
op: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 253,
|
||||
mysql: { "columnName": "value", "dataType": "varchar", "dataLength": 253, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
value: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Radgroupcheck>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RadgroupcheckRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RadgroupcheckWithRelations = Radgroupcheck & RadgroupcheckRelations;
|
64
src/models/radgroupreply.model.ts
Normal file
64
src/models/radgroupreply.model.ts
Normal file
|
@ -0,0 +1,64 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'radgroupreply' } }
|
||||
})
|
||||
export class Radgroupreply extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "groupname", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
groupname: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "attribute", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
attribute: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 2,
|
||||
mysql: { "columnName": "op", "dataType": "char", "dataLength": 2, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
op: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 253,
|
||||
mysql: { "columnName": "value", "dataType": "varchar", "dataLength": 253, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
value: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Radgroupreply>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RadgroupreplyRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RadgroupreplyWithRelations = Radgroupreply & RadgroupreplyRelations;
|
63
src/models/radpostauth.model.ts
Normal file
63
src/models/radpostauth.model.ts
Normal file
|
@ -0,0 +1,63 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'radpostauth' } }
|
||||
})
|
||||
export class Radpostauth extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
username: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "pass", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
pass: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 32,
|
||||
mysql: { "columnName": "reply", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
reply: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: true,
|
||||
mysql: { "columnName": "authdate", "dataType": "timestamp", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
authdate: Date;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Radpostauth>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RadpostauthRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RadpostauthWithRelations = Radpostauth & RadpostauthRelations;
|
62
src/models/radreply.model.ts
Normal file
62
src/models/radreply.model.ts
Normal file
|
@ -0,0 +1,62 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({ settings: { idInjection: false, mysql: { schema: 'radius', table: 'radreply' } } })
|
||||
export class Radreply extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
generated: true,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
username: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "attribute", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
attribute: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 2,
|
||||
mysql: { "columnName": "op", "dataType": "char", "dataLength": 2, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
op: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 253,
|
||||
mysql: { "columnName": "value", "dataType": "varchar", "dataLength": 253, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
value: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Radreply>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RadreplyRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RadreplyWithRelations = Radreply & RadreplyRelations;
|
48
src/models/radusergroup.model.ts
Normal file
48
src/models/radusergroup.model.ts
Normal file
|
@ -0,0 +1,48 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'radusergroup' } }
|
||||
})
|
||||
export class Radusergroup extends Entity {
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
id: true,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
username: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: true,
|
||||
length: 64,
|
||||
mysql: { "columnName": "groupname", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
groupname: String;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "priority", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
priority: Number;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Radusergroup>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RadusergroupRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RadusergroupWithRelations = Radusergroup & RadusergroupRelations;
|
135
src/models/realms.model.ts
Normal file
135
src/models/realms.model.ts
Normal file
|
@ -0,0 +1,135 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({ settings: { idInjection: false, mysql: { schema: 'radius', table: 'realms' } } })
|
||||
export class Realms extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 19,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "bigint", "dataLength": null, "dataPrecision": 19, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "realmname", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
realmname?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 32,
|
||||
mysql: { "columnName": "type", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
type?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 256,
|
||||
mysql: { "columnName": "authhost", "dataType": "varchar", "dataLength": 256, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
authhost?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 256,
|
||||
mysql: { "columnName": "accthost", "dataType": "varchar", "dataLength": 256, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
accthost?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "secret", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
secret?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 64,
|
||||
mysql: { "columnName": "ldflag", "dataType": "varchar", "dataLength": 64, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
ldflag?: String;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "nostrip", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
nostrip?: Number;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "hints", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
hints?: Number;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "notrealm", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
notrealm?: Number;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "creationdate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationdate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "creationby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationby?: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "updatedate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updatedate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "updateby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updateby?: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Realms>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RealmsRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type RealmsWithRelations = Realms & RealmsRelations;
|
41
src/models/subscription-ids.model.ts
Normal file
41
src/models/subscription-ids.model.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({ settings: { idInjection: false, mysql: { schema: 'radius', table: 'subscriptionids' } } })
|
||||
export class SubscriptionIds extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: false,
|
||||
require: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: Boolean,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "isAvailable", "nullable": "N" },
|
||||
})
|
||||
isAvailable: boolean;
|
||||
|
||||
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<SubscriptionIds>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface SubscriptionIdsRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type SubscriptionIdsWithRelations = SubscriptionIds & SubscriptionIdsRelations;
|
336
src/models/userbillinfo.model.ts
Normal file
336
src/models/userbillinfo.model.ts
Normal file
|
@ -0,0 +1,336 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({
|
||||
settings: { idInjection: false, mysql: { schema: 'radius', table: 'userbillinfo' } }
|
||||
})
|
||||
export class Userbillinfo extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
username?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "planName", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
planname?: String;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "hotspot_id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
hotspotId?: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 32,
|
||||
mysql: { "columnName": "hotspotlocation", "dataType": "varchar", "dataLength": 32, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
hotspotlocation?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "contactperson", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
contactperson?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "company", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
company?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "email", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
email?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "phone", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
phone?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "address", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
address?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "city", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
city?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "state", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
state?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 100,
|
||||
mysql: { "columnName": "country", "dataType": "varchar", "dataLength": 100, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
country?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "zip", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
zip?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "paymentmethod", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
paymentmethod?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "cash", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
cash?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "creditcardname", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creditcardname?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "creditcardnumber", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creditcardnumber?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "creditcardverification", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creditcardverification?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "creditcardtype", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creditcardtype?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "creditcardexp", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creditcardexp?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "notes", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
notes?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "changeuserbillinfo", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
changeuserbillinfo?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "lead", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
lead?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "coupon", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
coupon?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "ordertaker", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
ordertaker?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "billstatus", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
billstatus?: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: true,
|
||||
mysql: { "columnName": "lastbill", "dataType": "date", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
lastbill: Date;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: true,
|
||||
mysql: { "columnName": "nextbill", "dataType": "date", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "N" },
|
||||
})
|
||||
nextbill: Date;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "nextinvoicedue", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
nextinvoicedue?: Number;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "billdue", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
billdue?: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 8,
|
||||
mysql: { "columnName": "postalinvoice", "dataType": "varchar", "dataLength": 8, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
postalinvoice?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 8,
|
||||
mysql: { "columnName": "faxinvoice", "dataType": "varchar", "dataLength": 8, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
faxinvoice?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 8,
|
||||
mysql: { "columnName": "emailinvoice", "dataType": "varchar", "dataLength": 8, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
emailinvoice?: String;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "batch_id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
batchId?: Number;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "creationdate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationdate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "creationby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationby?: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "updatedate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updatedate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "updateby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updateby?: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Userbillinfo>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserbillinfoRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type UserbillinfoWithRelations = Userbillinfo & UserbillinfoRelations;
|
205
src/models/userinfo.model.ts
Normal file
205
src/models/userinfo.model.ts
Normal file
|
@ -0,0 +1,205 @@
|
|||
import { Entity, model, property } from '@loopback/repository';
|
||||
|
||||
@model({ settings: { idInjection: false, mysql: { schema: 'radius', table: 'userinfo' } } })
|
||||
export class Userinfo extends Entity {
|
||||
@property({
|
||||
type: Number,
|
||||
generated: true,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
id: 1,
|
||||
mysql: { "columnName": "id", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "N" },
|
||||
})
|
||||
id: Number;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "username", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
username?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "firstname", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
firstname?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "lastname", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
lastname?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "email", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
email?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "department", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
department?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "company", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
company?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "workphone", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
workphone?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "homephone", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
homephone?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "mobilephone", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
mobilephone?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "address", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
address?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "city", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
city?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "state", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
state?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 100,
|
||||
mysql: { "columnName": "country", "dataType": "varchar", "dataLength": 100, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
country?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "zip", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
zip?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 200,
|
||||
mysql: { "columnName": "notes", "dataType": "varchar", "dataLength": 200, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
notes?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "changeuserinfo", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
changeuserinfo?: String;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "portalloginpassword", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
portalloginpassword?: String;
|
||||
|
||||
@property({
|
||||
type: Number,
|
||||
required: false,
|
||||
precision: 10,
|
||||
scale: 0,
|
||||
mysql: { "columnName": "enableportallogin", "dataType": "int", "dataLength": null, "dataPrecision": 10, "dataScale": 0, "nullable": "Y" },
|
||||
})
|
||||
enableportallogin?: Number;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "creationdate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationdate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "creationby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
creationby?: String;
|
||||
|
||||
@property({
|
||||
type: Date,
|
||||
required: false,
|
||||
mysql: { "columnName": "updatedate", "dataType": "datetime", "dataLength": null, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updatedate?: Date;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
required: false,
|
||||
length: 128,
|
||||
mysql: { "columnName": "updateby", "dataType": "varchar", "dataLength": 128, "dataPrecision": null, "dataScale": null, "nullable": "Y" },
|
||||
})
|
||||
updateby?: String;
|
||||
|
||||
// Define well-known properties here
|
||||
|
||||
// Indexer property to allow additional data
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[prop: string]: any;
|
||||
|
||||
constructor(data?: Partial<Userinfo>) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserinfoRelations {
|
||||
// describe navigational properties here
|
||||
}
|
||||
|
||||
export type UserinfoWithRelations = Userinfo & UserinfoRelations;
|
3
src/repositories/README.md
Normal file
3
src/repositories/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Repositories
|
||||
|
||||
This directory contains code for repositories provided by this app.
|
13
src/repositories/index.ts
Normal file
13
src/repositories/index.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export * from './operators-acl-files.repository';
|
||||
export * from './operators-acl.repository';
|
||||
export * from './operators.repository';
|
||||
export * from './radcheck.repository';
|
||||
export * from './radgroupcheck.repository';
|
||||
export * from './radgroupreply.repository';
|
||||
export * from './radpostauth.repository';
|
||||
export * from './radreply.repository';
|
||||
export * from './radusergroup.repository';
|
||||
export * from './realms.repository';
|
||||
export * from './userbillinfo.repository';
|
||||
export * from './userinfo.repository';
|
||||
export * from './subscription-ids.repository';
|
16
src/repositories/operators-acl-files.repository.ts
Normal file
16
src/repositories/operators-acl-files.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {OperatorsAclFiles, OperatorsAclFilesRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class OperatorsAclFilesRepository extends DefaultCrudRepository<
|
||||
OperatorsAclFiles,
|
||||
typeof OperatorsAclFiles.prototype.id,
|
||||
OperatorsAclFilesRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(OperatorsAclFiles, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/operators-acl.repository.ts
Normal file
16
src/repositories/operators-acl.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {OperatorsAcl, OperatorsAclRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class OperatorsAclRepository extends DefaultCrudRepository<
|
||||
OperatorsAcl,
|
||||
typeof OperatorsAcl.prototype.id,
|
||||
OperatorsAclRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(OperatorsAcl, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/operators.repository.ts
Normal file
16
src/repositories/operators.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Operators, OperatorsRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class OperatorsRepository extends DefaultCrudRepository<
|
||||
Operators,
|
||||
typeof Operators.prototype.id,
|
||||
OperatorsRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Operators, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/radcheck.repository.ts
Normal file
16
src/repositories/radcheck.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Radcheck, RadcheckRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RadcheckRepository extends DefaultCrudRepository<
|
||||
Radcheck,
|
||||
typeof Radcheck.prototype.id,
|
||||
RadcheckRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Radcheck, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/radgroupcheck.repository.ts
Normal file
16
src/repositories/radgroupcheck.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Radgroupcheck, RadgroupcheckRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RadgroupcheckRepository extends DefaultCrudRepository<
|
||||
Radgroupcheck,
|
||||
typeof Radgroupcheck.prototype.id,
|
||||
RadgroupcheckRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Radgroupcheck, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/radgroupreply.repository.ts
Normal file
16
src/repositories/radgroupreply.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Radgroupreply, RadgroupreplyRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RadgroupreplyRepository extends DefaultCrudRepository<
|
||||
Radgroupreply,
|
||||
typeof Radgroupreply.prototype.id,
|
||||
RadgroupreplyRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Radgroupreply, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/radpostauth.repository.ts
Normal file
16
src/repositories/radpostauth.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Radpostauth, RadpostauthRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RadpostauthRepository extends DefaultCrudRepository<
|
||||
Radpostauth,
|
||||
typeof Radpostauth.prototype.id,
|
||||
RadpostauthRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Radpostauth, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/radreply.repository.ts
Normal file
16
src/repositories/radreply.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Radreply, RadreplyRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RadreplyRepository extends DefaultCrudRepository<
|
||||
Radreply,
|
||||
typeof Radreply.prototype.id,
|
||||
RadreplyRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Radreply, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/radusergroup.repository.ts
Normal file
16
src/repositories/radusergroup.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Radusergroup, RadusergroupRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RadusergroupRepository extends DefaultCrudRepository<
|
||||
Radusergroup,
|
||||
typeof Radusergroup.prototype.id,
|
||||
RadusergroupRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Radusergroup, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/realms.repository.ts
Normal file
16
src/repositories/realms.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Realms, RealmsRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class RealmsRepository extends DefaultCrudRepository<
|
||||
Realms,
|
||||
typeof Realms.prototype.id,
|
||||
RealmsRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Realms, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/subscription-ids.repository.ts
Normal file
16
src/repositories/subscription-ids.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {SubscriptionIds, SubscriptionIdsRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class SubscriptionIdsRepository extends DefaultCrudRepository<
|
||||
SubscriptionIds,
|
||||
typeof SubscriptionIds.prototype.id,
|
||||
SubscriptionIdsRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(SubscriptionIds, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/userbillinfo.repository.ts
Normal file
16
src/repositories/userbillinfo.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Userbillinfo, UserbillinfoRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class UserbillinfoRepository extends DefaultCrudRepository<
|
||||
Userbillinfo,
|
||||
typeof Userbillinfo.prototype.id,
|
||||
UserbillinfoRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Userbillinfo, dataSource);
|
||||
}
|
||||
}
|
16
src/repositories/userinfo.repository.ts
Normal file
16
src/repositories/userinfo.repository.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {DefaultCrudRepository} from '@loopback/repository';
|
||||
import {Userinfo, UserinfoRelations} from '../models';
|
||||
import {RadiusDataSource} from '../datasources';
|
||||
import {inject} from '@loopback/core';
|
||||
|
||||
export class UserinfoRepository extends DefaultCrudRepository<
|
||||
Userinfo,
|
||||
typeof Userinfo.prototype.id,
|
||||
UserinfoRelations
|
||||
> {
|
||||
constructor(
|
||||
@inject('datasources.radius') dataSource: RadiusDataSource,
|
||||
) {
|
||||
super(Userinfo, dataSource);
|
||||
}
|
||||
}
|
35
src/sequence.ts
Normal file
35
src/sequence.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import {inject} from '@loopback/context';
|
||||
import {
|
||||
FindRoute,
|
||||
InvokeMethod,
|
||||
ParseParams,
|
||||
Reject,
|
||||
RequestContext,
|
||||
RestBindings,
|
||||
Send,
|
||||
SequenceHandler,
|
||||
} from '@loopback/rest';
|
||||
|
||||
const SequenceActions = RestBindings.SequenceActions;
|
||||
|
||||
export class MySequence implements SequenceHandler {
|
||||
constructor(
|
||||
@inject(SequenceActions.FIND_ROUTE) protected findRoute: FindRoute,
|
||||
@inject(SequenceActions.PARSE_PARAMS) protected parseParams: ParseParams,
|
||||
@inject(SequenceActions.INVOKE_METHOD) protected invoke: InvokeMethod,
|
||||
@inject(SequenceActions.SEND) public send: Send,
|
||||
@inject(SequenceActions.REJECT) public reject: Reject,
|
||||
) {}
|
||||
|
||||
async handle(context: RequestContext) {
|
||||
try {
|
||||
const {request, response} = context;
|
||||
const route = this.findRoute(request);
|
||||
const args = await this.parseParams(request, route);
|
||||
const result = await this.invoke(route, args);
|
||||
this.send(response, result);
|
||||
} catch (err) {
|
||||
this.reject(context, err);
|
||||
}
|
||||
}
|
||||
}
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/tsconfig",
|
||||
"extends": "@loopback/build/config/tsconfig.common.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
Loading…
Reference in a new issue