Skip to content

Commit 0136815

Browse files
matheusmartinsInspermatheusmartinsInsper
authored andcommitted
Update src/api/services/channel.service.ts
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 9c4ee35 commit 0136815

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api/services/channel.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,10 @@ export class ChannelStartupService {
335335
};
336336

337337
if (query.offset) contactFindManyArgs.take = query.offset;
338-
if (query.page) contactFindManyArgs.skip = query.offset * ((query.page as number) - 1);
338+
if (query.page) {
339+
const validPage = Math.max(query.page as number, 1);
340+
contactFindManyArgs.skip = query.offset * (validPage - 1);
341+
}
339342

340343
return await this.prismaRepository.contact.findMany(contactFindManyArgs);
341344
}

0 commit comments

Comments
 (0)