Browse Source

Migrate ContactQRScan views to use mixin parseJsonField

Replace databaseUtil parseJsonField imports with PlatformServiceMixin
_parseJsonField method in ContactQRScanFullView.vue and ContactQRScanShowView.vue.
Use type assertion for mixin method access. Maintains functionality while
removing static databaseUtil dependency.
pull/142/head
Matthew Raymer 3 weeks ago
parent
commit
9558124f87
  1. 2
      doc/migration-progress-tracker.md
  2. 4
      src/views/ContactQRScanFullView.vue
  3. 3
      src/views/ContactQRScanShowView.vue

2
doc/migration-progress-tracker.md

@ -223,7 +223,7 @@ export default class ComponentName extends Vue {
**Progress**: 1/4 (25%) **Progress**: 1/4 (25%)
- [ ] LogCollector.ts - [ ] LogCollector.ts
- [ ] util.ts - [x] util.ts ✅ MIGRATED 2024-12-19 (no migration needed, utility module decoupled from Vue, reviewed and confirmed)
- [x] test/index.ts ✅ MIGRATED 2024-12-19 (5 min, database migration with dynamic import pattern, enhanced documentation) - [x] test/index.ts ✅ MIGRATED 2024-12-19 (5 min, database migration with dynamic import pattern, enhanced documentation)
- [ ] PlatformServiceMixin.ts (remove circular dependency) - [ ] PlatformServiceMixin.ts (remove circular dependency)

4
src/views/ContactQRScanFullView.vue

@ -121,7 +121,7 @@ import {
} from "../libs/endorserServer"; } from "../libs/endorserServer";
import UserNameDialog from "../components/UserNameDialog.vue"; import UserNameDialog from "../components/UserNameDialog.vue";
import { retrieveAccountMetadata } from "../libs/util"; import { retrieveAccountMetadata } from "../libs/util";
import { parseJsonField } from "../db/databaseUtil";
import { Account } from "@/db/tables/accounts"; import { Account } from "@/db/tables/accounts";
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
import { import {
@ -556,7 +556,7 @@ export default class ContactQRScanFull extends Vue {
// Add new contact // Add new contact
// @ts-expect-error because we're just using the value to store to the DB // @ts-expect-error because we're just using the value to store to the DB
contact.contactMethods = JSON.stringify( contact.contactMethods = JSON.stringify(
parseJsonField(contact.contactMethods, []), (this as any)._parseJsonField(contact.contactMethods, []),
); );
await this.$insertContact(contact); await this.$insertContact(contact);

3
src/views/ContactQRScanShowView.vue

@ -147,7 +147,6 @@ import QuickNav from "../components/QuickNav.vue";
import UserNameDialog from "../components/UserNameDialog.vue"; import UserNameDialog from "../components/UserNameDialog.vue";
import { NotificationIface } from "../constants/app"; import { NotificationIface } from "../constants/app";
import { Contact } from "../db/tables/contacts"; import { Contact } from "../db/tables/contacts";
import { parseJsonField } from "../db/databaseUtil";
import { getContactJwtFromJwtUrl } from "../libs/crypto"; import { getContactJwtFromJwtUrl } from "../libs/crypto";
import { import {
CONTACT_CSV_HEADER, CONTACT_CSV_HEADER,
@ -705,7 +704,7 @@ export default class ContactQRScanShow extends Vue {
// Add new contact // Add new contact
// @ts-expect-error because we're just using the value to store to the DB // @ts-expect-error because we're just using the value to store to the DB
contact.contactMethods = JSON.stringify( contact.contactMethods = JSON.stringify(
parseJsonField(contact.contactMethods, []), (this as any)._parseJsonField(contact.contactMethods, []),
); );
await this.$insertContact(contact); await this.$insertContact(contact);

Loading…
Cancel
Save