Updated Asset Entry and Views
This commit is contained in:
@@ -63,6 +63,14 @@ function hydrateAsset(id) {
|
||||
asset.tasks = all('SELECT * FROM tasks WHERE asset_id = ? ORDER BY due_date IS NULL, due_date', [id]);
|
||||
asset.warranties = all('SELECT id, provider, phone, start_date, expiration_date, warranty_limit, actual_usage, coverage_details, document_name, created_at FROM warranties WHERE asset_id = ?', [id]);
|
||||
asset.files = all('SELECT id, file_name, mime_type, size, uploaded_at FROM asset_files WHERE asset_id = ?', [id]);
|
||||
asset.notes_log = all(
|
||||
`SELECT n.id, n.body, n.created_at, u.name AS author
|
||||
FROM asset_notes n
|
||||
LEFT JOIN users u ON u.id = n.created_by
|
||||
WHERE n.asset_id = ?
|
||||
ORDER BY n.id DESC`,
|
||||
[id]
|
||||
);
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user