Group Members Repository

@Repository
interface GroupMembersRepository : JpaRepository<T, ID>

The GroupMembersRepository interface is useful to manage the queries for the members of the groups

Author

N7ghtm4r3 - Tecknobit

See also

JpaRepository

Functions

Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + GROUP_MEMBERS_TABLE + " SET " + INVITATION_STATUS_KEY + "=" + "'JOINED'" + " WHERE " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun acceptGroupInvitation(@Param(value = "id") memberId: String, @Param(value = "group_member") groupId: String)
Method to execute the query to accept a group invitation
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + GROUP_MEMBERS_TABLE + " SET " + EMAIL_KEY + "=:" + EMAIL_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun changeEmail(@Param(value = "id") userId: String, @Param(value = "email") email: String)
Method to execute the query to change the user's email
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + GROUP_MEMBERS_TABLE + " SET " + MEMBER_ROLE_KEY + "=" + ":#{#" + MEMBER_ROLE_KEY + ".name()}" + " WHERE " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun changeMemberRole(@Param(value = "id") memberId: String, @Param(value = "group_member") groupId: String, @Param(value = "role") role: Role)
Method to execute the query to change the role of a group member
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + GROUP_MEMBERS_TABLE + " SET " + PROFILE_PIC_KEY + "=:" + PROFILE_PIC_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun changeProfilePic(@Param(value = "id") userId: String, @Param(value = "profile_pic") profilePic: String)
Method to execute the query to change the user's profile pic
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 " + GROUP_MEMBERS_TABLE + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun deleteMember(@Param(value = "id") memberId: String)
Method to execute the query to delete the user's account
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 * FROM " + GROUP_MEMBERS_TABLE + " WHERE " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY", nativeQuery = true )
abstract fun getAllGroupMembers(@Param(value = "group_member") groupId: String): List<GroupMember>
Method to execute the query to select the members of a group
Link copied to clipboard
abstract fun getById(id: ID): T
Link copied to clipboard
@Query(value = ""SELECT * FROM " + GROUP_MEMBERS_TABLE + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY", nativeQuery = true )
abstract fun getGroupMember(@Param(value = "id") memberId: String, @Param(value = "group_member") groupId: String): GroupMember
Method to execute the query to select a GroupMember by its id
Link copied to clipboard
@Query(value = ""SELECT * FROM " + GROUP_MEMBERS_TABLE + " WHERE " + EMAIL_KEY + "=:" + EMAIL_KEY + " AND " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun getGroupMemberByEmail(@Param(value = "id") memberId: String, @Param(value = "group_member") groupId: String, @Param(value = "email") email: String): GroupMember
Method to execute the query to select a GroupMember by its email
Link copied to clipboard
@Query(value = "SELECT * FROM " + GROUP_MEMBERS_TABLE + " WHERE " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY + " AND " + INVITATION_STATUS_KEY + " = 'JOINED'", nativeQuery = true )
abstract fun getGroupMembers(@Param(value = "group_member") groupId: String): List<GroupMember>
Method to execute the query to select the members of a group
Link copied to clipboard
abstract fun getOne(id: ID): T
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "INSERT IGNORE INTO " + GROUP_MEMBERS_TABLE + "( " + IDENTIFIER_KEY + "," + NAME_KEY + "," + EMAIL_KEY + "," + PROFILE_PIC_KEY + "," + SURNAME_KEY + "," + MEMBER_ROLE_KEY + "," + INVITATION_STATUS_KEY + "," + GROUP_MEMBER_KEY + ") VALUES " + "( " + ":" + IDENTIFIER_KEY + "," + ":" + NAME_KEY + "," + ":" + EMAIL_KEY + "," + ":" + PROFILE_PIC_KEY + "," + ":" + SURNAME_KEY + "," + ":#{#" + MEMBER_ROLE_KEY + ".name()}," + ":#{#" + INVITATION_STATUS_KEY + ".name()}," + ":" + GROUP_MEMBER_KEY + ")", nativeQuery = true )
abstract fun insertMember(@Param(value = "id") memberId: String, @Param(value = "name") name: String, @Param(value = "email") email: String, @Param(value = "profile_pic") profilePic: String, @Param(value = "surname") surname: String, @Param(value = "role") role: Role, @Param(value = "invitation_status") invitationStatus: InvitationStatus, @Param(value = "group_member") groupId: String)
Method to execute the query to add a member in a com.tecknobit.pandoro.services.groups.entity.Group
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""DELETE FROM " + GROUP_MEMBERS_TABLE + " WHERE " + GROUP_MEMBER_KEY + "=:" + GROUP_MEMBER_KEY + " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY", nativeQuery = true )
abstract fun leaveGroup(@Param(value = "id") memberId: String, @Param(value = "group_member") groupId: String)
Method to execute the query to leave from a group
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