forked from trent_larson/crowd-funder-for-time-pwa
Migrate LogView.vue to PlatformServiceMixin with architectural compliance
Achieve total architectural compliance by eliminating both legacy database utilities and direct SQL queries from LogView.vue component. **Component Changes (LogView.vue):** - Replace databaseUtil.memoryLogs with this.$memoryLogs - Replace direct SQL query with this.$logs() abstraction - Remove PlatformServiceFactory and databaseUtil imports - Add PlatformServiceMixin to component mixins - Reduce component from database-aware to pure presentation layer **Mixin Enhancements (PlatformServiceMixin.ts):** - Add $memoryLogs computed property for memory logs access - Add $logs() method for abstracted database log retrieval - Update TypeScript interfaces (IPlatformServiceMixin, ComponentCustomProperties) - Enable components to access logs without SQL knowledge **Documentation:** - Add docs/migration-testing/TESTING_LOGVIEW.md - Quick testing guide - Add docs/migration-testing/migration-checklist-LogView.md - Comprehensive checklist - Document architectural compliance achievements and testing requirements **Architectural Benefits:** - Zero databaseUtil imports in LogView.vue - Zero direct SQL queries in component layer - Proper separation of concerns (View → Service → Database) - Reusable $logs() method for other components - Sets gold standard for future migrations **Migration Progress:** - Components using PlatformServiceMixin: 14/91 (15%) - LogView.vue achieves total architectural compliance - Reduces legacy databaseUtil imports from 52 to 51 **Testing:** Ready for testing at /logs route **Backwards Compatible:** Yes - no functional changes to end users
This commit is contained in:
@@ -59,8 +59,7 @@ import { Router } from "vue-router";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import TopMessage from "../components/TopMessage.vue";
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import { PlatformServiceMixin } from "../utils/PlatformServiceMixin";
|
||||
|
||||
interface Log {
|
||||
date: string;
|
||||
@@ -72,6 +71,7 @@ interface Log {
|
||||
QuickNav,
|
||||
TopMessage,
|
||||
},
|
||||
mixins: [PlatformServiceMixin],
|
||||
})
|
||||
export default class LogView extends Vue {
|
||||
$router!: Router;
|
||||
@@ -88,15 +88,8 @@ export default class LogView extends Vue {
|
||||
async loadLogs() {
|
||||
try {
|
||||
this.error = null; // Clear any previous errors
|
||||
this.memoryLogs = databaseUtil.memoryLogs;
|
||||
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const queryResult = await platformService.dbQuery(
|
||||
"SELECT * FROM logs ORDER BY date DESC",
|
||||
);
|
||||
this.logs = databaseUtil.mapQueryResultToValues(
|
||||
queryResult,
|
||||
) as unknown as Log[];
|
||||
this.memoryLogs = this.$memoryLogs;
|
||||
this.logs = (await this.$logs()) as unknown as Log[];
|
||||
} catch (error) {
|
||||
logger.error("Error loading logs:", error);
|
||||
this.error =
|
||||
|
||||
Reference in New Issue
Block a user