mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 01:40:51 +00:00

* refactor: OpenAPIKey refactor * refactor: outlink api refactor fix: list return wrong data * chore: remove deprecated type definition * chore: remove throw Error. instead of Promise.reject * fix: auth openapikey's owner * fix: manager could read all keys
34 lines
729 B
TypeScript
34 lines
729 B
TypeScript
import { ErrType } from '../errorCode';
|
|
|
|
/* dataset: 506000 */
|
|
export enum OpenApiErrEnum {
|
|
unExist = 'openapiUnExist',
|
|
unAuth = 'openapiUnAuth',
|
|
exceedLimit = 'openapiExceedLimit'
|
|
}
|
|
const errList = [
|
|
{
|
|
statusText: OpenApiErrEnum.unExist,
|
|
message: 'Api Key 不存在'
|
|
},
|
|
{
|
|
statusText: OpenApiErrEnum.unAuth,
|
|
message: '无权操作该 Api Key'
|
|
},
|
|
{
|
|
statusText: OpenApiErrEnum.exceedLimit,
|
|
message: '最多 10 组 API 密钥'
|
|
}
|
|
];
|
|
export default errList.reduce((acc, cur, index) => {
|
|
return {
|
|
...acc,
|
|
[cur.statusText]: {
|
|
code: 506000 + index,
|
|
statusText: cur.statusText,
|
|
message: cur.message,
|
|
data: null
|
|
}
|
|
};
|
|
}, {} as ErrType<`${OpenApiErrEnum}`>);
|