forked from FoundKeyGang/FoundKey
backend: remove unused endpoints
Changelog: Removed
This commit is contained in:
parent
b2c483faf5
commit
f74395c386
5 changed files with 0 additions and 150 deletions
|
@ -270,14 +270,12 @@ import * as ep___serverInfo from './endpoints/server-info.js';
|
||||||
import * as ep___stats from './endpoints/stats.js';
|
import * as ep___stats from './endpoints/stats.js';
|
||||||
import * as ep___sw_register from './endpoints/sw/register.js';
|
import * as ep___sw_register from './endpoints/sw/register.js';
|
||||||
import * as ep___sw_unregister from './endpoints/sw/unregister.js';
|
import * as ep___sw_unregister from './endpoints/sw/unregister.js';
|
||||||
import * as ep___test from './endpoints/test.js';
|
|
||||||
import * as ep___username_available from './endpoints/username/available.js';
|
import * as ep___username_available from './endpoints/username/available.js';
|
||||||
import * as ep___users from './endpoints/users.js';
|
import * as ep___users from './endpoints/users.js';
|
||||||
import * as ep___users_clips from './endpoints/users/clips.js';
|
import * as ep___users_clips from './endpoints/users/clips.js';
|
||||||
import * as ep___users_followers from './endpoints/users/followers.js';
|
import * as ep___users_followers from './endpoints/users/followers.js';
|
||||||
import * as ep___users_following from './endpoints/users/following.js';
|
import * as ep___users_following from './endpoints/users/following.js';
|
||||||
import * as ep___users_gallery_posts from './endpoints/users/gallery/posts.js';
|
import * as ep___users_gallery_posts from './endpoints/users/gallery/posts.js';
|
||||||
import * as ep___users_getFrequentlyRepliedUsers from './endpoints/users/get-frequently-replied-users.js';
|
|
||||||
import * as ep___users_groups_create from './endpoints/users/groups/create.js';
|
import * as ep___users_groups_create from './endpoints/users/groups/create.js';
|
||||||
import * as ep___users_groups_delete from './endpoints/users/groups/delete.js';
|
import * as ep___users_groups_delete from './endpoints/users/groups/delete.js';
|
||||||
import * as ep___users_groups_invitations_accept from './endpoints/users/groups/invitations/accept.js';
|
import * as ep___users_groups_invitations_accept from './endpoints/users/groups/invitations/accept.js';
|
||||||
|
@ -580,14 +578,12 @@ const eps = [
|
||||||
['stats', ep___stats],
|
['stats', ep___stats],
|
||||||
['sw/register', ep___sw_register],
|
['sw/register', ep___sw_register],
|
||||||
['sw/unregister', ep___sw_unregister],
|
['sw/unregister', ep___sw_unregister],
|
||||||
['test', ep___test],
|
|
||||||
['username/available', ep___username_available],
|
['username/available', ep___username_available],
|
||||||
['users', ep___users],
|
['users', ep___users],
|
||||||
['users/clips', ep___users_clips],
|
['users/clips', ep___users_clips],
|
||||||
['users/followers', ep___users_followers],
|
['users/followers', ep___users_followers],
|
||||||
['users/following', ep___users_following],
|
['users/following', ep___users_following],
|
||||||
['users/gallery/posts', ep___users_gallery_posts],
|
['users/gallery/posts', ep___users_gallery_posts],
|
||||||
['users/get-frequently-replied-users', ep___users_getFrequentlyRepliedUsers],
|
|
||||||
['users/groups/create', ep___users_groups_create],
|
['users/groups/create', ep___users_groups_create],
|
||||||
['users/groups/delete', ep___users_groups_delete],
|
['users/groups/delete', ep___users_groups_delete],
|
||||||
['users/groups/invitations/accept', ep___users_groups_invitations_accept],
|
['users/groups/invitations/accept', ep___users_groups_invitations_accept],
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
import define from '../define.js';
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ['non-productive'],
|
|
||||||
|
|
||||||
description: 'Endpoint for testing input validation.',
|
|
||||||
|
|
||||||
requireCredential: false,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
required: { type: 'boolean' },
|
|
||||||
string: { type: 'string' },
|
|
||||||
default: { type: 'string', default: 'hello' },
|
|
||||||
nullableDefault: { type: 'string', nullable: true, default: 'hello' },
|
|
||||||
id: { type: 'string', format: 'misskey:id' },
|
|
||||||
},
|
|
||||||
required: ['required'],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
return ps;
|
|
||||||
});
|
|
|
@ -1,114 +0,0 @@
|
||||||
import { Not, In, IsNull } from 'typeorm';
|
|
||||||
import { maximum } from '@/prelude/array.js';
|
|
||||||
import { Notes, Users } from '@/models/index.js';
|
|
||||||
import define from '../../define.js';
|
|
||||||
import { ApiError } from '../../error.js';
|
|
||||||
import { getUser } from '../../common/getters.js';
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ['users'],
|
|
||||||
|
|
||||||
requireCredential: false,
|
|
||||||
|
|
||||||
description: 'Get a list of other users that the specified user frequently replies to.',
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: 'array',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
items: {
|
|
||||||
type: 'object',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
properties: {
|
|
||||||
user: {
|
|
||||||
type: 'object',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
ref: 'UserDetailed',
|
|
||||||
},
|
|
||||||
weight: {
|
|
||||||
type: 'number',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
errors: {
|
|
||||||
noSuchUser: {
|
|
||||||
message: 'No such user.',
|
|
||||||
code: 'NO_SUCH_USER',
|
|
||||||
id: 'e6965129-7b2a-40a4-bae2-cd84cd434822',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
userId: { type: 'string', format: 'misskey:id' },
|
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
||||||
},
|
|
||||||
required: ['userId'],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
// Lookup user
|
|
||||||
const user = await getUser(ps.userId).catch(e => {
|
|
||||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
|
||||||
throw e;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Fetch recent notes
|
|
||||||
const recentNotes = await Notes.find({
|
|
||||||
where: {
|
|
||||||
userId: user.id,
|
|
||||||
replyId: Not(IsNull()),
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
id: -1,
|
|
||||||
},
|
|
||||||
take: 1000,
|
|
||||||
select: ['replyId'],
|
|
||||||
});
|
|
||||||
|
|
||||||
// 投稿が少なかったら中断
|
|
||||||
if (recentNotes.length === 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO ミュートを考慮
|
|
||||||
const replyTargetNotes = await Notes.find({
|
|
||||||
where: {
|
|
||||||
id: In(recentNotes.map(p => p.replyId)),
|
|
||||||
},
|
|
||||||
select: ['userId'],
|
|
||||||
});
|
|
||||||
|
|
||||||
const repliedUsers: any = {};
|
|
||||||
|
|
||||||
// Extract replies from recent notes
|
|
||||||
for (const userId of replyTargetNotes.map(x => x.userId.toString())) {
|
|
||||||
if (repliedUsers[userId]) {
|
|
||||||
repliedUsers[userId]++;
|
|
||||||
} else {
|
|
||||||
repliedUsers[userId] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calc peak
|
|
||||||
const peak = maximum(Object.values(repliedUsers));
|
|
||||||
|
|
||||||
// Sort replies by frequency
|
|
||||||
const repliedUsersSorted = Object.keys(repliedUsers).sort((a, b) => repliedUsers[b] - repliedUsers[a]);
|
|
||||||
|
|
||||||
// Extract top replied users
|
|
||||||
const topRepliedUsers = repliedUsersSorted.slice(0, ps.limit);
|
|
||||||
|
|
||||||
// Make replies object (includes weights)
|
|
||||||
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
|
|
||||||
user: await Users.pack(user, me, { detail: true }),
|
|
||||||
weight: repliedUsers[user] / peak,
|
|
||||||
})));
|
|
||||||
|
|
||||||
return repliesObj;
|
|
||||||
});
|
|
|
@ -1977,10 +1977,6 @@ export type Endpoints = {
|
||||||
req: TODO;
|
req: TODO;
|
||||||
res: TODO;
|
res: TODO;
|
||||||
};
|
};
|
||||||
'users/get-frequently-replied-users': {
|
|
||||||
req: TODO;
|
|
||||||
res: TODO;
|
|
||||||
};
|
|
||||||
'users/groups/create': {
|
'users/groups/create': {
|
||||||
req: TODO;
|
req: TODO;
|
||||||
res: TODO;
|
res: TODO;
|
||||||
|
|
|
@ -484,14 +484,12 @@ export type Endpoints = {
|
||||||
'stats': { req: NoParams; res: Stats; };
|
'stats': { req: NoParams; res: Stats; };
|
||||||
'sw/register': { req: TODO; res: TODO; };
|
'sw/register': { req: TODO; res: TODO; };
|
||||||
'sw/unregister': { req: TODO; res: TODO; };
|
'sw/unregister': { req: TODO; res: TODO; };
|
||||||
'test': { req: TODO; res: TODO; };
|
|
||||||
'username/available': { req: { username: string; }; res: { available: boolean; }; };
|
'username/available': { req: { username: string; }; res: { available: boolean; }; };
|
||||||
'users': { req: { limit?: number; offset?: number; sort?: UserSorting; origin?: OriginType; }; res: User[]; };
|
'users': { req: { limit?: number; offset?: number; sort?: UserSorting; origin?: OriginType; }; res: User[]; };
|
||||||
'users/clips': { req: TODO; res: TODO; };
|
'users/clips': { req: TODO; res: TODO; };
|
||||||
'users/followers': { req: { userId?: User['id']; username?: User['username']; host?: User['host'] | null; limit?: number; sinceId?: Following['id']; untilId?: Following['id']; }; res: FollowingFollowerPopulated[]; };
|
'users/followers': { req: { userId?: User['id']; username?: User['username']; host?: User['host'] | null; limit?: number; sinceId?: Following['id']; untilId?: Following['id']; }; res: FollowingFollowerPopulated[]; };
|
||||||
'users/following': { req: { userId?: User['id']; username?: User['username']; host?: User['host'] | null; limit?: number; sinceId?: Following['id']; untilId?: Following['id']; }; res: FollowingFolloweePopulated[]; };
|
'users/following': { req: { userId?: User['id']; username?: User['username']; host?: User['host'] | null; limit?: number; sinceId?: Following['id']; untilId?: Following['id']; }; res: FollowingFolloweePopulated[]; };
|
||||||
'users/gallery/posts': { req: TODO; res: TODO; };
|
'users/gallery/posts': { req: TODO; res: TODO; };
|
||||||
'users/get-frequently-replied-users': { req: TODO; res: TODO; };
|
|
||||||
'users/groups/create': { req: TODO; res: TODO; };
|
'users/groups/create': { req: TODO; res: TODO; };
|
||||||
'users/groups/delete': { req: { groupId: UserGroup['id'] }; res: null; };
|
'users/groups/delete': { req: { groupId: UserGroup['id'] }; res: null; };
|
||||||
'users/groups/invitations/accept': { req: TODO; res: TODO; };
|
'users/groups/invitations/accept': { req: TODO; res: TODO; };
|
||||||
|
|
Loading…
Reference in a new issue