TeamsRepository

@Service
@Repository
interface TeamsRepository : RefyItemsRepository<T>

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)
abstract fun changeMemberRole(@Param(value = "owner") member: String, @Param(value = "team_id") teamId: String, @Param(value = "team_role") role: Team.RefyTeamMember.TeamRole)
Method to execute the query to change a role of a member
Link copied to clipboard
abstract fun <S : T?> count(example: Example<S>): Long
Link copied to clipboard
abstract fun delete(entity: T)
Link copied to clipboard
abstract fun deleteAll(entities: Iterable<out T>)
Link copied to clipboard
abstract fun deleteAllById(ids: Iterable<out ID>)
Link copied to clipboard
abstract fun deleteAllByIdInBatch(ids: Iterable<ID>)
Link copied to clipboard
abstract fun deleteAllInBatch(entities: Iterable<T>)
Link copied to clipboard
abstract fun deleteById(id: ID)
Link copied to clipboard
open fun deleteInBatch(entities: Iterable<T>)
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = ""DELETE FROM " + TEAMS_KEY + " WHERE " + TEAM_IDENTIFIER_KEY + "=:" + TEAM_IDENTIFIER_KEY", nativeQuery = true)
abstract fun deleteTeam(@Param(value = "team_id") teamId: String)
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)
abstract fun detachCollectionFromLinks(@Param(value = "collection_id") collectionId: String)
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)
abstract fun detachCollectionFromTeams(@Param(value = "collection_id") collectionId: String)
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)
abstract fun detachLinkFromCollections(@Param(value = "link_id") linkId: String)
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)
abstract fun detachLinkFromTeams(@Param(value = "link_id") linkId: String)
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)
abstract fun detachTeamFromCollections(@Param(value = "team_id") teamId: String)
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)
abstract fun detachTeamFromLinks(@Param(value = "team_id") teamId: String)
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)
abstract fun editTeam(@Param(value = "team_id") teamId: String, @Param(value = "title") title: String, @Param(value = "logo_pic") logoPic: String, @Param(value = "description") description: String, @Param(value = "owner") owner: String)
Method to execute the query to edit a team
Link copied to clipboard
abstract fun <S : T?> exists(example: Example<S>): Boolean
Link copied to clipboard
abstract fun existsById(id: ID): Boolean
Link copied to clipboard
abstract fun <S : T?> findAll(example: Example<S>): List<S>
abstract fun findAll(): Iterable<T>
abstract fun findAll(): List<T>
abstract fun findAll(pageable: Pageable): Page<T>
abstract fun <S : T?> findAll(example: Example<S>): Iterable<S>
abstract fun <S : T?> findAll(example: Example<S>, pageable: Pageable): Page<S>
Link copied to clipboard
abstract fun findAllById(ids: Iterable<ID>): Iterable<T>
abstract fun findAllById(ids: Iterable<ID>): List<T>
Link copied to clipboard
abstract fun <S : T?, R> findBy(example: Example<S>, queryFunction: (FluentQuery.FetchableFluentQuery<S>) -> R): R
Link copied to clipboard
abstract fun findById(id: ID): Optional<T>
Link copied to clipboard
abstract fun <S : T?> findOne(example: Example<S>): Optional<S>
Link copied to clipboard
abstract fun flush()
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)
abstract fun getAllUserTeams(@Param(value = "user_id") owner: String): List<Team>
Method to execute the query to get all the user's teams
Link copied to clipboard
abstract fun getById(id: ID): T
Link copied to clipboard
abstract fun getOne(id: ID): T
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
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)
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
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)
abstract fun getUserOwnedTeams(@Param(value = "user_id") owner: String): List<Team>
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)
abstract fun getUserTeams(@Param(value = "user_id") owner: String): HashSet<String>
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)
abstract fun removeMember(@Param(value = "owner") member: String, @Param(value = "team_id") teamId: String)
Method to execute the query to remove a member from a team
Link copied to clipboard
abstract fun <S : T?> save(entity: S): S
Link copied to clipboard
abstract fun <S : T?> saveAll(entities: Iterable<S>): Iterable<S>
abstract fun <S : T?> saveAll(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAllAndFlush(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAndFlush(entity: S): S
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)
abstract fun saveTeam(@Param(value = "team_id") teamId: String, @Param(value = "title") title: String, @Param(value = "logo_pic") logoPic: String, @Param(value = "description") description: String, @Param(value = "owner") owner: String)
Method to execute the query to save a team