Commit 4cf20499 authored by Lorex's avatar Lorex

feat: 新增 App Model

parent 5418ef38
/**
* App.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
const uuid = require('uuid/v4');
module.exports = {
attributes: {
name: {
type: 'string',
required: true,
isNotEmptyString: true
}, // App 名稱
info: {
type: 'string',
defaultsTo: ''
}, // App 介紹
appId: {
type: 'string',
defaultsTo: ''
}, // App ID
appSecret: {
type: 'string',
}, // App Secret
},
beforeCreate: (data, proceed) => {
data.appId = uuid().replace(/\-/g, '').substr(0, 8).toString();
data.appSecret = uuid().replace(/\-/g, '').toString();
return proceed();
}
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment