| ... | @@ -129,4 +129,44 @@ logger.fatal('message'); |
... | @@ -129,4 +129,44 @@ logger.fatal('message'); |
|
|
```
|
|
```
|
|
|
|
|
|
|
|
# Lib
|
|
# Lib
|
|
|
常用方法 |
|
一些常用方法
|
|
\ No newline at end of file |
|
```
|
|
|
|
/**
|
|
|
|
* 返回错误信息
|
|
|
|
* @param res response object
|
|
|
|
* @param err error object
|
|
|
|
*/
|
|
|
|
export function errorRes(res, err) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 返回正常http处理结果
|
|
|
|
* @param res response object
|
|
|
|
* @param data data object to be returned
|
|
|
|
*/
|
|
|
|
export function okRes(res, data) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* will throw error if current user is not logged in
|
|
|
|
* @param rootValue the rootValue
|
|
|
|
*/
|
|
|
|
export function requireLogin(rootValue) => {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a basic object structure with a generated id, createdAt, updatedAt timestamp and isRemove set to false
|
|
|
|
*/
|
|
|
|
export function createBasicOj () {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Randomly genreate a password from abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-+= these characters with the given length
|
|
|
|
* @param length length of string to be generated
|
|
|
|
*/
|
|
|
|
export function generatePassword (length: number) : string {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Randomly generate a string from ABCDEFGHJKMNOPQRSTUVWXYZ0123456789 these characters, useful for genreating invitation code etc..
|
|
|
|
* @param length length of string to be generated
|
|
|
|
*/
|
|
|
|
export function generateCode (length: number) : string {}
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
\ No newline at end of file |