This commit is contained in:
Viktoria Polyakova
2026-01-25 08:57:38 +00:00
commit 4fb101c5db
7657 changed files with 497012 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsNumber, IsOptional } from 'class-validator';
import { PagingDefault } from '../../constants';
export class ChatPagingQuery {
@ApiPropertyOptional({ description: 'Offset', example: 0 })
@IsOptional()
@IsNumber()
offset?: number;
@ApiPropertyOptional({ description: 'Limit', example: 10 })
@IsOptional()
@IsNumber()
limit?: number;
@ApiPropertyOptional({ description: 'Cursor position for pagination' })
@IsOptional()
@IsNumber()
cursor?: number;
constructor(offset: number | undefined, limit: number | undefined, cursor: number | undefined) {
this.offset = offset;
this.limit = limit;
this.cursor = cursor;
}
static default(): ChatPagingQuery {
return new ChatPagingQuery(undefined, undefined, undefined);
}
get skip(): number {
return this.offset ?? PagingDefault.offset;
}
get take(): number {
return this.limit ?? PagingDefault.limit;
}
}