add player tracked since date
All checks were successful
Deploy Backend / deploy (push) Successful in 3m6s

This commit is contained in:
Lee
2024-10-09 15:25:21 +01:00
parent 6b8244fa48
commit ee042fe91e
3 changed files with 22 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { app } from "../index";
import { getDaysAgoDate, getMidnightAlignedDate } from "@ssr/common/utils/time-utils";
import { scoresaberService } from "@ssr/common/service/impl/scoresaber";
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
import { InternalServerError } from "../error/internal-server-error";
export class PlayerService {
/**
@ -49,8 +50,9 @@ export class PlayerService {
console.log(`Creating player "${id}"...`);
player = (await PlayerModel.create({ _id: id })) as any;
if (player === null) {
throw new NotFoundError(`Player "${id}" not found`);
throw new InternalServerError(`Failed to create player document for "${id}"`);
}
player.trackedSince = new Date();
await this.seedPlayerHistory(player, playerToken);
console.log(`Created player "${id}".`);
} else {