Improve UI

This commit is contained in:
syuilo
2019-02-16 10:58:44 +09:00
parent 5a28dc0198
commit 88dc4c83cb
19 changed files with 451 additions and 702 deletions

View File

@ -16,7 +16,7 @@ export const meta = {
params: {
userId: {
validator: $.type(ID),
validator: $.optional.type(ID),
transform: transform,
desc: {
'ja-JP': '対象のユーザーのID',
@ -24,6 +24,14 @@ export const meta = {
}
},
username: {
validator: $.optional.str
},
host: {
validator: $.optional.nullable.str
},
limit: {
validator: $.optional.num.range(1, 100),
default: 10
@ -43,14 +51,11 @@ export const meta = {
};
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
// Lookup user
const user = await User.findOne({
_id: ps.userId
}, {
fields: {
_id: true
}
});
const q: any = ps.userId != null
? { _id: ps.userId }
: { usernameLower: ps.username.toLowerCase(), host: ps.host };
const user = await User.findOne(q);
if (user === null) {
return rej('user not found');

View File

@ -16,7 +16,7 @@ export const meta = {
params: {
userId: {
validator: $.type(ID),
validator: $.optional.type(ID),
transform: transform,
desc: {
'ja-JP': '対象のユーザーのID',
@ -24,6 +24,14 @@ export const meta = {
}
},
username: {
validator: $.optional.str
},
host: {
validator: $.optional.nullable.str
},
limit: {
validator: $.optional.num.range(1, 100),
default: 10
@ -43,14 +51,11 @@ export const meta = {
};
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
// Lookup user
const user = await User.findOne({
_id: ps.userId
}, {
fields: {
_id: true
}
});
const q: any = ps.userId != null
? { _id: ps.userId }
: { usernameLower: ps.username.toLowerCase(), host: ps.host };
const user = await User.findOne(q);
if (user === null) {
return rej('user not found');