feat: implement auto-sharing functionality for session creation across motivators, weekly check-ins, and year reviews, enhancing collaboration capabilities
This commit is contained in:
@@ -16,6 +16,16 @@ export async function createMotivatorSession(data: { title: string; participant:
|
||||
|
||||
try {
|
||||
const motivatorSession = await motivatorsService.createMotivatorSession(session.user.id, data);
|
||||
try {
|
||||
await motivatorsService.shareMotivatorSession(
|
||||
motivatorSession.id,
|
||||
session.user.id,
|
||||
data.participant,
|
||||
'EDITOR'
|
||||
);
|
||||
} catch (shareError) {
|
||||
console.error('Auto-share failed:', shareError);
|
||||
}
|
||||
revalidatePath('/motivators');
|
||||
return { success: true, data: motivatorSession };
|
||||
} catch (error) {
|
||||
|
||||
@@ -24,6 +24,16 @@ export async function createWeeklyCheckInSession(data: {
|
||||
session.user.id,
|
||||
data
|
||||
);
|
||||
try {
|
||||
await weeklyCheckInService.shareWeeklyCheckInSession(
|
||||
weeklyCheckInSession.id,
|
||||
session.user.id,
|
||||
data.participant,
|
||||
'EDITOR'
|
||||
);
|
||||
} catch (shareError) {
|
||||
console.error('Auto-share failed:', shareError);
|
||||
}
|
||||
revalidatePath('/weekly-checkin');
|
||||
revalidatePath('/sessions');
|
||||
return { success: true, data: weeklyCheckInSession };
|
||||
|
||||
@@ -24,6 +24,16 @@ export async function createYearReviewSession(data: {
|
||||
session.user.id,
|
||||
data
|
||||
);
|
||||
try {
|
||||
await yearReviewService.shareYearReviewSession(
|
||||
yearReviewSession.id,
|
||||
session.user.id,
|
||||
data.participant,
|
||||
'EDITOR'
|
||||
);
|
||||
} catch (shareError) {
|
||||
console.error('Auto-share failed:', shareError);
|
||||
}
|
||||
revalidatePath('/year-review');
|
||||
revalidatePath('/sessions');
|
||||
return { success: true, data: yearReviewSession };
|
||||
|
||||
Reference in New Issue
Block a user