Feat/refactor matchmaker promise format (#293)

This commit is contained in:
chip authored and GitHub committed 2021-08-01 00:26:10 +02:00
1 parent 7ed5f54709
commit 1253c76aef
28 files changed
+2144 -3159

No files matched your search

+20
View File
@@ -1,3 +1,23 @@
import { mainLogger } from '../sv_logger';
import { FormattedMatch, FormattedProfile, Match, Profile } from '../../../typings/match';
import dayjs from 'dayjs';
export const matchLogger = mainLogger.child({ module: 'match' });
export function formatProfile(profile: Profile): FormattedProfile | null {
return {
...profile,
tagList: profile.tags.split(',').filter((t) => t), // remove any empty tags
lastActiveFormatted: dayjs.unix(profile.lastActive).toString(),
viewed: false,
};
}
export function formatMatches(match: Match): FormattedMatch | null {
return {
...match,
tagList: match.tags.split(',').filter((t) => t), // remove any empty tags
lastActiveFormatted: dayjs.unix(match.lastActive).toString(),
matchedAtFormatted: dayjs.unix(match.matchedAt).toString(),
};
}