nameId廃止 & アプリ作成時にシークレットを返すように
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user