Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Medic
exam-sso-api
Commits
4cf20499
Commit
4cf20499
authored
Jul 05, 2019
by
Lorex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增 App Model
parent
5418ef38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
src/api/models/App.js
src/api/models/App.js
+34
-0
No files found.
src/api/models/App.js
0 → 100644
View file @
4cf20499
/**
* 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
();
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment