260316:1352 Refactor to NestJS 11 #3
Build and Deploy / deploy (push) Failing after 5m15s

This commit is contained in:
admin
2026-03-16 13:52:19 +07:00
parent f13861f02e
commit 61145011d1
+26 -10
View File
@@ -73,7 +73,8 @@ export class MasterService {
where: { uuid: projectId as string }, where: { uuid: projectId as string },
select: ['id'], select: ['id'],
}); });
if (!project) throw new NotFoundException(`Project with UUID ${projectId} not found`); if (!project)
throw new NotFoundException(`Project with UUID ${projectId} not found`);
return project.id; return project.id;
} }
@@ -88,7 +89,8 @@ export class MasterService {
where: { uuid: contractId as string }, where: { uuid: contractId as string },
select: ['id'], select: ['id'],
}); });
if (!contract) throw new NotFoundException(`Contract with UUID ${contractId} not found`); if (!contract)
throw new NotFoundException(`Contract with UUID ${contractId} not found`);
return contract.id; return contract.id;
} }
@@ -136,7 +138,10 @@ export class MasterService {
async createRfaType(dto: any) { async createRfaType(dto: any) {
const internalContractId = await this.resolveContractId(dto.contractId); const internalContractId = await this.resolveContractId(dto.contractId);
const rfaType = this.rfaTypeRepo.create({ ...dto, contractId: internalContractId }); const rfaType = this.rfaTypeRepo.create({
...dto,
contractId: internalContractId,
});
return this.rfaTypeRepo.save(rfaType); return this.rfaTypeRepo.save(rfaType);
} }
@@ -197,14 +202,20 @@ export class MasterService {
async createDiscipline(dto: any) { async createDiscipline(dto: any) {
const internalContractId = await this.resolveContractId(dto.contractId); const internalContractId = await this.resolveContractId(dto.contractId);
const exists = await this.disciplineRepo.findOne({ const exists = await this.disciplineRepo.findOne({
where: { contractId: internalContractId, disciplineCode: dto.disciplineCode }, where: {
contractId: internalContractId,
disciplineCode: dto.disciplineCode,
},
}); });
if (exists) if (exists)
throw new ConflictException( throw new ConflictException(
'Discipline code already exists in this contract' 'Discipline code already exists in this contract'
); );
const discipline = this.disciplineRepo.create({ ...dto, contractId: internalContractId }); const discipline = this.disciplineRepo.create({
...dto,
contractId: internalContractId,
});
return this.disciplineRepo.save(discipline); return this.disciplineRepo.save(discipline);
} }
@@ -237,7 +248,10 @@ export class MasterService {
async createSubType(dto: any) { async createSubType(dto: any) {
const internalContractId = await this.resolveContractId(dto.contractId); const internalContractId = await this.resolveContractId(dto.contractId);
const subType = this.subTypeRepo.create({ ...dto, contractId: internalContractId }); const subType = this.subTypeRepo.create({
...dto,
contractId: internalContractId,
});
return this.subTypeRepo.save(subType); return this.subTypeRepo.save(subType);
} }
@@ -262,7 +276,7 @@ export class MasterService {
async saveNumberFormat(dto: any) { async saveNumberFormat(dto: any) {
const internalProjectId = await this.resolveProjectId(dto.projectId); const internalProjectId = await this.resolveProjectId(dto.projectId);
let format = await this.formatRepo.findOne({ let format: DocumentNumberFormat | null = await this.formatRepo.findOne({
where: { where: {
projectId: internalProjectId, projectId: internalProjectId,
correspondenceTypeId: dto.correspondenceTypeId, correspondenceTypeId: dto.correspondenceTypeId,
@@ -275,10 +289,10 @@ export class MasterService {
format = this.formatRepo.create({ format = this.formatRepo.create({
...dto, ...dto,
projectId: internalProjectId, projectId: internalProjectId,
}); } as Partial<DocumentNumberFormat>);
} }
return this.formatRepo.save(format); return this.formatRepo.save(format!);
} }
async findAllTags(query?: SearchTagDto) { async findAllTags(query?: SearchTagDto) {
@@ -321,7 +335,9 @@ export class MasterService {
} }
async createTag(dto: any, userId: number) { async createTag(dto: any, userId: number) {
const internalProjectId = dto.project_id ? await this.resolveProjectId(dto.project_id) : null; const internalProjectId = dto.project_id
? await this.resolveProjectId(dto.project_id)
: null;
const tag = this.tagRepo.create({ const tag = this.tagRepo.create({
...dto, ...dto,
project_id: internalProjectId, project_id: internalProjectId,