mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
user agents
This commit is contained in:
@@ -14,9 +14,12 @@ export class ClientEntity extends TrackedEntity {
|
||||
@Column({ length: 62, type: 'varchar' })
|
||||
address: string;
|
||||
|
||||
@Column()
|
||||
@Column({ length: 64, type: 'varchar' })
|
||||
clientName: string;
|
||||
|
||||
@Column({ length: 128, type: 'varchar', nullable: true })
|
||||
userAgent: string;
|
||||
|
||||
@Column({ length: 8, type: 'varchar' })
|
||||
sessionId: string;
|
||||
|
||||
@@ -24,7 +27,6 @@ export class ClientEntity extends TrackedEntity {
|
||||
startTime: Date;
|
||||
|
||||
|
||||
|
||||
@Column({ type: 'real', default: 0 })
|
||||
bestDifficulty: number
|
||||
|
||||
|
||||
@@ -76,4 +76,14 @@ export class ClientService {
|
||||
public async deleteAll() {
|
||||
return await this.clientRepository.softDelete({})
|
||||
}
|
||||
|
||||
public async getUserAgents() {
|
||||
const result = await this.clientRepository.createQueryBuilder('client')
|
||||
.select('client.userAgent as userAgent')
|
||||
.addSelect('COUNT(client.userAgent)', 'count')
|
||||
.groupBy('client.userAgent')
|
||||
.orderBy('count', 'DESC')
|
||||
.getRawMany();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user