TeamsRepository
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
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", nativeQuery = true)
Method to execute the query to get all the user's teams
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 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", 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", 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 " + 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 + "," +
OWNER_KEY
+ ") VALUES (" +
":" + TEAM_IDENTIFIER_KEY + "," +
":" + TITLE_KEY + "," +
":" + LOGO_PIC_KEY + "," +
":" + DESCRIPTION_KEY + "," +
":" + OWNER_KEY +
")", nativeQuery = true)
Method to execute the query to save a team