enhance: 使われてないアンテナは自動停止されるように

Resolve #9373
This commit is contained in:
syuilo 2023-03-20 20:12:38 +09:00
parent eb5781465b
commit 54630edb0f
9 changed files with 59 additions and 4 deletions

View file

@ -71,12 +71,14 @@ export class AntennaService implements OnApplicationShutdown {
this.antennas.push({
...body,
createdAt: new Date(body.createdAt),
lastUsedAt: new Date(body.lastUsedAt),
});
break;
case 'antennaUpdated':
this.antennas[this.antennas.findIndex(a => a.id === body.id)] = {
...body,
createdAt: new Date(body.createdAt),
lastUsedAt: new Date(body.lastUsedAt),
};
break;
case 'antennaDeleted':
@ -217,7 +219,9 @@ export class AntennaService implements OnApplicationShutdown {
@bindThis
public async getAntennas() {
if (!this.antennasFetched) {
this.antennas = await this.antennasRepository.find();
this.antennas = await this.antennasRepository.findBy({
isActive: true,
});
this.antennasFetched = true;
}