mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Feat/refactor matchmaker promise format (#293)
This commit is contained in:
28 files changed
+2144
-3159
No files matched your search
@@ -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(),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user