update alram
This commit is contained in:
parent
ac7edfbc8b
commit
a286e814b2
|
|
@ -18,7 +18,7 @@ export class LogsService {
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async saveLog(data: SendLogDto) {
|
async saveLog(data: SendLogDto) {
|
||||||
const thirtyMinutesAgo = new Date(Date.now() - 30 * 60 * 1000);
|
const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000);
|
||||||
|
|
||||||
// 1. Check nếu đã có log trùng trong 30 phút
|
// 1. Check nếu đã có log trùng trong 30 phút
|
||||||
const existingLog = await this.repo
|
const existingLog = await this.repo
|
||||||
|
|
@ -26,7 +26,7 @@ export class LogsService {
|
||||||
.where('log.message = :message', { message: data.message })
|
.where('log.message = :message', { message: data.message })
|
||||||
.andWhere('log.type = :type', { type: data.type })
|
.andWhere('log.type = :type', { type: data.type })
|
||||||
.andWhere('log.created_at > :time', {
|
.andWhere('log.created_at > :time', {
|
||||||
time: thirtyMinutesAgo.toISOString(),
|
time: oneHourAgo.toISOString(),
|
||||||
}) // convert sang ISO
|
}) // convert sang ISO
|
||||||
.getOne();
|
.getOne();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue