0
0
Fork 0

ディレクトリ再編

This commit is contained in:
xeltica 2021-09-04 11:00:38 +09:00
parent cb924ff92b
commit 85d471efbb
45 changed files with 204 additions and 41 deletions

View file

@ -0,0 +1,19 @@
import { User } from '../models/entities/user';
import { Score } from '../../common/types/score';
import { api } from '../services/misskey';
import { toSignedString } from './to-signed-string';
export const getScores = async (user: User): Promise<Score> => {
const miUser = await api<Record<string, number>>(user.host, 'users/show', { username: user.username }, user.token);
if (miUser.error) {
throw miUser.error;
}
return {
notesCount: miUser.notesCount,
followingCount: miUser.followingCount,
followersCount: miUser.followersCount,
notesDelta: toSignedString(miUser.notesCount - user.prevNotesCount),
followingDelta: toSignedString(miUser.followingCount - user.prevFollowingCount),
followersDelta: toSignedString(miUser.followersCount - user.prevFollowersCount),
};
};