getTeamIfAllowed

@Query(value = "SELECT t.* " + "FROM " + TEAMS_KEY + " as t INNER JOIN " + MEMBERS_KEY + " ON t." + TEAM_IDENTIFIER_KEY + "=" + MEMBERS_KEY + "." + TEAM_IDENTIFIER_KEY + " WHERE " + MEMBERS_KEY + "." + OWNER_KEY + "=:" + USER_IDENTIFIER_KEY + " AND t." + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY + " LIMIT 1", nativeQuery = true)
abstract fun getTeamIfAllowed(@Param(value = "user_id") userId: String, @Param(value = "team_id") teamId: String): Team

Method to execute the query to get a team if the user is authorized

Return

the team if the user is authorized as Team

Parameters

userId

: the identifier of the user

teamId

: the team identifier