feat: add database and orm

This commit is contained in:
2026-10-21 10:14:50 +03:00
parent d8fb486709
commit ef2bc6f8b6
30 changed files with 668 additions and 354 deletions
+6 -6
View File
@@ -11,7 +11,7 @@ import {
import { AuthGuard } from '../common/auth/auth.guard';
import { CurrentUser } from '../common/auth/current-user.decorator';
import { parseLimit, rawCursorParam } from '../common/dto/pagination-query.dto';
import { User } from '../common/store/domain';
import { User } from '../common/domain';
import { CreateMessageDto } from './dto/create-message.dto';
import {
MessagePageResponse,
@@ -27,22 +27,22 @@ export class MessagesController {
@Post()
@HttpCode(201)
create(
async create(
@Param('chatId') chatId: string,
@Body() dto: CreateMessageDto,
@CurrentUser() user: User,
): MessageResponse {
const message = this.messages.create(chatId, user.id, dto.text);
): Promise<MessageResponse> {
const message = await this.messages.create(chatId, user.id, dto.text);
return toMessageResponse(message);
}
@Get()
list(
async list(
@Param('chatId') chatId: string,
@CurrentUser() user: User,
@Query('limit') limitRaw: unknown,
@Query('cursor') cursorRaw: unknown,
): MessagePageResponse {
): Promise<MessagePageResponse> {
const limit = parseLimit(limitRaw);
const cursor = rawCursorParam(cursorRaw);
return this.messages.list(chatId, user.id, limit, cursor);