260322:1648 Correct Coresspondence / Doing RFA / Correct CI
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsEnum,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
import { IsInt, IsOptional, IsString, IsEnum, IsUUID } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { TransmittalPurpose } from './create-transmittal.dto';
|
||||
|
||||
|
||||
@@ -15,7 +15,12 @@ import { RbacGuard } from '../../common/guards/rbac.guard';
|
||||
import { RequirePermission } from '../../common/decorators/require-permission.decorator';
|
||||
import { User } from '../user/entities/user.entity';
|
||||
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiParam } from '@nestjs/swagger';
|
||||
import {
|
||||
ApiTags,
|
||||
ApiOperation,
|
||||
ApiBearerAuth,
|
||||
ApiParam,
|
||||
} from '@nestjs/swagger';
|
||||
import { ParseUuidPipe } from '../../common/pipes/parse-uuid.pipe';
|
||||
import { ProjectService } from '../project/project.service';
|
||||
|
||||
@@ -55,7 +60,10 @@ export class TransmittalController {
|
||||
|
||||
@Get(':uuid')
|
||||
@ApiOperation({ summary: 'Get Transmittal details' })
|
||||
@ApiParam({ name: 'uuid', description: 'Transmittal UUID (from correspondences.uuid)' })
|
||||
@ApiParam({
|
||||
name: 'uuid',
|
||||
description: 'Transmittal UUID (from correspondences.uuid)',
|
||||
})
|
||||
@RequirePermission('document.view')
|
||||
findOne(@Param('uuid', ParseUuidPipe) uuid: string) {
|
||||
return this.transmittalService.findOneByUuid(uuid);
|
||||
|
||||
@@ -41,7 +41,10 @@ export class TransmittalService {
|
||||
private uuidResolver: UuidResolverService
|
||||
) {}
|
||||
|
||||
async create(createDto: CreateTransmittalDto, user: User) {
|
||||
async create(
|
||||
createDto: CreateTransmittalDto,
|
||||
user: User
|
||||
): Promise<Transmittal & { correspondence: Correspondence }> {
|
||||
// 1. Get Transmittal Type (Assuming Code '901' or 'TRN')
|
||||
const type = await this.typeRepo.findOne({
|
||||
where: { typeCode: 'TRN' }, // Adjust code as per Master Data
|
||||
@@ -144,7 +147,7 @@ export class TransmittalService {
|
||||
...savedTransmittal,
|
||||
correspondence: savedCorr,
|
||||
};
|
||||
} catch (err) {
|
||||
} catch (err: unknown) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
this.logger.error(
|
||||
`Failed to create transmittal: ${(err as Error).message}`
|
||||
@@ -159,7 +162,7 @@ export class TransmittalService {
|
||||
* ADR-019: Find Transmittal by parent Correspondence UUID (public identifier).
|
||||
* Resolves correspondence.uuid → internal correspondenceId (INT)
|
||||
*/
|
||||
async findOneByUuid(uuid: string) {
|
||||
async findOneByUuid(uuid: string): Promise<Transmittal> {
|
||||
const correspondence = await this.dataSource.manager.findOne(
|
||||
Correspondence,
|
||||
{ where: { uuid }, select: ['id'] }
|
||||
@@ -167,9 +170,10 @@ export class TransmittalService {
|
||||
if (!correspondence) {
|
||||
throw new NotFoundException(`Transmittal with UUID ${uuid} not found`);
|
||||
}
|
||||
return this.findOne(correspondence.id);
|
||||
}
|
||||
|
||||
async findOne(id: number) {
|
||||
async findOne(id: number): Promise<Transmittal> {
|
||||
const transmittal = await this.transmittalRepo.findOne({
|
||||
where: { correspondenceId: id },
|
||||
relations: ['correspondence', 'correspondence.revisions', 'items'],
|
||||
|
||||
Reference in New Issue
Block a user