liquido.mongoDB.js
/** 
 * Create a new team with the team's admin.
 * The admin is the first member of the team.
 * @param {String|Object} teamName, adminName and adminEmail, either as three parameters or one JSON objecct
 * @return {Promise} saved team
 */
Create a new team with the team's admin.
The admin is the first member of the team.
@param {String|Object} teamName, adminName and adminEmail, either as three parameters or one JSON objecct
@return {Promise} saved team
Create a new team with the team ' s admin . The admin is the first member of the team . @param { String|Object } teamName adminName and adminEmail either as three parameters or one JSON objecct @return { Promise } saved team
async function createNewTeam(teamName, adminName, adminEmail) {
	if (arguments.length === 1) {
		var { teamName, adminName, adminEmail } = arguments[0]
	}
	if (!teamName) return Promise.reject("Need teamName")
	if (!adminName) return Promise.reject("Need adminName")
	if (!adminEmail) return Promise.reject("Need adminEmail")
	LOG.debug("createTeam(%s, %s, %s)", teamName, adminName, adminEmail)
	try {
		let savedTeam = await Team.create({ teamName: teamName, members: [{ name: adminName, email: adminEmail }] })
		LOG.info("New team created", JSON.stringify(savedTeam))
		return savedTeam
	} catch (err) {
		LOG.error("Could not create team '%s': %s", teamName, err)
		return Promise.reject(err)
	}
}
async function createNewTeam ( teamName , adminName , adminEmail ) { if ( arguments . length === 1 ) { var { teamName , adminName , adminEmail } = arguments [ 0 ] } if ( ! teamName ) return Promise . reject ( "Need teamName" ) if ( ! adminName ) return Promise . reject ( "Need adminName" ) if ( ! adminEmail ) return Promise . reject ( "Need adminEmail" ) LOG . debug ( "createTeam(%s, %s, %s)" , teamName , adminName , adminEmail ) try { let savedTeam = await Team . create ( { teamName : teamName , members : [ { name : adminName , email : adminEmail } ] } ) LOG . info ( "New team created" , JSON . stringify ( savedTeam ) ) return savedTeam } catch ( err ) { LOG . error ( "Could not create team '%s': %s" , teamName , err ) return Promise . reject ( err ) } }
Create a new team with the team's admin.
Create a new team with the team ' s admin .
// sanity check // Create Team with admin, inviteCode is automatically calculated.