feature/IO-3205-Paint-Scale-Integrations: Code Review Revisions
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user