parent
04fefb2056
commit
576251200f
17 changed files with 18 additions and 324 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue