Skip to content

Commit e4ded12

Browse files
committed
only use player alias service enum when looking at specific integrations
1 parent c30d76f commit e4ded12

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/services/api/player-api.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import checkScope from '../../policies/checkScope'
1515
export function findAliasFromIdentifyRequest(
1616
em: EntityManager,
1717
key: APIKey,
18-
service: PlayerAliasService,
18+
service: string,
1919
identifier: string
2020
): Promise<PlayerAlias | null> {
2121
return em.getRepository(PlayerAlias).findOne({
@@ -32,7 +32,7 @@ export function findAliasFromIdentifyRequest(
3232
export async function createPlayerFromIdentifyRequest(
3333
req: Request,
3434
key: APIKey,
35-
service: PlayerAliasService,
35+
service: string,
3636
identifier: string
3737
): Promise<Player> {
3838
if (checkScope(key, APIKeyScope.WRITE_PLAYERS)) {
@@ -78,12 +78,12 @@ export default class PlayerAPIService extends APIService {
7878

7979
const key = await this.getAPIKey(req.ctx)
8080

81-
let alias = await findAliasFromIdentifyRequest(em, key, service as PlayerAliasService, identifier)
81+
let alias = await findAliasFromIdentifyRequest(em, key, service, identifier)
8282
if (!alias) {
8383
if (service === PlayerAliasService.TALO) {
8484
req.ctx.throw(404, 'Player not found: Talo aliases must be created using the /v1/players/auth API')
8585
} else {
86-
const player = await createPlayerFromIdentifyRequest(req, key, service as PlayerAliasService, identifier)
86+
const player = await createPlayerFromIdentifyRequest(req, key, service, identifier)
8787
alias = player?.aliases[0]
8888
}
8989
}

src/services/player.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Service, Request, Response, Validate, HasPermission, Routes, Validation
22
import Game from '../entities/game'
33
import Player from '../entities/player'
44
import PlayerPolicy from '../policies/player.policy'
5-
import PlayerAlias, { PlayerAliasService } from '../entities/player-alias'
5+
import PlayerAlias from '../entities/player-alias'
66
import sanitiseProps from '../lib/props/sanitiseProps'
77
import { ClickhouseEvent, createEventFromClickhouse } from '../entities/event'
88
import { EntityManager } from '@mikro-orm/mysql'
@@ -28,7 +28,7 @@ const propsValidation = async (val: unknown): Promise<ValidationCondition[]> =>
2828

2929
type PlayerPostBody = {
3030
aliases?: {
31-
service: PlayerAliasService
31+
service: string
3232
identifier: string
3333
}[]
3434
props?: {

0 commit comments

Comments
 (0)