mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: allow query rpInfo and avatarUrl on User object
This commit is contained in:
1 file changed
+2
@@ -41,6 +41,7 @@ registerValue('User', [
|
||||
['tfa', 'Boolean!'],
|
||||
['authn', 'Boolean!'],
|
||||
['displayName', 'String'],
|
||||
['rpInfo', 'JSONObject'],
|
||||
]);
|
||||
|
||||
registerResolver('Query', 'user(id: Int, uname: String, mail: String)', 'User', (arg, ctx) => {
|
||||
@@ -54,6 +55,7 @@ Returns current user if no argument is provided.`);
|
||||
registerResolver('Query', 'users(ids: [Int], search: String, limit: Int, exact: Boolean)', '[User]', async (arg, ctx) => {
|
||||
if (arg.ids?.length) {
|
||||
const res = await user.getList(ctx.args.domainId, arg.ids);
|
||||
for (const i in res) res[i].avatarUrl = avatar(res[i].avatar);
|
||||
return Object.keys(res).map((id) => res[+id]);
|
||||
}
|
||||
if (!arg.search) return [];
|
||||
|
||||
Reference in new issue
Block a user