diff --git a/bin/dbVersion.json b/bin/dbVersion.json index 8785a39..aac5194 100644 --- a/bin/dbVersion.json +++ b/bin/dbVersion.json @@ -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": [] } \ No newline at end of file diff --git a/libs/route-utils/index.js b/libs/route-utils/index.js index e3dc568..f2ff813 100644 --- a/libs/route-utils/index.js +++ b/libs/route-utils/index.js @@ -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 } diff --git a/libs/route-utils/res-message/index.js b/libs/route-utils/res-message/index.js new file mode 100644 index 0000000..922efa7 --- /dev/null +++ b/libs/route-utils/res-message/index.js @@ -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' + } + } +} diff --git a/route/api/index.js b/route/api/index.js index f8c14da..e730962 100644 --- a/route/api/index.js +++ b/route/api/index.js @@ -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 diff --git a/schema/20180815-1.sql b/schema/20180815-1.sql new file mode 100644 index 0000000..b0af6ce --- /dev/null +++ b/schema/20180815-1.sql @@ -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 +); \ No newline at end of file