Migrate InviteOneAcceptView and QuickActionBvcBeginView to Enhanced Triple Migration Pattern

- Complete database migration from databaseUtil to PlatformServiceMixin
- Migrate all notifications to helper methods + centralized constants
- Extract inline template handlers to documented methods
- Add comprehensive logging and error handling
- Add migration documentation for InviteOneAcceptView
This commit is contained in:
Matthew Raymer
2025-07-09 03:59:37 +00:00
parent 4f92656b7f
commit 6210a088dd
4 changed files with 248 additions and 95 deletions

View File

@@ -43,23 +43,11 @@
</div>
</div>
<div
v-if="canSubmit"
class="flex justify-center mt-4"
>
<button
:class="activeButtonClass"
@click="record()"
>
Sign & Send
</button>
<div v-if="canSubmit" class="flex justify-center mt-4">
<button :class="activeButtonClass" @click="record()">Sign & Send</button>
</div>
<div v-else class="flex justify-center mt-4">
<button
:class="disabledButtonClass"
>
Select Your Actions
</button>
<button :class="disabledButtonClass">Select Your Actions</button>
</div>
</section>
</template>
@@ -112,7 +100,7 @@ export default class QuickActionBvcBeginView extends Vue {
// Notification helper system
private notify = createNotifyHelpers(this.$notify);
attended = true;
gaveTime = true;
hoursStr = "1";
@@ -123,8 +111,10 @@ export default class QuickActionBvcBeginView extends Vue {
* Uses America/Denver timezone for Bountiful location
*/
async mounted() {
logger.debug("[QuickActionBvcBeginView] Mounted - calculating meeting date");
logger.debug(
"[QuickActionBvcBeginView] Mounted - calculating meeting date",
);
// use the time zone for Bountiful
let currentOrPreviousSat = DateTime.now().setZone("America/Denver");
if (currentOrPreviousSat.weekday < 6) {
@@ -142,10 +132,10 @@ export default class QuickActionBvcBeginView extends Vue {
eventStartDateObj.toISO({
suppressMilliseconds: true,
}) || "";
logger.debug(
"[QuickActionBvcBeginView] Meeting date calculated:",
this.todayOrPreviousStartDate
this.todayOrPreviousStartDate,
);
}
@@ -154,40 +144,46 @@ export default class QuickActionBvcBeginView extends Vue {
* Creates claims for both attendance and time if applicable
*/
async record() {
logger.debug("[QuickActionBvcBeginView] Recording BVC meeting participation");
logger.debug(
"[QuickActionBvcBeginView] Recording BVC meeting participation",
);
// Get account settings using PlatformServiceMixin
const settings = await this.$accountSettings();
const activeDid = settings.activeDid || "";
const apiServer = settings.apiServer || "";
if (!activeDid || !apiServer) {
logger.error(
"[QuickActionBvcBeginView] Missing required settings:",
{ activeDid: !!activeDid, apiServer: !!apiServer }
);
logger.error("[QuickActionBvcBeginView] Missing required settings:", {
activeDid: !!activeDid,
apiServer: !!apiServer,
});
return;
}
try {
const hoursNum = libsUtil.numberOrZero(this.hoursStr);
logger.debug(
"[QuickActionBvcBeginView] Processing submission:",
{ attended: this.attended, gaveTime: this.gaveTime, hours: hoursNum }
);
logger.debug("[QuickActionBvcBeginView] Processing submission:", {
attended: this.attended,
gaveTime: this.gaveTime,
hours: hoursNum,
});
// Use notification helper with proper timeout
this.notify.toast(NOTIFY_BVC_PROCESSING.title, NOTIFY_BVC_PROCESSING.message, TIMEOUTS.BRIEF);
this.notify.toast(
NOTIFY_BVC_PROCESSING.title,
NOTIFY_BVC_PROCESSING.message,
TIMEOUTS.BRIEF,
);
// first send the claim for time given
let timeSuccess = false;
if (this.gaveTime && hoursNum > 0) {
logger.debug(
"[QuickActionBvcBeginView] Submitting time gift:",
{ hours: hoursNum }
);
logger.debug("[QuickActionBvcBeginView] Submitting time gift:", {
hours: hoursNum,
});
const timeResult = await createAndSubmitGive(
axios,
apiServer,
@@ -199,15 +195,20 @@ export default class QuickActionBvcBeginView extends Vue {
"HUR",
BVC_MEETUPS_PROJECT_CLAIM_ID,
);
if (timeResult.success) {
timeSuccess = true;
logger.debug("[QuickActionBvcBeginView] Time gift submission successful");
logger.debug(
"[QuickActionBvcBeginView] Time gift submission successful",
);
} else {
logger.error("[QuickActionBvcBeginView] Error sending time:", timeResult);
logger.error(
"[QuickActionBvcBeginView] Error sending time:",
timeResult,
);
this.notify.error(
timeResult?.error || NOTIFY_BVC_TIME_ERROR.message,
TIMEOUTS.LONG
TIMEOUTS.LONG,
);
}
}
@@ -216,34 +217,42 @@ export default class QuickActionBvcBeginView extends Vue {
let attendedSuccess = false;
if (this.attended) {
logger.debug("[QuickActionBvcBeginView] Submitting attendance claim");
const attendResult = await createAndSubmitClaim(
bvcMeetingJoinClaim(activeDid, this.todayOrPreviousStartDate),
activeDid,
apiServer,
axios,
);
if (attendResult.success) {
attendedSuccess = true;
logger.debug("[QuickActionBvcBeginView] Attendance claim submission successful");
logger.debug(
"[QuickActionBvcBeginView] Attendance claim submission successful",
);
} else {
logger.error("[QuickActionBvcBeginView] Error sending attendance:", attendResult);
logger.error(
"[QuickActionBvcBeginView] Error sending attendance:",
attendResult,
);
this.notify.error(
attendResult?.error || NOTIFY_BVC_ATTENDANCE_ERROR.message,
TIMEOUTS.LONG
TIMEOUTS.LONG,
);
}
}
if (timeSuccess || attendedSuccess) {
const successMessage = createBvcSuccessMessage(timeSuccess, attendedSuccess);
const successMessage = createBvcSuccessMessage(
timeSuccess,
attendedSuccess,
);
logger.debug(
"[QuickActionBvcBeginView] Submission completed successfully:",
{ timeSuccess, attendedSuccess }
{ timeSuccess, attendedSuccess },
);
this.notify.success(successMessage, TIMEOUTS.STANDARD);
this.$router.push({ path: "/quick-action-bvc" });
}
@@ -253,7 +262,7 @@ export default class QuickActionBvcBeginView extends Vue {
logger.error("[QuickActionBvcBeginView] Error sending claims:", error);
this.notify.error(
error.userMessage || NOTIFY_BVC_SUBMISSION_ERROR.message,
TIMEOUTS.LONG
TIMEOUTS.LONG,
);
}
}
@@ -284,7 +293,9 @@ export default class QuickActionBvcBeginView extends Vue {
* Returns true if user has attended or provided valid time contribution
*/
get canSubmit() {
return this.attended || (this.gaveTime && this.hoursStr && this.hoursStr !== '0');
return (
this.attended || (this.gaveTime && this.hoursStr && this.hoursStr !== "0")
);
}
}
</script>