up
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-26 11:35:11 +03:30
parent cb71f0d77c
commit 841406ad84
7 changed files with 16 additions and 54 deletions
+1 -10
View File
@@ -1,4 +1,4 @@
import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common';
import { Injectable, NotFoundException } from '@nestjs/common';
import { EntityManager } from '@mikro-orm/postgresql';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { CreateRequestDto } from './dto/create-request.dto';
@@ -6,7 +6,6 @@ import { UpdateRequestDto } from './dto/update-request.dto';
import { FindRequestsDto } from './dto/find-requests.dto';
import { Request } from './entities/request.entity';
import { RequestItem } from './entities/request-item.entity';
import { RequestStatusEnum } from './enum/request';
import { UserService } from '../user/providers/user.service';
import { ProductService } from '../product/providers/product.service';
import { FieldRepository } from '../form-builder/repository/field.repository';
@@ -32,7 +31,6 @@ export class RequestService {
const request = await this.em.transactional(async (em) => {
const request = em.create(Request, {
user,
status: RequestStatusEnum.PENDING,
});
em.persist(request);
@@ -134,10 +132,6 @@ export class RequestService {
throw new NotFoundException('Request not found');
}
if (request.status !== RequestStatusEnum.PENDING) {
throw new BadRequestException('Only pending requests can be updated');
}
const { items } = updateRequestDto;
if (items?.length) {
return this.em.transactional(async (em) => {
@@ -208,9 +202,6 @@ export class RequestService {
if (!request) {
throw new NotFoundException('Request not found');
}
if (request.status !== RequestStatusEnum.PENDING) {
throw new BadRequestException('Only pending requests can be deleted');
}
request.deletedAt = new Date();
await this.em.flush();
return request;