nameId廃止 & アプリ作成時にシークレットを返すように

This commit is contained in:
syuilo
2018-08-19 18:38:02 +09:00
parent d60c3c4ee3
commit bb7b335491
6 changed files with 7 additions and 103 deletions

View File

@ -5,8 +5,6 @@ import db from '../db/mongodb';
import config from '../config';
const App = db.get<IApp>('apps');
App.createIndex('nameId');
App.createIndex('nameIdLower');
App.createIndex('secret');
export default App;
@ -16,17 +14,11 @@ export type IApp = {
userId: mongo.ObjectID | null;
secret: string;
name: string;
nameId: string;
nameIdLower: string;
description: string;
permission: string[];
callbackUrl: string;
};
export function isValidNameId(nameId: string): boolean {
return typeof nameId == 'string' && /^[a-zA-Z0-9_]{1,30}$/.test(nameId);
}
/**
* Pack an app for API response
*
@ -76,8 +68,6 @@ export const pack = (
_app.id = _app._id;
delete _app._id;
delete _app.nameIdLower;
// Visible by only owner
if (!opts.includeSecret) {
delete _app.secret;