tweak(server/player): Tweaked structure slightly

This commit is contained in:
Taso committed 2021-04-19 14:14:24 -04:00
1 parent cb9c490cb5
commit 06a67f14cd
3 files changed
+13 -9

No files matched your search

@@ -1,7 +1,8 @@
import { getSource } from '../utils/miscUtils'; import { getSource } from '../utils/miscUtils';
import PlayerService, { playerLogger } from './player.service'; import PlayerService from './player.service';
import { config } from '../server'; import { config } from '../server';
import { PlayerAddData } from './player.interfaces'; import { PlayerAddData } from './player.interfaces';
import { playerLogger } from './player.utils';
/** /**
* Essentially this whole file acts as a controller layer * Essentially this whole file acts as a controller layer
+6 -8
View File
@@ -1,4 +1,3 @@
import { mainLogger } from '../sv_logger';
import { generatePhoneNumber } from '../functions'; import { generatePhoneNumber } from '../functions';
import { PhoneEvents } from '../../../typings/phone'; import { PhoneEvents } from '../../../typings/phone';
import { Player } from './player.class'; import { Player } from './player.class';
@@ -6,12 +5,9 @@ import { PlayerAddData } from './player.interfaces';
import Collection from '@discordjs/collection'; import Collection from '@discordjs/collection';
import { getPlayerGameLicense } from '../utils/getPlayerGameLicense'; import { getPlayerGameLicense } from '../utils/getPlayerGameLicense';
import playerDB, { PlayerRepo } from './player.db'; import playerDB, { PlayerRepo } from './player.db';
import { playerLogger } from './player.utils';
export const playerLogger = mainLogger.child({ class _PlayerService {
module: 'player',
});
class PlayerService {
private readonly playersBySource: Collection<number, Player>; private readonly playersBySource: Collection<number, Player>;
private readonly playersByIdentifier: Collection<string, Player>; private readonly playersByIdentifier: Collection<string, Player>;
private readonly playerDB: PlayerRepo; private readonly playerDB: PlayerRepo;
@@ -53,7 +49,7 @@ class PlayerService {
} }
/** /**
* Returns the player instance for a given source * Returns the player identifier for a given source
* Will return null if no player is found online with that source * Will return null if no player is found online with that source
**/ **/
getIdentifier(source: number): string { getIdentifier(source: number): string {
@@ -221,4 +217,6 @@ class PlayerService {
} }
} }
export default new PlayerService(); const PlayerService = new _PlayerService();
export default PlayerService;
+5
View File
@@ -0,0 +1,5 @@
import { mainLogger } from '../sv_logger';
export const playerLogger = mainLogger.child({
module: 'player',
});