@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { In, IsNull, Not } from 'typeorm';
|
||||
import { In, Not } from 'typeorm';
|
||||
import * as Redis from 'ioredis';
|
||||
import _Ajv from 'ajv';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
@@ -250,11 +250,9 @@ export class UserEntityService implements OnModuleInit {
|
||||
userId: userId,
|
||||
});
|
||||
|
||||
const id = reads.length > 0 ? Not(In(reads.map(read => read.announcementId))) : undefined;
|
||||
const count = await this.announcementsRepository.countBy([
|
||||
{ id, userId: IsNull() },
|
||||
{ id, userId: userId },
|
||||
]);
|
||||
const count = await this.announcementsRepository.countBy(reads.length > 0 ? {
|
||||
id: Not(In(reads.map(read => read.announcementId))),
|
||||
} : {});
|
||||
|
||||
return count > 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user