cleanup and support for all address types

This commit is contained in:
Ben Wilson
2023-06-26 20:52:00 -04:00
parent 5ec2906f99
commit a435a9bbd8
15 changed files with 253 additions and 31 deletions
+13
View File
@@ -25,6 +25,19 @@ export class ClientService {
return await this.clientRepository.softDelete({ sessionId });
}
public async deleteOldClients() {
const oneDayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
return await this.clientRepository
.createQueryBuilder()
.delete()
.from(ClientEntity)
.where('deletedAt < :time', { time: oneDayAgo })
.execute();
}
public async updateBestDifficulty(sessionId: string, bestDifficulty: number) {
return await this.clientRepository.update({ sessionId }, { bestDifficulty });
}