mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
address best diff
This commit is contained in:
@@ -8,6 +8,9 @@ export class AddressSettingsEntity extends TrackedEntity {
|
||||
@PrimaryColumn({ length: 62, type: 'varchar' })
|
||||
address: string;
|
||||
|
||||
@Column({ type: 'real', default: 0 })
|
||||
bestDifficulty: number
|
||||
|
||||
@Column()
|
||||
miscCoinbaseScriptData: string;
|
||||
|
||||
|
||||
@@ -14,4 +14,15 @@ export class AddressSettingsService {
|
||||
|
||||
}
|
||||
|
||||
public async getSettings(address: string) {
|
||||
return await this.addressSettingsRepository.findOne({ where: { address } });
|
||||
}
|
||||
|
||||
public async updateBestDifficulty(address: string, bestDifficulty: number) {
|
||||
return await this.addressSettingsRepository.update({ address }, { bestDifficulty });
|
||||
}
|
||||
|
||||
public async createNew(address: string) {
|
||||
return await this.addressSettingsRepository.save({ address });
|
||||
}
|
||||
}
|
||||
@@ -45,14 +45,6 @@ export class ClientService {
|
||||
return await this.clientRepository.count();
|
||||
}
|
||||
|
||||
public async getBestDiff(address: string) {
|
||||
const res = await this.clientRepository.createQueryBuilder('client')
|
||||
.select('MAX(client.bestDifficulty)', 'bestDifficulty')
|
||||
.where('client.address = :address', { address })
|
||||
.withDeleted()
|
||||
.getRawOne();
|
||||
return res?.bestDifficulty;
|
||||
}
|
||||
public async getByAddress(address: string): Promise<ClientEntity[]> {
|
||||
return await this.clientRepository.find({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user