summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/users/relation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api/endpoints/users/relation.ts')
-rw-r--r--src/server/api/endpoints/users/relation.ts111
1 files changed, 0 insertions, 111 deletions
diff --git a/src/server/api/endpoints/users/relation.ts b/src/server/api/endpoints/users/relation.ts
deleted file mode 100644
index 32d76a5322..0000000000
--- a/src/server/api/endpoints/users/relation.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import $ from 'cafy';
-import define from '../../define';
-import { ID } from '@/misc/cafy-id';
-import { Users } from '@/models/index';
-
-export const meta = {
- tags: ['users'],
-
- requireCredential: true as const,
-
- params: {
- userId: {
- validator: $.either($.type(ID), $.arr($.type(ID)).unique()),
- }
- },
-
- res: {
- oneOf: [
- {
- type: 'object' as const,
- optional: false as const, nullable: false as const,
- properties: {
- id: {
- type: 'string' as const,
- optional: false as const, nullable: false as const,
- format: 'id'
- },
- isFollowing: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- hasPendingFollowRequestFromYou: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- hasPendingFollowRequestToYou: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isFollowed: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isBlocking: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isBlocked: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isMuted: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- }
- }
- },
- {
- type: 'array' as const,
- optional: false as const, nullable: false as const,
- items: {
- type: 'object' as const,
- optional: false as const, nullable: false as const,
- properties: {
- id: {
- type: 'string' as const,
- optional: false as const, nullable: false as const,
- format: 'id'
- },
- isFollowing: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- hasPendingFollowRequestFromYou: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- hasPendingFollowRequestToYou: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isFollowed: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isBlocking: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isBlocked: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- },
- isMuted: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const
- }
- }
- }
- }
- ]
- }
-};
-
-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 => Users.getRelation(me.id, id)));
-
- return Array.isArray(ps.userId) ? relations : relations[0];
-});