appsflare/ludicrum-api

View on GitHub
api/models/Client.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * Client
 *
 * @description :: A model that defines the data structure of client details
 * @docs    :: http://sailsjs.org/#!documentation/models
 */

module.exports = {

  attributes: {

    name: {
      type: 'string',
      required: true
    },
    redirectURI: {
      type: 'string',
      required: true
    },
    clientId: 'string',
    clientSecret: 'string',
    trusted: {
      type: 'boolean',
      defaultsTo: false
    }

  },

  beforeCreate: function (values, next) {
    values.clientId = UtilsService.uidLight(10);
    values.clientSecret = UtilsService.uid(30);
    next();
  }

};