Skip to content

Commit 7ca0150

Browse files
committed
fix: logical composite id is upserted?
1 parent 3392d94 commit 7ca0150

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

app/Jobs/VerifyFiles.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function verifyFiles(TaskService $taskService, SubtitleScanner $subtitle
112112
$uuid = Str::uuid()->toString();
113113
$this->embedChain[] = new EmbedUidInMetadata($filePath, $uuid, $this->taskId, $video->id);
114114
} else {
115-
$uuid = $this->fileMetaData['tags']['uuid'] ?? $this->fileMetaData['tags']['uid']; // Neet to use UUID everywhere instead of mismatching uuid with uid
115+
$uuid = $this->fileMetaData['tags']['uuid'];
116116
dump("Found UUID {$uuid}");
117117
$video->update(['uuid' => $uuid]); // If embedding, video is updated in the embed job
118118
}
@@ -126,7 +126,6 @@ private function verifyFiles(TaskService $taskService, SubtitleScanner $subtitle
126126

127127
$stored = $metadata->toArray();
128128
$fileUpdated = ! is_null($metadata->date_scanned) && filemtime($filePath) > strtotime($metadata->date_scanned);
129-
unset($stored['logical_composite_id']);
130129

131130
if (is_null($metadata->uuid) || $fileUpdated) {
132131
$changes['uuid'] = $uuid;
@@ -284,8 +283,15 @@ private function verifyFiles(TaskService $taskService, SubtitleScanner $subtitle
284283
}
285284

286285
if (! empty($changes)) {
287-
$changes['date_scanned'] = date('Y-m-d h:i:s A');
288-
array_push($metadataTransactions, [...$stored, ...$changes]);
286+
$changes['date_scanned'] = date('Y-m-d h:i:s A'); // ??????????? this should be a unix date pls
287+
288+
unset(
289+
$stored['created_at'],
290+
$stored['updated_at'],
291+
$stored['logical_composite_id']
292+
);
293+
294+
$metadataTransactions[] = [...$stored, ...$changes];
289295
/**
290296
* DEBUG
291297
* dump(count([...$stored, ...$changes]));
@@ -312,7 +318,7 @@ private function verifyFiles(TaskService $taskService, SubtitleScanner $subtitle
312318

313319
Metadata::upsert(
314320
$metadataTransactions,
315-
'id',
321+
'uuid',
316322
[
317323
'video_id',
318324
'title',

0 commit comments

Comments
 (0)