690322:2123 Fixing Deployment Errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.1",
|
||||
"packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be",
|
||||
"description": "<p align=\"center\">\r <a href=\"http://nestjs.com/\" target=\"blank\"><img src=\"https://nestjs.com/img/logo-small.svg\" width=\"120\" alt=\"Nest Logo\" /></a>\r </p>",
|
||||
"author": "",
|
||||
|
||||
@@ -78,7 +78,7 @@ export class AuthService {
|
||||
derivedRole = 'DC';
|
||||
}
|
||||
}
|
||||
const { password, ...result } = user;
|
||||
const { password: _password, ...result } = user;
|
||||
return { ...result, role: derivedRole } as User & { role: string };
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -10,14 +10,9 @@ async function runSeeds() {
|
||||
await dataSource.initialize();
|
||||
|
||||
try {
|
||||
// console.log('🌱 Seeding database...');
|
||||
|
||||
await seedOrganizations(dataSource);
|
||||
await seedUsers(dataSource);
|
||||
|
||||
// console.log('✅ Seeding completed!');
|
||||
} catch (_error) {
|
||||
// console.error('❌ Seeding failed:', _error);
|
||||
} finally {
|
||||
await dataSource.destroy();
|
||||
}
|
||||
|
||||
@@ -130,14 +130,9 @@ export const seedWorkflowDefinitions = async (dataSource: DataSource) => {
|
||||
is_active: true,
|
||||
})
|
||||
);
|
||||
// console.log(`✅ Seeded Workflow: ${dsl.workflow} v${dsl.version}`);
|
||||
} catch (_error) {
|
||||
// console.error(`❌ Failed to seed workflow ${dsl.workflow}:`, _error);
|
||||
}
|
||||
} else {
|
||||
// console.log(
|
||||
// `⏭️ Workflow already exists: ${dsl.workflow} v${dsl.version}`
|
||||
// );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
ApiTags,
|
||||
ApiOperation,
|
||||
ApiBearerAuth,
|
||||
ApiQuery,
|
||||
} from '@nestjs/swagger';
|
||||
import { ContractService } from './contract.service.js';
|
||||
import { CreateContractDto } from './dto/create-contract.dto.js';
|
||||
|
||||
@@ -26,7 +26,6 @@ import { CreateCorrespondenceDto } from './dto/create-correspondence.dto';
|
||||
import { UpdateCorrespondenceDto } from './dto/update-correspondence.dto';
|
||||
import { AddReferenceDto } from './dto/add-reference.dto';
|
||||
import { SearchCorrespondenceDto } from './dto/search-correspondence.dto';
|
||||
import { DeepPartial } from 'typeorm';
|
||||
|
||||
// Services
|
||||
import { DocumentNumberingService } from '../document-numbering/services/document-numbering.service';
|
||||
@@ -506,7 +505,7 @@ export class CorrespondenceService {
|
||||
: undefined;
|
||||
|
||||
// 3. Update Correspondence Entity if needed
|
||||
const correspondenceUpdate: any = {};
|
||||
const correspondenceUpdate: Record<string, unknown> = {};
|
||||
if (updateDto.disciplineId)
|
||||
correspondenceUpdate.disciplineId = updateDto.disciplineId;
|
||||
if (updResolvedProjectId)
|
||||
@@ -519,7 +518,7 @@ export class CorrespondenceService {
|
||||
}
|
||||
|
||||
// 4. Update Revision Entity
|
||||
const revisionUpdate: any = {};
|
||||
const revisionUpdate: Record<string, unknown> = {};
|
||||
if (updateDto.subject) revisionUpdate.subject = updateDto.subject;
|
||||
if (updateDto.body) revisionUpdate.body = updateDto.body;
|
||||
if (updateDto.remarks) revisionUpdate.remarks = updateDto.remarks;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { Entity, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { Correspondence } from './correspondence.entity';
|
||||
import { Organization } from '../../organization/entities/organization.entity';
|
||||
|
||||
|
||||
@@ -116,10 +116,6 @@ export class DocumentNumberingController {
|
||||
year: dto.year,
|
||||
customTokens: dto.customTokens,
|
||||
});
|
||||
// console.log(
|
||||
// '[DocumentNumberingController] Preview result:',
|
||||
// JSON.stringify(result)
|
||||
// );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,9 +51,6 @@ export class FormatService {
|
||||
tokens,
|
||||
options.sequence
|
||||
);
|
||||
// console.log(
|
||||
// `[FormatService] Generated: "${previewNumber}" | Template: "${template}" | isDefault: ${isDefault}`
|
||||
// );
|
||||
return { previewNumber, isDefault };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Counter, Gauge, Histogram } from 'prom-client';
|
||||
import { InjectMetric } from '@willsoto/nestjs-prometheus';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger, NotFoundException } from '@nestjs/common';
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { DocumentNumberFormat } from '../entities/document-number-format.entity';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsString, IsNotEmpty, IsOptional, IsInt } from 'class-validator';
|
||||
import { IsString, IsNotEmpty, IsOptional } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class CreateTagDto {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsInt, IsString, IsNotEmpty, IsOptional } from 'class-validator';
|
||||
import { IsInt, IsString, IsNotEmpty } from 'class-validator';
|
||||
|
||||
export class SaveNumberFormatDto {
|
||||
@IsInt()
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Body,
|
||||
Patch,
|
||||
Param,
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
IsOptional,
|
||||
IsEnum,
|
||||
IsNotEmpty,
|
||||
IsUrl,
|
||||
} from 'class-validator';
|
||||
import { NotificationType } from '../entities/notification.entity';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Cron, CronExpression } from '@nestjs/schedule';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, LessThan } from 'typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Notification } from './entities/notification.entity';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -72,9 +72,6 @@ export class OrganizationService {
|
||||
|
||||
const [data, total] = await queryBuilder.getManyAndCount();
|
||||
|
||||
// Debug logging
|
||||
// console.log(`[OrganizationService] Found ${total} organizations`);
|
||||
|
||||
return {
|
||||
data,
|
||||
meta: {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
Logger,
|
||||
} from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, Like } from 'typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
// Entities
|
||||
import { Project } from './entities/project.entity';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsInt, IsNotEmpty, IsOptional, ValidateIf } from 'class-validator';
|
||||
import { IsInt, IsNotEmpty, IsOptional } from 'class-validator';
|
||||
|
||||
export class AssignRoleDto {
|
||||
@IsInt()
|
||||
|
||||
@@ -13,14 +13,12 @@ async function migrateStorage() {
|
||||
await dataSource.initialize();
|
||||
|
||||
try {
|
||||
// console.log('🚀 Starting Storage Migration v2...');
|
||||
const attachmentRepo = dataSource.getRepository(Attachment);
|
||||
|
||||
// Find all permanent attachments
|
||||
const attachments = await attachmentRepo.find({
|
||||
where: { isTemporary: false },
|
||||
});
|
||||
// console.log(`Found ${attachments.length} permanent attachments.`);
|
||||
|
||||
let _movedCount = 0;
|
||||
let _errorCount = 0;
|
||||
@@ -32,8 +30,6 @@ async function migrateStorage() {
|
||||
process.env.UPLOAD_PERMANENT_DIR ||
|
||||
path.join(process.cwd(), 'uploads', 'permanent');
|
||||
|
||||
// console.log(`Target Permanent Directory: ${permanentBaseDir}`);
|
||||
|
||||
if (!fs.existsSync(permanentBaseDir)) {
|
||||
// console.warn(
|
||||
// `Base directory not found: ${permanentBaseDir}. Creating it...`
|
||||
@@ -49,7 +45,6 @@ async function migrateStorage() {
|
||||
|
||||
const currentPath = att.filePath;
|
||||
if (!fs.existsSync(currentPath)) {
|
||||
// console.warn(`File not found on disk: ${currentPath} (ID: ${att.id})`);
|
||||
_errorCount++;
|
||||
continue;
|
||||
}
|
||||
@@ -67,7 +62,6 @@ async function migrateStorage() {
|
||||
? new Date(att.referenceDate)
|
||||
: new Date(att.createdAt);
|
||||
if (isNaN(refDate.getTime())) {
|
||||
// console.warn(`Invalid date for ID ${att.id}, skipping.`);
|
||||
_errorCount++;
|
||||
continue;
|
||||
}
|
||||
@@ -97,22 +91,11 @@ async function migrateStorage() {
|
||||
}
|
||||
await attachmentRepo.save(att);
|
||||
_movedCount++;
|
||||
// if (movedCount % 100 === 0) console.log(`Moved ${movedCount} files...`);
|
||||
} catch (_err: unknown) {
|
||||
// console.error(
|
||||
// `Failed to move file ID ${att.id}:`,
|
||||
// (err as Error).message
|
||||
// );
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(`Migration completed.`);
|
||||
// console.log(`Moved: ${movedCount}`);
|
||||
// console.log(`Skipped: ${skippedCount}`);
|
||||
// console.log(`Errors: ${errorCount}`);
|
||||
} catch (_error) {
|
||||
// console.error('Migration failed:', error);
|
||||
} finally {
|
||||
await dataSource.destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user