@@ -236,22 +236,6 @@ export default class TeamsService {
236236 if ( ! ( await userHasPermission ( newHead . userId , organization . organizationId , isHead ) ) )
237237 throw new AccessDeniedException ( 'The team head must be at least a head' ) ;
238238
239- // checking to see if any other teams have the new head as their current head or lead
240- const newHeadTeam = await prisma . team . findFirst ( {
241- where : {
242- AND : [
243- { OR : [ { headId : userId } , { leads : { some : { userId } } } ] } ,
244- { NOT : { teamId : team . teamId } } ,
245- { organizationId : organization . organizationId }
246- ]
247- }
248- } ) ;
249-
250- if ( newHeadTeam )
251- throw new AccessDeniedException (
252- 'The new team head must not be a head or lead of another team in the same organization!'
253- ) ;
254-
255239 const updateTeam = await prisma . team . update ( {
256240 where : { teamId } ,
257241 data : {
@@ -321,14 +305,6 @@ export default class TeamsService {
321305 if ( ! ( await userHasPermission ( newHead . userId , organization . organizationId , isHead ) ) )
322306 throw new HttpException ( 400 , 'The team head must be at least a head' ) ;
323307
324- // checking to see if any other teams have the new head as their current head
325- const newHeadTeam = await prisma . team . findFirst ( {
326- where : { headId, organizationId : organization . organizationId }
327- } ) ;
328-
329- if ( newHeadTeam )
330- throw new HttpException ( 400 , 'The new team head must not be a head of another team in the same organization.' ) ;
331-
332308 const duplicateName = await prisma . team . findFirst ( {
333309 where : { teamName, organizationId : organization . organizationId }
334310 } ) ;
0 commit comments