Teams
Repository
The TeamsRepository
interface is
useful to manage the queries of the Team
Author
N7ghtm4r3 - Tecknobit
See also
JpaRepository
Functions
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + MEMBERS_KEY + " SET " +
TEAM_ROLE_KEY + "=" + ":#{#" + TEAM_ROLE_KEY + ".name()}" +
" WHERE " + OWNER_KEY + "=:" + OWNER_KEY
+ " AND " + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to change a role
of a member
Link copied to clipboard
@Query(value = "SELECT COUNT(*) " + "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 ( " +
" MATCH(t." + TITLE_KEY + ", t." + DESCRIPTION_KEY + ") AGAINST (:" + KEYWORDS_KEY + _IN_BOOLEAN_MODE + ") " +
" OR :" + KEYWORDS_KEY + " = '' " +
")",
nativeQuery = true
)
Method to count all the user's teams
Link copied to clipboard
@Query(value = ""SELECT COUNT(*) FROM " + TEAMS_KEY + " AS t INNER JOIN " + COLLECTIONS_TEAMS_TABLE + " ON t." +
TEAM_IDENTIFIER_KEY + " = " + COLLECTIONS_TEAMS_TABLE + "." + TEAM_IDENTIFIER_KEY +
_WHERE_ + COLLECTIONS_TEAMS_TABLE + "." + COLLECTION_IDENTIFIER_KEY + "=:" + COLLECTION_IDENTIFIER_KEY",
nativeQuery = true
)
Method to count the teams where the
collection is shared
Link copied to clipboard
@Query(value = ""SELECT DISTINCT COUNT(*) " + "FROM " + TEAMS_KEY + " as t INNER JOIN " + MEMBERS_KEY +
" ON t." + TEAM_IDENTIFIER_KEY + "=" + MEMBERS_KEY + "." + TEAM_IDENTIFIER_KEY +
_WHERE_ + "t." + OWNER_KEY + "=:" + USER_IDENTIFIER_KEY",
nativeQuery = true
)
Method to count the user's owned teams
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + TEAMS_KEY + " WHERE " + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to delete a
team
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + COLLECTIONS_LINKS_TABLE
+ " WHERE " + COLLECTION_IDENTIFIER_KEY + "=:" + COLLECTION_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to detach a
collection from links
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + COLLECTIONS_TEAMS_TABLE
+ " WHERE " + COLLECTION_IDENTIFIER_KEY + "=:" + COLLECTION_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to detach a
collection from teams
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + COLLECTIONS_LINKS_TABLE + " WHERE " + LINK_IDENTIFIER_KEY + "=:" + LINK_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to detach a link
from collections
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + TEAMS_LINKS_TABLE + " WHERE " + LINK_IDENTIFIER_KEY + "=:" + LINK_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to detach a link
from teams
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + COLLECTIONS_TEAMS_TABLE + " WHERE " + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to detach a team
from collections
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + TEAMS_LINKS_TABLE + " WHERE " + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to detach a team
from links
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + TEAMS_KEY + " SET " +
TITLE_KEY + "=:" + TITLE_KEY + "," +
LOGO_PIC_KEY + "=:" + LOGO_PIC_KEY + "," +
DESCRIPTION_KEY + "=:" + DESCRIPTION_KEY +
" WHERE " + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY + " AND " + OWNER_KEY + "=:" + OWNER_KEY",
nativeQuery = true
)
Method to execute the query to edit a team
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@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 ( " +
" MATCH(t." + TITLE_KEY + ", t." + DESCRIPTION_KEY + ") AGAINST (:" + KEYWORDS_KEY + _IN_BOOLEAN_MODE + ") " +
" OR :" + KEYWORDS_KEY + " = '' " +
")" +
" ORDER BY " + DATE_KEY + " DESC",
nativeQuery = true
)
Method to execute the query to get all the
user's teams
Link copied to clipboard
@Query(value = "SELECT t.* FROM " + TEAMS_KEY + " AS t INNER JOIN " + COLLECTIONS_TEAMS_TABLE + " ON t." +
TEAM_IDENTIFIER_KEY + "=" + COLLECTIONS_TEAMS_TABLE + "." + TEAM_IDENTIFIER_KEY +
_WHERE_ + COLLECTIONS_TEAMS_TABLE + "." + COLLECTION_IDENTIFIER_KEY + "=:" + COLLECTION_IDENTIFIER_KEY +
" ORDER BY " + DATE_KEY + " DESC",
nativeQuery = true
)
Method to execute the query to get the teams
where the collection is shared
Link copied to clipboard
Link copied to clipboard
@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
)
Method to execute the query to get a team if
the user is authorized
Link copied to clipboard
@Query(value = "SELECT DISTINCT t.* " + "FROM " + TEAMS_KEY + " as t INNER JOIN " + MEMBERS_KEY +
" ON t." + TEAM_IDENTIFIER_KEY + "=" + MEMBERS_KEY + "." + TEAM_IDENTIFIER_KEY +
_WHERE_ + "t." + OWNER_KEY + "=:" + USER_IDENTIFIER_KEY +
" ORDER BY " + DATE_KEY + " DESC",
nativeQuery = true
)
Method to execute the query to get the
user's owned teams
Link copied to clipboard
@Query(value = "SELECT " + TEAM_IDENTIFIER_KEY + " FROM " + TEAMS_KEY + " WHERE "
+ OWNER_KEY + "=:" + USER_IDENTIFIER_KEY +
" ORDER BY " + DATE_KEY + " DESC",
nativeQuery = true
)
Method to execute the query to get the
user's owned teams identifiers
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + COLLECTIONS_TEAMS_TABLE + _WHERE_ +
TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY +
" AND " + COLLECTION_IDENTIFIER_KEY + "=:" + COLLECTION_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to remove a
collection from a team
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + TEAMS_LINKS_TABLE + _WHERE_ +
TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY +
" AND " + LINK_IDENTIFIER_KEY + "=:" + LINK_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query remove a link
from a team
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + MEMBERS_KEY + " WHERE "
+ OWNER_KEY + "=:" + OWNER_KEY + " AND "
+ TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to remove a
member from a team
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "INSERT INTO " + TEAMS_KEY + "(" +
TEAM_IDENTIFIER_KEY + "," +
TITLE_KEY + "," +
LOGO_PIC_KEY + "," +
DESCRIPTION_KEY + "," +
DATE_KEY + "," +
OWNER_KEY
+ ") VALUES (" +
":" + TEAM_IDENTIFIER_KEY + "," +
":" + TITLE_KEY + "," +
":" + LOGO_PIC_KEY + "," +
":" + DESCRIPTION_KEY + "," +
":" + DATE_KEY + "," +
":" + OWNER_KEY +
")",
nativeQuery = true
)
Method to execute the query to save a team