Complete DIDView.vue triple migration and refactor template handlers

- Fix DIDView.vue notification migration: add missing NOTIFY_SERVER_ACCESS_ERROR and NOTIFY_NO_IDENTITY_ERROR imports
- Refactor 5 inline template handlers to proper class methods (goBack, toggleDidDetails, showLargeProfileImage, showLargeIdenticon, hideLargeImage)
- Update notification validation script to exclude createNotifyHelpers initialization patterns
- DIDView.vue now fully compliant: database migration + SQL abstraction + notification migration complete

Improves code organization, testability, and follows Vue.js best practices for template/class separation. All linting passes without errors.
This commit is contained in:
Matthew Raymer
2025-07-07 05:44:34 +00:00
parent 3d124e13bb
commit ea851a7dfd
9 changed files with 877 additions and 343 deletions

View File

@@ -913,6 +913,47 @@ export const PlatformServiceMixin = {
}));
},
/**
* Get single contact by DID - $getContact()
* Eliminates verbose single contact query patterns
* @param did Contact DID to retrieve
* @returns Promise<Contact | null> Contact object or null if not found
*/
async $getContact(did: string): Promise<Contact | null> {
const results = await this.$dbQuery(
"SELECT * FROM contacts WHERE did = ?",
[did],
);
if (!results || !results.values || results.values.length === 0) {
return null;
}
const contactData = this._mapColumnsToValues(
results.columns,
results.values,
);
return contactData.length > 0 ? (contactData[0] as Contact) : null;
},
/**
* Delete contact by DID - $deleteContact()
* Eliminates verbose contact deletion patterns
* @param did Contact DID to delete
* @returns Promise<boolean> Success status
*/
async $deleteContact(did: string): Promise<boolean> {
try {
await this.$dbExec("DELETE FROM contacts WHERE did = ?", [did]);
// Invalidate contacts cache
this._invalidateCache("contacts_all");
return true;
} catch (error) {
logger.error("[PlatformServiceMixin] Error deleting contact:", error);
return false;
}
},
/**
* Generic entity insertion - $insertEntity()
* Eliminates verbose INSERT patterns for any entity
@@ -1197,6 +1238,8 @@ export interface IPlatformServiceMixin {
$insertContact(contact: Partial<Contact>): Promise<boolean>;
$updateContact(did: string, changes: Partial<Contact>): Promise<boolean>;
$getAllContacts(): Promise<Contact[]>;
$getContact(did: string): Promise<Contact | null>;
$deleteContact(did: string): Promise<boolean>;
$contactCount(): Promise<number>;
$insertEntity(
tableName: string,
@@ -1316,6 +1359,8 @@ declare module "@vue/runtime-core" {
$insertContact(contact: Partial<Contact>): Promise<boolean>;
$updateContact(did: string, changes: Partial<Contact>): Promise<boolean>;
$getAllContacts(): Promise<Contact[]>;
$getContact(did: string): Promise<Contact | null>;
$deleteContact(did: string): Promise<boolean>;
$insertEntity(
tableName: string,
entity: Record<string, unknown>,