@@ -272,7 +272,11 @@ const resolvers = {
272272 const { name, cohortName, orgToken, startingPhase, ttlEmail } = args
273273
274274 // some validations
275- ; ( await checkUserLoggedIn ( context ) ) ( [ RoleOfUser . SUPER_ADMIN , RoleOfUser . ADMIN , RoleOfUser . MANAGER ] )
275+ ; ( await checkUserLoggedIn ( context ) ) ( [
276+ RoleOfUser . SUPER_ADMIN ,
277+ RoleOfUser . ADMIN ,
278+ RoleOfUser . MANAGER ,
279+ ] )
276280 const cohort = await Cohort . findOne ( { name : cohortName } )
277281
278282 const organ = await checkLoggedInOrganization ( orgToken )
@@ -346,7 +350,10 @@ const resolvers = {
346350 }
347351 } ,
348352 deleteTeam : async ( parent : any , args : any , context : Context ) => {
349- ; ( await checkUserLoggedIn ( context ) ) ( [ RoleOfUser . ADMIN , RoleOfUser . MANAGER ] )
353+ ; ( await checkUserLoggedIn ( context ) ) ( [
354+ RoleOfUser . ADMIN ,
355+ RoleOfUser . MANAGER ,
356+ ] )
350357 const findTeam = await Team . findById ( args . id )
351358 if ( ! findTeam )
352359 throw new Error ( 'The Team you want to delete does not exist' )
@@ -425,7 +432,7 @@ const resolvers = {
425432 const prevTeamName = team . name
426433 const teamCohort = team ?. cohort
427434 const cohortProgram = team ?. cohort ?. program as ProgramType
428- const cohortOrg = cohortProgram . organization as OrganizationType
435+ const cohortOrg = cohortProgram ? .organization as OrganizationType
429436 const org = await checkLoggedInOrganization ( orgToken )
430437
431438 if ( ! team ) {
@@ -450,8 +457,10 @@ const resolvers = {
450457
451458 if ( role !== RoleOfUser . SUPER_ADMIN ) {
452459 const org = await checkLoggedInOrganization ( orgToken )
453-
454- if ( cohortOrg . id . toString ( ) !== org . id . toString ( ) ) {
460+ console . log ( '>>>>>>>>>>>>>' )
461+ console . log ( cohortOrg )
462+ console . log ( '>>>>>>>>>>>>>' )
463+ if ( cohortOrg ?. id . toString ( ) !== org . id . toString ( ) ) {
455464 throw new GraphQLError (
456465 `Team with id "${ team ?. id } " doesn't exist in this organization` ,
457466 {
0 commit comments