1. add response message
2. add account schema
This commit is contained in:
parent
c072d18c36
commit
15b54b9c87
@ -13,7 +13,8 @@
|
||||
{"file": "20180719-1.sql", "version": 11},
|
||||
{"file": "20180721-1.sql", "version": 12},
|
||||
{"file": "20180807-1.sql", "version": 13},
|
||||
{"file": "20180811-1.sql", "version": 14}
|
||||
{"file": "20180811-1.sql", "version": 14},
|
||||
{"file": "20180815-1.sql", "version": 15}
|
||||
],
|
||||
"test": []
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
const _ = require('lodash')
|
||||
|
||||
/**
|
||||
* check Object
|
||||
* @param {string} key key name
|
||||
@ -42,6 +44,11 @@ const chkObject = function (key = '', type = '', empty = false) {
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
chkObject
|
||||
const resObject = () => {
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
chkObject,
|
||||
resObject
|
||||
}
|
||||
|
23
libs/route-utils/res-message/index.js
Normal file
23
libs/route-utils/res-message/index.js
Normal file
@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
Success: {
|
||||
status: 200,
|
||||
obj: {
|
||||
status: 200,
|
||||
message: 'success'
|
||||
}
|
||||
},
|
||||
DataFormat: {
|
||||
status: 400,
|
||||
obj: {
|
||||
status: 400,
|
||||
message: 'input data format error'
|
||||
}
|
||||
},
|
||||
InternalError: {
|
||||
status: 500,
|
||||
obj: {
|
||||
status: 500,
|
||||
message: 'server internal error'
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@ r.use(async (c, n) => {
|
||||
|
||||
r.post('/login', koaBody(), async (c, n) => {
|
||||
if (!c.chkBody('account', 'string') || !c.chkBody('password', 'string')) throw new Error('DataFormat')
|
||||
|
||||
})
|
||||
|
||||
module.exports = r
|
||||
|
8
schema/20180815-1.sql
Normal file
8
schema/20180815-1.sql
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE public.account
|
||||
(
|
||||
id uuid DEFAULT public.uuid_generate_v4() PRIMARY KEY NOT NULL,
|
||||
account varchar(100) NOT NULL,
|
||||
password varchar(200) NOT NULL,
|
||||
ctime timestamp with time zone DEFAULT current_timestamp NOT NULL,
|
||||
mtime timestamp with time zone DEFAULT current_timestamp NOT NULL
|
||||
);
|
Loading…
Reference in New Issue
Block a user