CoreID/app/models/radius/Client.model.js
garrettmills bd69be7137
All checks were successful
continuous-integration/drone/push Build is passing
Implement RADIUS server!
2021-10-24 13:12:58 -05:00

33 lines
760 B
JavaScript

const { Model } = require('flitter-orm')
const {v4: uuid} = require("uuid");
class Client extends Model {
static get services() {
return [...super.services, 'models']
}
static get schema() {
return {
name: String,
secret: {type: String, default: uuid},
active: {type: Boolean, default: true},
}
}
async application() {
const Application = this.models.get('Application')
return Application.findOne({ active: true, radius_client_ids: this.id })
}
async to_api() {
return {
id: this.id,
name: this.name,
secret: this.secret,
active: this.active,
}
}
}
module.exports = exports = Client