File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -697,6 +697,9 @@ export class ChannelStartupService {
697697 AND "Message"."messageTimestamp" <= ${ Math . floor ( new Date ( query . where . messageTimestamp . lte ) . getTime ( ) / 1000 ) } `
698698 : Prisma . sql `` ;
699699
700+ const limit = query ?. take ? Prisma . sql `LIMIT ${ query . take } ` : Prisma . sql `` ;
701+ const offset = query ?. skip ? Prisma . sql `OFFSET ${ query . skip } ` : Prisma . sql `` ;
702+
700703 const results = await this . prismaRepository . $queryRaw `
701704 WITH rankedMessages AS (
702705 SELECT DISTINCT ON ("Message"."key"->>'remoteJid')
@@ -732,7 +735,9 @@ export class ChannelStartupService {
732735 ORDER BY "Message"."key"->>'remoteJid', "Message"."messageTimestamp" DESC
733736 )
734737 SELECT * FROM rankedMessages
735- ORDER BY "updatedAt" DESC NULLS LAST;
738+ ORDER BY "updatedAt" DESC NULLS LAST
739+ ${ limit }
740+ ${ offset } ;
736741 ` ;
737742
738743 if ( results && Array . isArray ( results ) && results . length > 0 ) {
You can’t perform that action at this time.
0 commit comments