1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32331],{32331:(e,r,n)=>{n.d(r,{ensureParentTeamConnections:()=>t});var s=n(10675);async function a(e,r){if(!s.prisma)return!1;let n=await s.prisma.parent.findUnique({where:{id:e},include:{users:{where:{id:r},select:{id:!0}}}});return!((n?.users?.length||0)>0)&&(await s.prisma.parent.update({where:{id:e},data:{users:{connect:{id:r}}}}),!0)}async function t(e){try{if(!s.prisma)return;console.log(`ð Ensuring parent-team connections for player ${e}`);let r=await s.prisma.player.findUnique({where:{id:e},include:{user:{select:{id:!0}},parents:{include:{user:!0}},teams:{select:{id:!0,name:!0}}}});if(!r)return void console.log(`â Player ${e} not found`);if(!r.user?.id)return void console.log(`â Player ${e} has no linked user`);for(let n of(console.log(`ð¨âð©âð§âð¦ Player ${e} has ${r.parents.length} parents and ${r.teams.length} teams`),r.parents))console.log(`ð Ensuring parent ${n.userid} (${n.user?.firstname} ${n.user?.lastname}) is connected to all teams`),await a(n.id,r.user.id)?console.log(`â
Parent ${n.userid} linked to player user ${r.user.id}`):console.log(`â
Parent ${n.userid} already linked to player user ${r.user.id}`)}catch(r){console.error(`â Error ensuring parent-team connections for player ${e}:`,r)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.