feature/IO-3205-Paint-Scale-Integrations: Code Review Revisions

This commit is contained in:
Dave Richer
2025-04-30 14:39:11 -04:00
parent 0e352e007a
commit b0356d63e0
3 changed files with 4 additions and 4 deletions

View File

@@ -53,7 +53,8 @@ export async function ppgInputHandler(config: PaintScaleConfig): Promise<void> {
await parseStringPromise(xmlContent);
} catch (error) {
log.error(`Invalid XML in ${filePath}:`, error);
const errorPath = path.join(errorDir, path.basename(filePath));
const timestamp = Date.now().toString(); // similar to DateTime.Now.Ticks in C#
const errorPath = path.join(errorDir, `${timestamp}.xml`);
await fs.rename(filePath, errorPath);
log.debug(`Moved invalid file to error: ${errorPath}`);
continue;
@@ -92,7 +93,8 @@ export async function ppgInputHandler(config: PaintScaleConfig): Promise<void> {
if (response.status === 200) {
log.info(`Successful upload of ${filePath}`);
// Move file to archive
const archivePath = path.join(archiveDir, path.basename(filePath));
const timestamp = Date.now().toString(); // generate new timestamp
const archivePath = path.join(archiveDir, `${timestamp}.xml`);
await fs.rename(filePath, archivePath);
log.debug(`Moved file to archive: ${archivePath}`);
} else {