feat: implement auto-sharing functionality for session creation across motivators, weekly check-ins, and year reviews, enhancing collaboration capabilities
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { auth } from '@/lib/auth';
|
||||
import { prisma } from '@/services/database';
|
||||
import { shareSession } from '@/services/sessions';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
@@ -56,6 +57,12 @@ export async function POST(request: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
await shareSession(newSession.id, session.user.id, collaborator, 'EDITOR');
|
||||
} catch (shareError) {
|
||||
console.error('Auto-share failed:', shareError);
|
||||
}
|
||||
|
||||
return NextResponse.json(newSession, { status: 201 });
|
||||
} catch (error) {
|
||||
console.error('Error creating session:', error);
|
||||
|
||||
Reference in New Issue
Block a user