mirror of
https://github.com/paricafe/misskey.git
synced 2024-12-02 14:06:43 -06:00
2756f553c6
* wip
* wip
* wip
* Update attached_notes.ts
* wip
* Refactor
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update call.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* ✌️
* Fix
30 lines
840 B
TypeScript
30 lines
840 B
TypeScript
import $ from 'cafy';
|
|
import ID, { transform, ObjectId } from '../../../../misc/cafy-id';
|
|
import { getRelation } from '../../../../models/user';
|
|
import define from '../../define';
|
|
|
|
export const meta = {
|
|
desc: {
|
|
'ja-JP': 'ユーザー間のリレーションを取得します。'
|
|
},
|
|
|
|
requireCredential: true,
|
|
|
|
params: {
|
|
userId: {
|
|
validator: $.or($.type(ID), $.arr($.type(ID)).unique()),
|
|
transform: (v: any): ObjectId | ObjectId[] => Array.isArray(v) ? v.map(x => transform(x)) : transform(v),
|
|
desc: {
|
|
'ja-JP': 'ユーザーID (配列でも可)'
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, me) => {
|
|
const ids = Array.isArray(ps.userId) ? ps.userId : [ps.userId];
|
|
|
|
const relations = await Promise.all(ids.map(id => getRelation(me._id, id)));
|
|
|
|
return Array.isArray(ps.userId) ? relations : relations[0];
|
|
});
|