Initial Mento CRM: portal OTP, reports, SMS, and deploy for crm.montzar.ir.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 21:06:30 +03:30
co-authored by Cursor
commit 29a040c21d
195 changed files with 39430 additions and 0 deletions
+136
View File
@@ -0,0 +1,136 @@
import {
Body,
Controller,
Delete,
Get,
Param,
Patch,
Post,
Query,
UseGuards,
} from '@nestjs/common';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { CurrentUser } from '../auth/current-user.decorator';
import {
CreateTicketDto,
CreateTicketMessageDto,
ListTicketsQueryDto,
UpdateTicketDto,
} from './dto';
import { TicketsService } from './tickets.service';
@Controller('tickets')
@UseGuards(JwtAuthGuard)
export class TicketsController {
constructor(private readonly ticketsService: TicketsService) {}
@Get()
list(
@CurrentUser()
user: { userId: string; organizationId: string; role: string },
@Query() query: ListTicketsQueryDto,
) {
return this.ticketsService.list(
{
userId: user.userId,
organizationId: user.organizationId,
role: user.role,
},
{
q: query.q,
status: query.status,
priority: query.priority,
personId: query.personId,
assigneeId: query.assigneeId,
sla: query.sla,
page: query.page ?? 1,
limit: query.limit ?? 50,
},
);
}
@Get(':id')
get(
@CurrentUser()
user: { userId: string; organizationId: string; role: string },
@Param('id') id: string,
) {
return this.ticketsService.get(
{
userId: user.userId,
organizationId: user.organizationId,
role: user.role,
},
id,
);
}
@Post()
create(
@CurrentUser()
user: { userId: string; organizationId: string; role: string },
@Body() dto: CreateTicketDto,
) {
return this.ticketsService.create(
{
userId: user.userId,
organizationId: user.organizationId,
role: user.role,
},
dto,
);
}
@Patch(':id')
update(
@CurrentUser()
user: { userId: string; organizationId: string; role: string },
@Param('id') id: string,
@Body() dto: UpdateTicketDto,
) {
return this.ticketsService.update(
{
userId: user.userId,
organizationId: user.organizationId,
role: user.role,
},
id,
dto,
);
}
@Delete(':id')
async remove(
@CurrentUser()
user: { userId: string; organizationId: string; role: string },
@Param('id') id: string,
) {
await this.ticketsService.remove(
{
userId: user.userId,
organizationId: user.organizationId,
role: user.role,
},
id,
);
return { ok: true };
}
@Post(':id/messages')
addMessage(
@CurrentUser()
user: { userId: string; organizationId: string; role: string },
@Param('id') id: string,
@Body() dto: CreateTicketMessageDto,
) {
return this.ticketsService.addMessage(
{
userId: user.userId,
organizationId: user.organizationId,
role: user.role,
},
id,
dto,
);
}
}